Index: src/ia32/code-stubs-ia32.cc |
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
index 8983d742b339cd31c738bbc51410b482a41c92b8..68c5f43eadac1b14123b5799edffa09b3c236b47 100644 |
--- a/src/ia32/code-stubs-ia32.cc |
+++ b/src/ia32/code-stubs-ia32.cc |
@@ -2748,6 +2748,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; |
@@ -2792,17 +2793,26 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) { |
// holder |
__ push(holder); |
+ // enter a new context |
Register scratch = call_data; |
+ if (is_lazy()) { |
+ // load context from accessor_holder |
+ Register accessor_holder = context; |
+ __ mov(accessor_holder, |
+ MemOperand(esp, (argc() + FCA::kArgsLength + 1) * kPointerSize)); |
+ __ mov(scratch, FieldOperand(accessor_holder, HeapObject::kMapOffset)); |
+ __ GetMapConstructor(scratch, scratch, context); |
+ __ mov(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 |