@@ -471,6 +471,19 @@ class FastCApiObject {
471471 }
472472
473473#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+ }
474487 static AnyCType AddAll32BitIntFastCallback_6ArgsPatch (
475488 AnyCType receiver, AnyCType should_fallback, AnyCType arg1_i32,
476489 AnyCType arg2_i32, AnyCType arg3_i32, AnyCType arg4_u32,
@@ -494,6 +507,26 @@ class FastCApiObject {
494507 }
495508#endif // V8_USE_SIMULATOR_WITH_GENERIC_C_CALLS
496509
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+ }
497530 static int AddAll32BitIntFastCallback_6Args (
498531 Local<Object> receiver, bool should_fallback, int32_t arg1_i32,
499532 int32_t arg2_i32, int32_t arg3_i32, uint32_t arg4_u32, uint32_t arg5_u32,
@@ -531,24 +564,29 @@ class FastCApiObject {
531564
532565 HandleScope handle_scope (isolate);
533566
567+ Local<Context> context = isolate->GetCurrentContext ();
534568 double sum = 0 ;
535569 if (args.Length () > 1 && args[1 ]->IsNumber ()) {
536- sum += args[1 ]->Int32Value (isolate-> GetCurrentContext () ).FromJust ();
570+ sum += args[1 ]->Int32Value (context ).FromJust ();
537571 }
538572 if (args.Length () > 2 && args[2 ]->IsNumber ()) {
539- sum += args[2 ]->Int32Value (isolate-> GetCurrentContext () ).FromJust ();
573+ sum += args[2 ]->Int32Value (context ).FromJust ();
540574 }
541575 if (args.Length () > 3 && args[3 ]->IsNumber ()) {
542- sum += args[3 ]->Int32Value (isolate-> GetCurrentContext () ).FromJust ();
576+ sum += args[3 ]->Int32Value (context ).FromJust ();
543577 }
544578 if (args.Length () > 4 && args[4 ]->IsNumber ()) {
545- sum += args[4 ]->Uint32Value (isolate-> GetCurrentContext () ).FromJust ();
579+ sum += args[4 ]->Uint32Value (context ).FromJust ();
546580 }
547581 if (args.Length () > 5 && args[5 ]->IsNumber ()) {
548- sum += args[5 ]->Uint32Value (isolate-> GetCurrentContext () ).FromJust ();
582+ sum += args[5 ]->Uint32Value (context ).FromJust ();
549583 }
550584 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 ();
552590 }
553591
554592 args.GetReturnValue ().Set (Number::New (isolate, sum));
@@ -1160,6 +1198,9 @@ Local<FunctionTemplate> Shell::CreateTestFastCApiTemplate(Isolate* isolate) {
11601198 signature, 1 , ConstructorBehavior::kThrow ,
11611199 SideEffectType::kHasSideEffect , {add_all_invalid_overloads, 2 }));
11621200
1201+ CFunction add_all_32bit_int_8args_c_func = CFunction::Make (
1202+ FastCApiObject::AddAll32BitIntFastCallback_8Args V8_IF_USE_SIMULATOR (
1203+ FastCApiObject::AddAll32BitIntFastCallback_8ArgsPatch));
11631204 CFunction add_all_32bit_int_6args_c_func = CFunction::Make (
11641205 FastCApiObject::AddAll32BitIntFastCallback_6Args V8_IF_USE_SIMULATOR (
11651206 FastCApiObject::AddAll32BitIntFastCallback_6ArgsPatch));
@@ -1176,6 +1217,13 @@ Local<FunctionTemplate> Shell::CreateTestFastCApiTemplate(Isolate* isolate) {
11761217 signature, 1 , ConstructorBehavior::kThrow ,
11771218 SideEffectType::kHasSideEffect , {c_function_overloads, 2 }));
11781219
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+
11791227 api_obj_ctor->PrototypeTemplate ()->Set (
11801228 isolate, " overloaded_add_all_32bit_int_no_sig" ,
11811229 FunctionTemplate::NewWithCFunctionOverloads (
0 commit comments