| Index: src/x64/code-stubs-x64.cc
|
| diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc
|
| index 30fe1e44eb793f061e1b670345eeda27a8a16da5..ea069e276e1888e50861ee2406d09f72feed9eae 100644
|
| --- a/src/x64/code-stubs-x64.cc
|
| +++ b/src/x64/code-stubs-x64.cc
|
| @@ -2650,6 +2650,7 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
|
| // -- ...
|
| // -- rsp[argc * 8] : first argument
|
| // -- rsp[(argc + 1) * 8] : receiver
|
| + // -- rsp[(argc + 2) * 8] : accessor_holder
|
| // -----------------------------------
|
|
|
| Register callee = rdi;
|
| @@ -2696,15 +2697,25 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
|
| // holder
|
| __ Push(holder);
|
|
|
| - __ movp(scratch, rsp);
|
| - // Push return address back on stack.
|
| - __ PushReturnAddressFrom(return_address);
|
| -
|
| - if (!this->is_lazy()) {
|
| + // enter a new context
|
| + int argc = this->argc();
|
| + if (this->is_lazy()) {
|
| + // load context from accessor_holder
|
| + Register accessor_holder = context;
|
| + __ movp(accessor_holder,
|
| + MemOperand(rsp, (argc + FCA::kArgsLength + 1) * kPointerSize));
|
| + __ movp(scratch, FieldOperand(accessor_holder, HeapObject::kMapOffset));
|
| + __ GetMapConstructor(scratch, scratch, context);
|
| + __ movp(context, FieldOperand(scratch, JSFunction::kContextOffset));
|
| + } else {
|
| // load context from callee
|
| __ movp(context, FieldOperand(callee, JSFunction::kContextOffset));
|
| }
|
|
|
| + __ movp(scratch, rsp);
|
| + // Push return address back on stack.
|
| + __ PushReturnAddressFrom(return_address);
|
| +
|
| // Allocate the v8::Arguments structure in the arguments' space since
|
| // it's not controlled by GC.
|
| const int kApiStackSpace = 3;
|
| @@ -2712,7 +2723,6 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
|
| PrepareCallApiFunction(masm, kApiStackSpace);
|
|
|
| // FunctionCallbackInfo::implicit_args_.
|
| - int argc = this->argc();
|
| __ movp(StackSpaceOperand(0), scratch);
|
| __ addp(scratch, Immediate((argc + FCA::kArgsLength - 1) * kPointerSize));
|
| // FunctionCallbackInfo::values_.
|
| @@ -2743,13 +2753,10 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
|
| ARGUMENTS_DONT_CONTAIN_RECEIVER);
|
| Operand context_restore_operand = args_from_rbp.GetArgumentOperand(
|
| FCA::kArgsLength - FCA::kContextSaveIndex);
|
| - Operand length_operand = StackSpaceOperand(2);
|
| Operand return_value_operand = args_from_rbp.GetArgumentOperand(
|
| this->is_store() ? 0 : FCA::kArgsLength - FCA::kReturnValueOffset);
|
| - int stack_space = 0;
|
| - Operand* stack_space_operand = &length_operand;
|
| - stack_space = argc + FCA::kArgsLength + 1;
|
| - stack_space_operand = nullptr;
|
| + const int stack_space = argc + FCA::kArgsLength + 2;
|
| + Operand* stack_space_operand = nullptr;
|
| CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, callback_arg,
|
| stack_space, stack_space_operand,
|
| return_value_operand, &context_restore_operand);
|
|
|