@@ -456,6 +456,19 @@ class FastCApiObject {
456456 }
457457
458458#ifdef V8_USE_SIMULATOR_WITH_GENERIC_C_CALLS
459+ static AnyCType AddAll32BitIntFastCallback_8ArgsPatch (
460+ AnyCType receiver, AnyCType should_fallback, AnyCType arg1_i32,
461+ AnyCType arg2_i32, AnyCType arg3_i32, AnyCType arg4_u32,
462+ AnyCType arg5_u32, AnyCType arg6_u32, AnyCType arg7_u32,
463+ AnyCType arg8_u32, AnyCType options) {
464+ AnyCType ret;
465+ ret.int32_value = AddAll32BitIntFastCallback_8Args (
466+ receiver.object_value , should_fallback.bool_value , arg1_i32.int32_value ,
467+ arg2_i32.int32_value , arg3_i32.int32_value , arg4_u32.uint32_value ,
468+ arg5_u32.uint32_value , arg6_u32.uint32_value , arg7_u32.uint32_value ,
469+ arg8_u32.uint32_value , *options.options_value );
470+ return ret;
471+ }
459472 static AnyCType AddAll32BitIntFastCallback_6ArgsPatch (
460473 AnyCType receiver, AnyCType should_fallback, AnyCType arg1_i32,
461474 AnyCType arg2_i32, AnyCType arg3_i32, AnyCType arg4_u32,
@@ -479,6 +492,26 @@ class FastCApiObject {
479492 }
480493#endif // V8_USE_SIMULATOR_WITH_GENERIC_C_CALLS
481494
495+ static int AddAll32BitIntFastCallback_8Args (
496+ Local<Object> receiver, bool should_fallback, int32_t arg1_i32,
497+ int32_t arg2_i32, int32_t arg3_i32, uint32_t arg4_u32, uint32_t arg5_u32,
498+ uint32_t arg6_u32, uint32_t arg7_u32, uint32_t arg8_u32,
499+ FastApiCallbackOptions& options) {
500+ FastCApiObject* self = UnwrapObject (receiver);
501+ CHECK_SELF_OR_FALLBACK (0 );
502+ self->fast_call_count_ ++;
503+
504+ if (should_fallback) {
505+ options.fallback = true ;
506+ return 0 ;
507+ }
508+
509+ int64_t result = static_cast <int64_t >(arg1_i32) + arg2_i32 + arg3_i32 +
510+ arg4_u32 + arg5_u32 + arg6_u32 + arg7_u32 + arg8_u32;
511+ if (result > INT_MAX) return INT_MAX;
512+ if (result < INT_MIN) return INT_MIN;
513+ return static_cast <int >(result);
514+ }
482515 static int AddAll32BitIntFastCallback_6Args (
483516 Local<Object> receiver, bool should_fallback, int32_t arg1_i32,
484517 int32_t arg2_i32, int32_t arg3_i32, uint32_t arg4_u32, uint32_t arg5_u32,
@@ -516,24 +549,29 @@ class FastCApiObject {
516549
517550 HandleScope handle_scope (isolate);
518551
552+ Local<Context> context = isolate->GetCurrentContext ();
519553 double sum = 0 ;
520554 if (args.Length () > 1 && args[1 ]->IsNumber ()) {
521- sum += args[1 ]->Int32Value (isolate-> GetCurrentContext () ).FromJust ();
555+ sum += args[1 ]->Int32Value (context ).FromJust ();
522556 }
523557 if (args.Length () > 2 && args[2 ]->IsNumber ()) {
524- sum += args[2 ]->Int32Value (isolate-> GetCurrentContext () ).FromJust ();
558+ sum += args[2 ]->Int32Value (context ).FromJust ();
525559 }
526560 if (args.Length () > 3 && args[3 ]->IsNumber ()) {
527- sum += args[3 ]->Int32Value (isolate-> GetCurrentContext () ).FromJust ();
561+ sum += args[3 ]->Int32Value (context ).FromJust ();
528562 }
529563 if (args.Length () > 4 && args[4 ]->IsNumber ()) {
530- sum += args[4 ]->Uint32Value (isolate-> GetCurrentContext () ).FromJust ();
564+ sum += args[4 ]->Uint32Value (context ).FromJust ();
531565 }
532566 if (args.Length () > 5 && args[5 ]->IsNumber ()) {
533- sum += args[5 ]->Uint32Value (isolate-> GetCurrentContext () ).FromJust ();
567+ sum += args[5 ]->Uint32Value (context ).FromJust ();
534568 }
535569 if (args.Length () > 6 && args[6 ]->IsNumber ()) {
536- sum += args[6 ]->Uint32Value (isolate->GetCurrentContext ()).FromJust ();
570+ sum += args[6 ]->Uint32Value (context).FromJust ();
571+ }
572+ if (args.Length () > 7 && args[7 ]->IsNumber () && args[8 ]->IsNumber ()) {
573+ sum += args[7 ]->Uint32Value (context).FromJust ();
574+ sum += args[8 ]->Uint32Value (context).FromJust ();
537575 }
538576
539577 args.GetReturnValue ().Set (Number::New (isolate, sum));
@@ -804,6 +842,9 @@ Local<FunctionTemplate> Shell::CreateTestFastCApiTemplate(Isolate* isolate) {
804842 signature, 1 , ConstructorBehavior::kThrow ,
805843 SideEffectType::kHasSideEffect , {add_all_invalid_overloads, 2 }));
806844
845+ CFunction add_all_32bit_int_8args_c_func = CFunction::Make (
846+ FastCApiObject::AddAll32BitIntFastCallback_8Args V8_IF_USE_SIMULATOR (
847+ FastCApiObject::AddAll32BitIntFastCallback_8ArgsPatch));
807848 CFunction add_all_32bit_int_6args_c_func = CFunction::Make (
808849 FastCApiObject::AddAll32BitIntFastCallback_6Args V8_IF_USE_SIMULATOR (
809850 FastCApiObject::AddAll32BitIntFastCallback_6ArgsPatch));
@@ -820,6 +861,20 @@ Local<FunctionTemplate> Shell::CreateTestFastCApiTemplate(Isolate* isolate) {
820861 signature, 1 , ConstructorBehavior::kThrow ,
821862 SideEffectType::kHasSideEffect , {c_function_overloads, 2 }));
822863
864+ api_obj_ctor->PrototypeTemplate ()->Set (
865+ isolate, " overloaded_add_all_8args" ,
866+ FunctionTemplate::New (
867+ isolate, FastCApiObject::AddAll32BitIntSlowCallback, Local<Value>(),
868+ signature, 1 , ConstructorBehavior::kThrow ,
869+ SideEffectType::kHasSideEffect , &add_all_32bit_int_8args_c_func));
870+
871+ api_obj_ctor->PrototypeTemplate ()->Set (
872+ isolate, " overloaded_add_all_32bit_int_no_sig" ,
873+ FunctionTemplate::NewWithCFunctionOverloads (
874+ isolate, FastCApiObject::AddAll32BitIntSlowCallback, Local<Value>(),
875+ Local<Signature>(), 1 , ConstructorBehavior::kThrow ,
876+ SideEffectType::kHasSideEffect , {c_function_overloads, 2 }));
877+
823878 CFunction add_all_no_options_c_func = CFunction::Make (
824879 FastCApiObject::AddAllFastCallbackNoOptions V8_IF_USE_SIMULATOR (
825880 FastCApiObject::AddAllFastCallbackNoOptionsPatch));
0 commit comments