Index: src/x87/code-stubs-x87.cc |
diff --git a/src/x87/code-stubs-x87.cc b/src/x87/code-stubs-x87.cc |
index 7be548fa25fc625f8023cb7822aaf78497f0067a..bcbf0d0013f00aa96a11ef05a2a3994bf78be934 100644 |
--- a/src/x87/code-stubs-x87.cc |
+++ b/src/x87/code-stubs-x87.cc |
@@ -3303,6 +3303,7 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) { |
// -- ... |
// -- esp[argc * 4] : first argument |
// -- esp[(argc + 1) * 4] : receiver |
+ // -- esp[(argc + 2) * 4] : accessor_holder |
// ----------------------------------- |
Register callee = edi; |
@@ -3355,16 +3356,25 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) { |
// holder |
__ push(holder); |
+ // enter a new context |
+ if (is_lazy()) { |
+ // load context from accessor_holder |
+ Register accessor_holder = context; |
+ __ movp(accessor_holder, |
+ MemOperand(esp, (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 |
+ __ mov(context, FieldOperand(callee, JSFunction::kContextOffset)); |
+ } |
+ |
__ mov(scratch, esp); |
// push return address |
__ push(return_address); |
- if (!is_lazy()) { |
- // load context from callee |
- __ mov(context, FieldOperand(callee, JSFunction::kContextOffset)); |
- } |
- |
// API function gets reference to the v8::Arguments. If CPU profiler |
// is enabled wrapper function will be called and we need to pass |
// address of the callback as additional parameter, always allocate |