Index: src/mips64/code-stubs-mips64.cc |
diff --git a/src/mips64/code-stubs-mips64.cc b/src/mips64/code-stubs-mips64.cc |
index 3be78c544772d615ac0bf2378ef6b168050dd658..6cc51cb97cbbc88fbd07aa4ca44718aa0f2814c4 100644 |
--- a/src/mips64/code-stubs-mips64.cc |
+++ b/src/mips64/code-stubs-mips64.cc |
@@ -2945,8 +2945,9 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) { |
// -- |
// -- sp[0] : last argument |
// -- ... |
- // -- sp[(argc - 1)* 8] : first argument |
+ // -- sp[(argc - 1) * 8] : first argument |
// -- sp[argc * 8] : receiver |
+ // -- sp[(argc + 1) * 8] : accessor_holder |
// ----------------------------------- |
Register callee = a0; |
@@ -2972,10 +2973,6 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) { |
// Save context, callee and call data. |
__ Push(context, callee, call_data); |
- if (!is_lazy()) { |
- // Load context from callee. |
- __ Ld(context, FieldMemOperand(callee, JSFunction::kContextOffset)); |
- } |
Register scratch = call_data; |
__ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); |
@@ -2985,6 +2982,20 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) { |
// Push isolate and holder. |
__ Push(scratch, holder); |
+ // Enter a new context |
+ if (is_lazy()) { |
+ // Load context from accessor_holder |
+ Register accessor_holder = context; |
+ __ Ld(accessor_holder, |
+ MemOperand(sp, (FCA::kArgsLength + 1 + argc()) * kPointerSize)); |
+ __ Ld(scratch, FieldMemOperand(accessor_holder, HeapObject::kMapOffset)); |
+ __ GetMapConstructor(scratch, scratch, context, callee); |
+ __ Ld(context, FieldMemOperand(scratch, JSFunction::kContextOffset)); |
+ } else { |
+ // Load context from callee. |
+ __ Ld(context, FieldMemOperand(callee, JSFunction::kContextOffset)); |
+ } |
+ |
// Prepare arguments. |
__ mov(scratch, sp); |