From d5bbd45f044ae6796c0d0f7bd8732069d74418de Mon Sep 17 00:00:00 2001 From: bmeurer Date: Thu, 17 Sep 2015 10:11:38 -0700 Subject: [PATCH] [runtime] Initial step towards switching Execution::Call to callable. Currently Execution::Call (and friends) still duplicate a lot of the Call sequence logic that should be encapsulated in the Call and CallFunction builtins. So the plan now is to switch Execution::Call to accept any Callable and just pass that through to the Call builtin. CQ_INCLUDE_TRYBOTS=tryserver.v8:v8_linux_nosnap_dbg R=jarin@chromium.org BUG=v8:4413 LOG=n Committed: https://crrev.com/359645f48156e15f235e9a9ede7910e0bcd9ae45 Cr-Commit-Position: refs/heads/master@{#30791} Review URL: https://codereview.chromium.org/1353723002 Cr-Commit-Position: refs/heads/master@{#30808} --- src/api.cc | 106 +++++++++--------- src/arm/builtins-arm.cc | 3 +- src/arm64/builtins-arm64.cc | 3 +- src/code-stubs.cc | 4 +- src/execution.cc | 70 ++++++------ src/execution.h | 23 ++-- src/ia32/builtins-ia32.cc | 4 +- src/mips/builtins-mips.cc | 3 +- src/mips64/builtins-mips64.cc | 3 +- src/objects.cc | 4 +- src/runtime/runtime-function.cc | 8 +- src/x64/builtins-x64.cc | 4 +- test/cctest/compiler/function-tester.h | 4 +- .../test-run-bytecode-graph-builder.cc | 5 +- .../compiler/test-simplified-lowering.cc | 2 +- test/cctest/interpreter/test-interpreter.cc | 5 +- 16 files changed, 110 insertions(+), 141 deletions(-) diff --git a/src/api.cc b/src/api.cc index 1b5d428a3..62e50dd44 100644 --- a/src/api.cc +++ b/src/api.cc @@ -4254,10 +4254,8 @@ MaybeLocal Object::CallAsFunction(Local context, recv_obj = self; } Local result; - has_pending_exception = - !ToLocal( - i::Execution::Call(isolate, fun, recv_obj, argc, args, true), - &result); + has_pending_exception = !ToLocal( + i::Execution::Call(isolate, fun, recv_obj, argc, args), &result); RETURN_ON_FAILED_EXECUTION(Value); RETURN_ESCAPED(result); } @@ -4365,10 +4363,8 @@ MaybeLocal Function::Call(Local context, STATIC_ASSERT(sizeof(v8::Local) == sizeof(i::Object**)); i::Handle* args = reinterpret_cast*>(argv); Local result; - has_pending_exception = - !ToLocal( - i::Execution::Call(isolate, self, recv_obj, argc, args, true), - &result); + has_pending_exception = !ToLocal( + i::Execution::Call(isolate, self, recv_obj, argc, args), &result); RETURN_ON_FAILED_EXECUTION(Value); RETURN_ESCAPED(result); } @@ -6141,7 +6137,7 @@ MaybeLocal Map::Get(Local context, Local key) { i::Handle argv[] = {Utils::OpenHandle(*key)}; has_pending_exception = !ToLocal(i::Execution::Call(isolate, isolate->map_get(), self, - arraysize(argv), argv, false), + arraysize(argv), argv), &result); RETURN_ON_FAILED_EXECUTION(Value); RETURN_ESCAPED(result); @@ -6155,9 +6151,9 @@ MaybeLocal Map::Set(Local context, Local key, i::Handle result; i::Handle argv[] = {Utils::OpenHandle(*key), Utils::OpenHandle(*value)}; - has_pending_exception = - !i::Execution::Call(isolate, isolate->map_set(), self, arraysize(argv), - argv, false).ToHandle(&result); + has_pending_exception = !i::Execution::Call(isolate, isolate->map_set(), self, + arraysize(argv), argv) + .ToHandle(&result); RETURN_ON_FAILED_EXECUTION(Map); RETURN_ESCAPED(Local::Cast(Utils::ToLocal(result))); } @@ -6168,9 +6164,9 @@ Maybe Map::Has(Local context, Local key) { auto self = Utils::OpenHandle(this); i::Handle result; i::Handle argv[] = {Utils::OpenHandle(*key)}; - has_pending_exception = - !i::Execution::Call(isolate, isolate->map_has(), self, arraysize(argv), - argv, false).ToHandle(&result); + has_pending_exception = !i::Execution::Call(isolate, isolate->map_has(), self, + arraysize(argv), argv) + .ToHandle(&result); RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); return Just(result->IsTrue()); } @@ -6181,9 +6177,9 @@ Maybe Map::Delete(Local context, Local key) { auto self = Utils::OpenHandle(this); i::Handle result; i::Handle argv[] = {Utils::OpenHandle(*key)}; - has_pending_exception = - !i::Execution::Call(isolate, isolate->map_delete(), self, arraysize(argv), - argv, false).ToHandle(&result); + has_pending_exception = !i::Execution::Call(isolate, isolate->map_delete(), + self, arraysize(argv), argv) + .ToHandle(&result); RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); return Just(result->IsTrue()); } @@ -6220,7 +6216,8 @@ MaybeLocal Map::FromArray(Local context, Local array) { has_pending_exception = !i::Execution::Call(isolate, isolate->map_from_array(), isolate->factory()->undefined_value(), - arraysize(argv), argv, false).ToHandle(&result); + arraysize(argv), argv) + .ToHandle(&result); RETURN_ON_FAILED_EXECUTION(Map); RETURN_ESCAPED(Local::Cast(Utils::ToLocal(result))); } @@ -6255,9 +6252,9 @@ MaybeLocal Set::Add(Local context, Local key) { auto self = Utils::OpenHandle(this); i::Handle result; i::Handle argv[] = {Utils::OpenHandle(*key)}; - has_pending_exception = - !i::Execution::Call(isolate, isolate->set_add(), self, arraysize(argv), - argv, false).ToHandle(&result); + has_pending_exception = !i::Execution::Call(isolate, isolate->set_add(), self, + arraysize(argv), argv) + .ToHandle(&result); RETURN_ON_FAILED_EXECUTION(Set); RETURN_ESCAPED(Local::Cast(Utils::ToLocal(result))); } @@ -6268,9 +6265,9 @@ Maybe Set::Has(Local context, Local key) { auto self = Utils::OpenHandle(this); i::Handle result; i::Handle argv[] = {Utils::OpenHandle(*key)}; - has_pending_exception = - !i::Execution::Call(isolate, isolate->set_has(), self, arraysize(argv), - argv, false).ToHandle(&result); + has_pending_exception = !i::Execution::Call(isolate, isolate->set_has(), self, + arraysize(argv), argv) + .ToHandle(&result); RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); return Just(result->IsTrue()); } @@ -6281,9 +6278,9 @@ Maybe Set::Delete(Local context, Local key) { auto self = Utils::OpenHandle(this); i::Handle result; i::Handle argv[] = {Utils::OpenHandle(*key)}; - has_pending_exception = - !i::Execution::Call(isolate, isolate->set_delete(), self, arraysize(argv), - argv, false).ToHandle(&result); + has_pending_exception = !i::Execution::Call(isolate, isolate->set_delete(), + self, arraysize(argv), argv) + .ToHandle(&result); RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); return Just(result->IsTrue()); } @@ -6317,7 +6314,8 @@ MaybeLocal Set::FromArray(Local context, Local array) { has_pending_exception = !i::Execution::Call(isolate, isolate->set_from_array(), isolate->factory()->undefined_value(), - arraysize(argv), argv, false).ToHandle(&result); + arraysize(argv), argv) + .ToHandle(&result); RETURN_ON_FAILED_EXECUTION(Set); RETURN_ESCAPED(Local::Cast(Utils::ToLocal(result))); } @@ -6332,12 +6330,10 @@ bool Value::IsPromise() const { MaybeLocal Promise::Resolver::New(Local context) { PREPARE_FOR_EXECUTION(context, "Promise::Resolver::New", Resolver); i::Handle result; - has_pending_exception = !i::Execution::Call( - isolate, - isolate->promise_create(), - isolate->factory()->undefined_value(), - 0, NULL, - false).ToHandle(&result); + has_pending_exception = + !i::Execution::Call(isolate, isolate->promise_create(), + isolate->factory()->undefined_value(), 0, NULL) + .ToHandle(&result); RETURN_ON_FAILED_EXECUTION(Promise::Resolver); RETURN_ESCAPED(Local::Cast(Utils::ToLocal(result))); } @@ -6360,12 +6356,11 @@ Maybe Promise::Resolver::Resolve(Local context, PREPARE_FOR_EXECUTION_PRIMITIVE(context, "Promise::Resolver::Resolve", bool); auto self = Utils::OpenHandle(this); i::Handle argv[] = {self, Utils::OpenHandle(*value)}; - has_pending_exception = i::Execution::Call( - isolate, - isolate->promise_resolve(), - isolate->factory()->undefined_value(), - arraysize(argv), argv, - false).is_null(); + has_pending_exception = + i::Execution::Call(isolate, isolate->promise_resolve(), + isolate->factory()->undefined_value(), arraysize(argv), + argv) + .is_null(); RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); return Just(true); } @@ -6382,12 +6377,11 @@ Maybe Promise::Resolver::Reject(Local context, PREPARE_FOR_EXECUTION_PRIMITIVE(context, "Promise::Resolver::Resolve", bool); auto self = Utils::OpenHandle(this); i::Handle argv[] = {self, Utils::OpenHandle(*value)}; - has_pending_exception = i::Execution::Call( - isolate, - isolate->promise_reject(), - isolate->factory()->undefined_value(), - arraysize(argv), argv, - false).is_null(); + has_pending_exception = + i::Execution::Call(isolate, isolate->promise_reject(), + isolate->factory()->undefined_value(), arraysize(argv), + argv) + .is_null(); RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); return Just(true); } @@ -6405,9 +6399,9 @@ MaybeLocal Promise::Chain(Local context, auto self = Utils::OpenHandle(this); i::Handle argv[] = {Utils::OpenHandle(*handler)}; i::Handle result; - has_pending_exception = - !i::Execution::Call(isolate, isolate->promise_chain(), self, - arraysize(argv), argv, false).ToHandle(&result); + has_pending_exception = !i::Execution::Call(isolate, isolate->promise_chain(), + self, arraysize(argv), argv) + .ToHandle(&result); RETURN_ON_FAILED_EXECUTION(Promise); RETURN_ESCAPED(Local::Cast(Utils::ToLocal(result))); } @@ -6425,9 +6419,9 @@ MaybeLocal Promise::Catch(Local context, auto self = Utils::OpenHandle(this); i::Handle argv[] = { Utils::OpenHandle(*handler) }; i::Handle result; - has_pending_exception = - !i::Execution::Call(isolate, isolate->promise_catch(), self, - arraysize(argv), argv, false).ToHandle(&result); + has_pending_exception = !i::Execution::Call(isolate, isolate->promise_catch(), + self, arraysize(argv), argv) + .ToHandle(&result); RETURN_ON_FAILED_EXECUTION(Promise); RETURN_ESCAPED(Local::Cast(Utils::ToLocal(result))); } @@ -6445,9 +6439,9 @@ MaybeLocal Promise::Then(Local context, auto self = Utils::OpenHandle(this); i::Handle argv[] = { Utils::OpenHandle(*handler) }; i::Handle result; - has_pending_exception = - !i::Execution::Call(isolate, isolate->promise_then(), self, - arraysize(argv), argv, false).ToHandle(&result); + has_pending_exception = !i::Execution::Call(isolate, isolate->promise_then(), + self, arraysize(argv), argv) + .ToHandle(&result); RETURN_ON_FAILED_EXECUTION(Promise); RETURN_ESCAPED(Local::Cast(Utils::ToLocal(result))); } diff --git a/src/arm/builtins-arm.cc b/src/arm/builtins-arm.cc index 7daf1aac2..041009387 100644 --- a/src/arm/builtins-arm.cc +++ b/src/arm/builtins-arm.cc @@ -798,8 +798,7 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, CallConstructStub stub(masm->isolate(), NO_CALL_CONSTRUCTOR_FLAGS); __ CallStub(&stub); } else { - ParameterCount actual(r0); - __ InvokeFunction(r1, actual, CALL_FUNCTION, NullCallWrapper()); + __ Call(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); } // Exit the JS frame and remove the parameters (except function), and // return. diff --git a/src/arm64/builtins-arm64.cc b/src/arm64/builtins-arm64.cc index 20f63f82c..01eef0506 100644 --- a/src/arm64/builtins-arm64.cc +++ b/src/arm64/builtins-arm64.cc @@ -835,8 +835,7 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, CallConstructStub stub(masm->isolate(), NO_CALL_CONSTRUCTOR_FLAGS); __ CallStub(&stub); } else { - ParameterCount actual(x0); - __ InvokeFunction(function, actual, CALL_FUNCTION, NullCallWrapper()); + __ Call(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); } // Exit the JS internal frame and remove the parameters (except function), // and return. diff --git a/src/code-stubs.cc b/src/code-stubs.cc index e9fddf9bf..3e1b54835 100644 --- a/src/code-stubs.cc +++ b/src/code-stubs.cc @@ -489,8 +489,8 @@ Handle TurboFanCodeStub::GenerateCode() { Handle call_conv = factory->InternalizeUtf8String(name); Handle minor_key = factory->NewNumber(MinorKey()); Handle args[] = {call_conv, minor_key}; - MaybeHandle result = Execution::Call( - isolate(), outer, factory->undefined_value(), 2, args, false); + MaybeHandle result = + Execution::Call(isolate(), outer, factory->undefined_value(), 2, args); Handle inner = Handle::cast(result.ToHandleChecked()); // Just to make sure nobody calls this... inner->set_code(isolate()->builtins()->builtin(Builtins::kIllegal)); diff --git a/src/execution.cc b/src/execution.cc index 2496439ca..ea1190efc 100644 --- a/src/execution.cc +++ b/src/execution.cc @@ -53,20 +53,35 @@ static void PrintDeserializedCodeInfo(Handle function) { } -MUST_USE_RESULT static MaybeHandle Invoke( - bool is_construct, - Handle function, - Handle receiver, - int argc, - Handle args[]) { - Isolate* isolate = function->GetIsolate(); +namespace { + +MUST_USE_RESULT MaybeHandle Invoke(bool is_construct, + Handle function, + Handle receiver, int argc, + Handle args[]) { + Isolate* const isolate = function->GetIsolate(); + + // Convert calls on global objects to be calls on the global + // receiver instead to avoid having a 'this' pointer which refers + // directly to a global object. + if (receiver->IsGlobalObject()) { + receiver = + handle(Handle::cast(receiver)->global_proxy(), isolate); + } // api callbacks can be called directly. if (!is_construct && function->shared()->IsApiFunction()) { SaveContext save(isolate); isolate->set_context(function->context()); - if (receiver->IsGlobalObject()) { - receiver = handle(Handle::cast(receiver)->global_proxy()); + // Do proper receiver conversion for non-strict mode api functions. + if (!receiver->IsJSReceiver() && + is_sloppy(function->shared()->language_mode())) { + if (receiver->IsUndefined() || receiver->IsNull()) { + receiver = handle(function->global_proxy(), isolate); + } else { + ASSIGN_RETURN_ON_EXCEPTION( + isolate, receiver, Execution::ToObject(isolate, receiver), Object); + } } DCHECK(function->context()->global_object()->IsGlobalObject()); auto value = Builtins::InvokeApiFunction(function, receiver, argc, args); @@ -103,13 +118,6 @@ MUST_USE_RESULT static MaybeHandle Invoke( ? isolate->factory()->js_construct_entry_code() : isolate->factory()->js_entry_code(); - // Convert calls on global objects to be calls on the global - // receiver instead to avoid having a 'this' pointer which refers - // directly to a global object. - if (receiver->IsGlobalObject()) { - receiver = handle(Handle::cast(receiver)->global_proxy()); - } - // Make sure that the global object of the context we're about to // make the current one is indeed a global object. DCHECK(function->context()->global_object()->IsGlobalObject()); @@ -122,13 +130,12 @@ MUST_USE_RESULT static MaybeHandle Invoke( JSEntryFunction stub_entry = FUNCTION_CAST(code->entry()); // Call the function through the right JS entry stub. - byte* function_entry = function->code()->entry(); + byte* ignored = nullptr; // TODO(bmeurer): Remove this altogether. JSFunction* func = *function; Object* recv = *receiver; Object*** argv = reinterpret_cast(args); if (FLAG_profile_deserialization) PrintDeserializedCodeInfo(function); - value = - CALL_GENERATED_CODE(stub_entry, function_entry, func, recv, argc, argv); + value = CALL_GENERATED_CODE(stub_entry, ignored, func, recv, argc, argv); } #ifdef VERIFY_HEAP @@ -154,31 +161,18 @@ MUST_USE_RESULT static MaybeHandle Invoke( return Handle(value, isolate); } +} // namespace -MaybeHandle Execution::Call(Isolate* isolate, - Handle callable, - Handle receiver, - int argc, - Handle argv[], - bool convert_receiver) { + +MaybeHandle Execution::Call(Isolate* isolate, Handle callable, + Handle receiver, int argc, + Handle argv[]) { if (!callable->IsJSFunction()) { ASSIGN_RETURN_ON_EXCEPTION(isolate, callable, GetFunctionDelegate(isolate, callable), Object); } Handle func = Handle::cast(callable); - // In sloppy mode, convert receiver. - if (convert_receiver && !receiver->IsJSReceiver() && - !func->shared()->native() && is_sloppy(func->shared()->language_mode())) { - if (receiver->IsUndefined() || receiver->IsNull()) { - receiver = handle(func->global_proxy()); - DCHECK(!receiver->IsJSBuiltinsObject()); - } else { - ASSIGN_RETURN_ON_EXCEPTION( - isolate, receiver, ToObject(isolate, receiver), Object); - } - } - return Invoke(false, func, receiver, argc, argv); } @@ -207,7 +201,7 @@ MaybeHandle Execution::TryCall(Handle func, catcher.SetVerbose(false); catcher.SetCaptureMessage(false); - maybe_result = Invoke(false, func, receiver, argc, args); + maybe_result = Call(isolate, func, receiver, argc, args); if (maybe_result.is_null()) { DCHECK(catcher.HasCaught()); diff --git a/src/execution.h b/src/execution.h index 75f7a8ebc..51fe3d32c 100644 --- a/src/execution.h +++ b/src/execution.h @@ -19,23 +19,16 @@ class JSRegExp; class Execution final : public AllStatic { public: // Call a function, the caller supplies a receiver and an array - // of arguments. Arguments are Object* type. After function returns, - // pointers in 'args' might be invalid. - // - // *pending_exception tells whether the invoke resulted in - // a pending exception. + // of arguments. // - // When convert_receiver is set, and the receiver is not an object, - // and the function called is not in strict mode, receiver is converted to - // an object. + // When the function called is not in strict mode, receiver is + // converted to an object. // - MUST_USE_RESULT static MaybeHandle Call( - Isolate* isolate, - Handle callable, - Handle receiver, - int argc, - Handle argv[], - bool convert_receiver = false); + MUST_USE_RESULT static MaybeHandle Call(Isolate* isolate, + Handle callable, + Handle receiver, + int argc, + Handle argv[]); // Construct object from function, the caller supplies an array of // arguments. Arguments are Object* type. After function returns, diff --git a/src/ia32/builtins-ia32.cc b/src/ia32/builtins-ia32.cc index 433c98085..e2055629d 100644 --- a/src/ia32/builtins-ia32.cc +++ b/src/ia32/builtins-ia32.cc @@ -534,9 +534,7 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, CallConstructStub stub(masm->isolate(), NO_CALL_CONSTRUCTOR_FLAGS); __ CallStub(&stub); } else { - ParameterCount actual(eax); - __ InvokeFunction(edi, actual, CALL_FUNCTION, - NullCallWrapper()); + __ Call(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); } // Exit the internal frame. Notice that this also removes the empty. diff --git a/src/mips/builtins-mips.cc b/src/mips/builtins-mips.cc index c78149fc9..8c01d9741 100644 --- a/src/mips/builtins-mips.cc +++ b/src/mips/builtins-mips.cc @@ -796,8 +796,7 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, CallConstructStub stub(masm->isolate(), NO_CALL_CONSTRUCTOR_FLAGS); __ CallStub(&stub); } else { - ParameterCount actual(a0); - __ InvokeFunction(a1, actual, CALL_FUNCTION, NullCallWrapper()); + __ Call(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); } // Leave internal frame. diff --git a/src/mips64/builtins-mips64.cc b/src/mips64/builtins-mips64.cc index e68f0fd26..fc937f64d 100644 --- a/src/mips64/builtins-mips64.cc +++ b/src/mips64/builtins-mips64.cc @@ -794,8 +794,7 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, CallConstructStub stub(masm->isolate(), NO_CALL_CONSTRUCTOR_FLAGS); __ CallStub(&stub); } else { - ParameterCount actual(a0); - __ InvokeFunction(a1, actual, CALL_FUNCTION, NullCallWrapper()); + __ Call(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); } // Leave internal frame. diff --git a/src/objects.cc b/src/objects.cc index 28007d73f..4fa1b6849 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -841,7 +841,7 @@ MaybeHandle Object::GetPropertyWithDefinedGetter( // TODO(rossberg): should this apply to getters that are function proxies? if (debug->is_active()) debug->HandleStepIn(getter, false); - return Execution::Call(isolate, getter, receiver, 0, NULL, true); + return Execution::Call(isolate, getter, receiver, 0, NULL); } @@ -858,7 +858,7 @@ MaybeHandle Object::SetPropertyWithDefinedSetter( Handle argv[] = { value }; RETURN_ON_EXCEPTION(isolate, Execution::Call(isolate, setter, receiver, - arraysize(argv), argv, true), + arraysize(argv), argv), Object); return value; } diff --git a/src/runtime/runtime-function.cc b/src/runtime/runtime-function.cc index 6666ba402..6585b4f06 100644 --- a/src/runtime/runtime-function.cc +++ b/src/runtime/runtime-function.cc @@ -522,7 +522,7 @@ RUNTIME_FUNCTION(Runtime_Call) { Handle result; ASSIGN_RETURN_FAILURE_ON_EXCEPTION( isolate, result, - Execution::Call(isolate, target, receiver, argc, argv.start(), true)); + Execution::Call(isolate, target, receiver, argc, argv.start())); return *result; } @@ -559,8 +559,7 @@ RUNTIME_FUNCTION(Runtime_Apply) { Handle result; ASSIGN_RETURN_FAILURE_ON_EXCEPTION( - isolate, result, - Execution::Call(isolate, fun, receiver, argc, argv, true)); + isolate, result, Execution::Call(isolate, fun, receiver, argc, argv)); return *result; } @@ -627,8 +626,7 @@ RUNTIME_FUNCTION(Runtime_CallFunction) { Handle hreceiver(receiver, isolate); Handle result; ASSIGN_RETURN_FAILURE_ON_EXCEPTION( - isolate, result, - Execution::Call(isolate, hfun, hreceiver, argc, argv, true)); + isolate, result, Execution::Call(isolate, hfun, hreceiver, argc, argv)); return *result; } diff --git a/src/x64/builtins-x64.cc b/src/x64/builtins-x64.cc index f04316c3b..91db4c61f 100644 --- a/src/x64/builtins-x64.cc +++ b/src/x64/builtins-x64.cc @@ -593,9 +593,7 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, CallConstructStub stub(masm->isolate(), NO_CALL_CONSTRUCTOR_FLAGS); __ CallStub(&stub); } else { - ParameterCount actual(rax); - // Function must be in rdi. - __ InvokeFunction(rdi, actual, CALL_FUNCTION, NullCallWrapper()); + __ Call(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); } // Exit the internal frame. Notice that this also removes the empty // context and the function left on the stack by the code diff --git a/test/cctest/compiler/function-tester.h b/test/cctest/compiler/function-tester.h index 56ab514c6..1a1730e36 100644 --- a/test/cctest/compiler/function-tester.h +++ b/test/cctest/compiler/function-tester.h @@ -51,13 +51,13 @@ class FunctionTester : public InitializedHandleScope { MaybeHandle Call(Handle a, Handle b) { Handle args[] = {a, b}; - return Execution::Call(isolate, function, undefined(), 2, args, false); + return Execution::Call(isolate, function, undefined(), 2, args); } MaybeHandle Call(Handle a, Handle b, Handle c, Handle d) { Handle args[] = {a, b, c, d}; - return Execution::Call(isolate, function, undefined(), 4, args, false); + return Execution::Call(isolate, function, undefined(), 4, args); } void CheckThrows(Handle a, Handle b) { diff --git a/test/cctest/compiler/test-run-bytecode-graph-builder.cc b/test/cctest/compiler/test-run-bytecode-graph-builder.cc index c64a9346f..06cb2f754 100644 --- a/test/cctest/compiler/test-run-bytecode-graph-builder.cc +++ b/test/cctest/compiler/test-run-bytecode-graph-builder.cc @@ -25,8 +25,7 @@ static const char kFunctionName[] = "f"; static MaybeHandle CallFunction(Isolate* isolate, Handle function) { return Execution::Call(isolate, function, - isolate->factory()->undefined_value(), 0, nullptr, - false); + isolate->factory()->undefined_value(), 0, nullptr); } @@ -37,7 +36,7 @@ static MaybeHandle CallFunction(Isolate* isolate, Handle argv[] = {args...}; return Execution::Call(isolate, function, isolate->factory()->undefined_value(), sizeof...(args), - argv, false); + argv); } diff --git a/test/cctest/compiler/test-simplified-lowering.cc b/test/cctest/compiler/test-simplified-lowering.cc index 8c6c5fd9a..07f51533f 100644 --- a/test/cctest/compiler/test-simplified-lowering.cc +++ b/test/cctest/compiler/test-simplified-lowering.cc @@ -82,7 +82,7 @@ class SimplifiedLoweringTester : public GraphBuilderTester { Handle fun = FunctionTester::ForMachineGraph(this->graph()); Handle* args = NULL; MaybeHandle result = Execution::Call( - this->isolate(), fun, factory()->undefined_value(), 0, args, false); + this->isolate(), fun, factory()->undefined_value(), 0, args); return T::cast(*result.ToHandleChecked()); } diff --git a/test/cctest/interpreter/test-interpreter.cc b/test/cctest/interpreter/test-interpreter.cc index ca4ddb40c..b4a2eb3b9 100644 --- a/test/cctest/interpreter/test-interpreter.cc +++ b/test/cctest/interpreter/test-interpreter.cc @@ -18,8 +18,7 @@ namespace interpreter { static MaybeHandle CallInterpreter(Isolate* isolate, Handle function) { return Execution::Call(isolate, function, - isolate->factory()->undefined_value(), 0, nullptr, - false); + isolate->factory()->undefined_value(), 0, nullptr); } @@ -30,7 +29,7 @@ static MaybeHandle CallInterpreter(Isolate* isolate, Handle argv[] = { args... }; return Execution::Call(isolate, function, isolate->factory()->undefined_value(), sizeof...(args), - argv, false); + argv); } -- 2.34.1