| Index: src/x64/code-stubs-x64.cc
|
| diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc
|
| index b8e783d3c2b498186444de10f7379a6612a66a22..920843dfe3f77560dd7ac3fa5cab6a03f4877e97 100644
|
| --- a/src/x64/code-stubs-x64.cc
|
| +++ b/src/x64/code-stubs-x64.cc
|
| @@ -2350,46 +2350,29 @@ void CallFunctionStub::Generate(MacroAssembler* masm) {
|
| Label slow, non_function;
|
| StackArgumentsAccessor args(rsp, argc_);
|
|
|
| - // Check that the function really is a JavaScript function.
|
| - __ JumpIfSmi(rdi, &non_function);
|
| -
|
| // The receiver might implicitly be the global object. This is
|
| // indicated by passing the hole as the receiver to the call
|
| // function stub.
|
| - if (ReceiverMightBeImplicit() || ReceiverIsImplicit()) {
|
| - Label try_call, call, patch_current_context;
|
| - if (ReceiverMightBeImplicit()) {
|
| - // Get the receiver from the stack.
|
| - __ movq(rax, args.GetReceiverOperand());
|
| - // Call as function is indicated with the hole.
|
| - __ CompareRoot(rax, Heap::kTheHoleValueRootIndex);
|
| - __ j(not_equal, &try_call, Label::kNear);
|
| - }
|
| + if (ReceiverMightBeImplicit()) {
|
| + Label call;
|
| + // Get the receiver from the stack.
|
| + __ movq(rax, args.GetReceiverOperand());
|
| + // Call as function is indicated with the hole.
|
| + __ CompareRoot(rax, Heap::kTheHoleValueRootIndex);
|
| + __ j(not_equal, &call, Label::kNear);
|
| // Patch the receiver on the stack with the global receiver object.
|
| - // Goto slow case if we do not have a function.
|
| - __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx);
|
| - __ j(not_equal, &patch_current_context);
|
| - CallStubCompiler::FetchGlobalProxy(masm, rcx, rdi);
|
| + __ movq(rcx, GlobalObjectOperand());
|
| + __ movq(rcx, FieldOperand(rcx, GlobalObject::kGlobalReceiverOffset));
|
| __ movq(args.GetReceiverOperand(), rcx);
|
| - __ jmp(&call, Label::kNear);
|
| -
|
| - __ bind(&patch_current_context);
|
| - __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex);
|
| - __ movq(args.GetReceiverOperand(), kScratchRegister);
|
| - __ jmp(&slow);
|
| -
|
| - __ bind(&try_call);
|
| - // Goto slow case if we do not have a function.
|
| - __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx);
|
| - __ j(not_equal, &slow);
|
| -
|
| __ bind(&call);
|
| - } else {
|
| - // Goto slow case if we do not have a function.
|
| - __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx);
|
| - __ j(not_equal, &slow);
|
| }
|
|
|
| + // Check that the function really is a JavaScript function.
|
| + __ JumpIfSmi(rdi, &non_function);
|
| + // Goto slow case if we do not have a function.
|
| + __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx);
|
| + __ j(not_equal, &slow);
|
| +
|
| if (RecordCallTarget()) {
|
| GenerateRecordCallTarget(masm);
|
| }
|
| @@ -2431,7 +2414,7 @@ void CallFunctionStub::Generate(MacroAssembler* masm) {
|
| __ PushReturnAddressFrom(rcx);
|
| __ Set(rax, argc_ + 1);
|
| __ Set(rbx, 0);
|
| - __ SetCallKind(rcx, CALL_AS_FUNCTION);
|
| + __ SetCallKind(rcx, CALL_AS_METHOD);
|
| __ GetBuiltinEntry(rdx, Builtins::CALL_FUNCTION_PROXY);
|
| {
|
| Handle<Code> adaptor =
|
|
|