Index: src/mips/code-stubs-mips.cc |
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc |
index 7908ff70eb39260e8861e082d9d2c48f33ad4cdb..a5edf4aeae441e71591f5cccb473925ee8b6b8ea 100644 |
--- a/src/mips/code-stubs-mips.cc |
+++ b/src/mips/code-stubs-mips.cc |
@@ -2944,6 +2944,7 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) { |
// -- ... |
// -- sp[(argc - 1)* 4] : first argument |
// -- sp[argc * 4] : receiver |
+ // -- sp[(argc + 1)* 4] : accessor_holder |
// ----------------------------------- |
Register callee = a0; |
@@ -2969,10 +2970,6 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) { |
// Save context, callee and call data. |
__ Push(context, callee, call_data); |
- if (!is_lazy()) { |
- // Load context from callee. |
- __ lw(context, FieldMemOperand(callee, JSFunction::kContextOffset)); |
- } |
Register scratch = call_data; |
__ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); |
@@ -2982,6 +2979,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; |
+ __ lw(accessor_holder, |
+ MemOperand(sp, (FCA::kArgsLength + 1 + argc()) * kPointerSize)); |
+ __ lw(scratch, FieldMemOperand(accessor_holder, HeapObject::kMapOffset)); |
+ __ GetMapConstructor(scratch, scratch, context, callee); |
+ __ lw(context, FieldMemOperand(scratch, JSFunction::kContextOffset)); |
+ } else { |
+ // Load context from callee. |
+ __ lw(context, FieldMemOperand(callee, JSFunction::kContextOffset)); |
+ } |
+ |
// Prepare arguments. |
__ mov(scratch, sp); |