@@ -471,6 +471,19 @@ class FastCApiObject {
471
471
}
472
472
473
473
#ifdef V8_USE_SIMULATOR_WITH_GENERIC_C_CALLS
474
+ static AnyCType AddAll32BitIntFastCallback_8ArgsPatch (
475
+ AnyCType receiver, AnyCType should_fallback, AnyCType arg1_i32,
476
+ AnyCType arg2_i32, AnyCType arg3_i32, AnyCType arg4_u32,
477
+ AnyCType arg5_u32, AnyCType arg6_u32, AnyCType arg7_u32,
478
+ AnyCType arg8_u32, AnyCType options) {
479
+ AnyCType ret;
480
+ ret.int32_value = AddAll32BitIntFastCallback_8Args (
481
+ receiver.object_value , should_fallback.bool_value , arg1_i32.int32_value ,
482
+ arg2_i32.int32_value , arg3_i32.int32_value , arg4_u32.uint32_value ,
483
+ arg5_u32.uint32_value , arg6_u32.uint32_value , arg7_u32.uint32_value ,
484
+ arg8_u32.uint32_value , *options.options_value );
485
+ return ret;
486
+ }
474
487
static AnyCType AddAll32BitIntFastCallback_6ArgsPatch (
475
488
AnyCType receiver, AnyCType should_fallback, AnyCType arg1_i32,
476
489
AnyCType arg2_i32, AnyCType arg3_i32, AnyCType arg4_u32,
@@ -494,6 +507,26 @@ class FastCApiObject {
494
507
}
495
508
#endif // V8_USE_SIMULATOR_WITH_GENERIC_C_CALLS
496
509
510
+ static int AddAll32BitIntFastCallback_8Args (
511
+ Local<Object> receiver, bool should_fallback, int32_t arg1_i32,
512
+ int32_t arg2_i32, int32_t arg3_i32, uint32_t arg4_u32, uint32_t arg5_u32,
513
+ uint32_t arg6_u32, uint32_t arg7_u32, uint32_t arg8_u32,
514
+ FastApiCallbackOptions& options) {
515
+ FastCApiObject* self = UnwrapObject (receiver);
516
+ CHECK_SELF_OR_FALLBACK (0 );
517
+ self->fast_call_count_ ++;
518
+
519
+ if (should_fallback) {
520
+ options.fallback = true ;
521
+ return 0 ;
522
+ }
523
+
524
+ int64_t result = static_cast <int64_t >(arg1_i32) + arg2_i32 + arg3_i32 +
525
+ arg4_u32 + arg5_u32 + arg6_u32 + arg7_u32 + arg8_u32;
526
+ if (result > INT_MAX) return INT_MAX;
527
+ if (result < INT_MIN) return INT_MIN;
528
+ return static_cast <int >(result);
529
+ }
497
530
static int AddAll32BitIntFastCallback_6Args (
498
531
Local<Object> receiver, bool should_fallback, int32_t arg1_i32,
499
532
int32_t arg2_i32, int32_t arg3_i32, uint32_t arg4_u32, uint32_t arg5_u32,
@@ -531,24 +564,29 @@ class FastCApiObject {
531
564
532
565
HandleScope handle_scope (isolate);
533
566
567
+ Local<Context> context = isolate->GetCurrentContext ();
534
568
double sum = 0 ;
535
569
if (args.Length () > 1 && args[1 ]->IsNumber ()) {
536
- sum += args[1 ]->Int32Value (isolate-> GetCurrentContext () ).FromJust ();
570
+ sum += args[1 ]->Int32Value (context ).FromJust ();
537
571
}
538
572
if (args.Length () > 2 && args[2 ]->IsNumber ()) {
539
- sum += args[2 ]->Int32Value (isolate-> GetCurrentContext () ).FromJust ();
573
+ sum += args[2 ]->Int32Value (context ).FromJust ();
540
574
}
541
575
if (args.Length () > 3 && args[3 ]->IsNumber ()) {
542
- sum += args[3 ]->Int32Value (isolate-> GetCurrentContext () ).FromJust ();
576
+ sum += args[3 ]->Int32Value (context ).FromJust ();
543
577
}
544
578
if (args.Length () > 4 && args[4 ]->IsNumber ()) {
545
- sum += args[4 ]->Uint32Value (isolate-> GetCurrentContext () ).FromJust ();
579
+ sum += args[4 ]->Uint32Value (context ).FromJust ();
546
580
}
547
581
if (args.Length () > 5 && args[5 ]->IsNumber ()) {
548
- sum += args[5 ]->Uint32Value (isolate-> GetCurrentContext () ).FromJust ();
582
+ sum += args[5 ]->Uint32Value (context ).FromJust ();
549
583
}
550
584
if (args.Length () > 6 && args[6 ]->IsNumber ()) {
551
- sum += args[6 ]->Uint32Value (isolate->GetCurrentContext ()).FromJust ();
585
+ sum += args[6 ]->Uint32Value (context).FromJust ();
586
+ }
587
+ if (args.Length () > 7 && args[7 ]->IsNumber () && args[8 ]->IsNumber ()) {
588
+ sum += args[7 ]->Uint32Value (context).FromJust ();
589
+ sum += args[8 ]->Uint32Value (context).FromJust ();
552
590
}
553
591
554
592
args.GetReturnValue ().Set (Number::New (isolate, sum));
@@ -1160,6 +1198,9 @@ Local<FunctionTemplate> Shell::CreateTestFastCApiTemplate(Isolate* isolate) {
1160
1198
signature, 1 , ConstructorBehavior::kThrow ,
1161
1199
SideEffectType::kHasSideEffect , {add_all_invalid_overloads, 2 }));
1162
1200
1201
+ CFunction add_all_32bit_int_8args_c_func = CFunction::Make (
1202
+ FastCApiObject::AddAll32BitIntFastCallback_8Args V8_IF_USE_SIMULATOR (
1203
+ FastCApiObject::AddAll32BitIntFastCallback_8ArgsPatch));
1163
1204
CFunction add_all_32bit_int_6args_c_func = CFunction::Make (
1164
1205
FastCApiObject::AddAll32BitIntFastCallback_6Args V8_IF_USE_SIMULATOR (
1165
1206
FastCApiObject::AddAll32BitIntFastCallback_6ArgsPatch));
@@ -1176,6 +1217,13 @@ Local<FunctionTemplate> Shell::CreateTestFastCApiTemplate(Isolate* isolate) {
1176
1217
signature, 1 , ConstructorBehavior::kThrow ,
1177
1218
SideEffectType::kHasSideEffect , {c_function_overloads, 2 }));
1178
1219
1220
+ api_obj_ctor->PrototypeTemplate ()->Set (
1221
+ isolate, " overloaded_add_all_8args" ,
1222
+ FunctionTemplate::New (
1223
+ isolate, FastCApiObject::AddAll32BitIntSlowCallback, Local<Value>(),
1224
+ signature, 1 , ConstructorBehavior::kThrow ,
1225
+ SideEffectType::kHasSideEffect , &add_all_32bit_int_8args_c_func));
1226
+
1179
1227
api_obj_ctor->PrototypeTemplate ()->Set (
1180
1228
isolate, " overloaded_add_all_32bit_int_no_sig" ,
1181
1229
FunctionTemplate::NewWithCFunctionOverloads (
0 commit comments