Index: src/s390/code-stubs-s390.cc |
diff --git a/src/s390/code-stubs-s390.cc b/src/s390/code-stubs-s390.cc |
index 9893b12f80ebaed11d467e71003cda92f2978bc1..dc4f901c1581c8e7cbe044e64614cedb3e4f0e20 100644 |
--- a/src/s390/code-stubs-s390.cc |
+++ b/src/s390/code-stubs-s390.cc |
@@ -2838,8 +2838,9 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) { |
// -- |
// -- sp[0] : last argument |
// -- ... |
- // -- sp[(argc - 1)* 4] : first argument |
+ // -- sp[(argc - 1) * 4] : first argument |
// -- sp[argc * 4] : receiver |
+ // -- sp[(argc + 1) * 4] : accessor_holder |
// ----------------------------------- |
Register callee = r2; |
@@ -2865,10 +2866,6 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) { |
// context save |
__ push(context); |
- if (!is_lazy()) { |
- // load context from callee |
- __ LoadP(context, FieldMemOperand(callee, JSFunction::kContextOffset)); |
- } |
// callee |
__ push(callee); |
@@ -2876,7 +2873,20 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) { |
// call data |
__ push(call_data); |
+ // Enter a new context |
Register scratch = call_data; |
+ if (is_lazy()) { |
+ // Load context from accessor_holder |
+ Register accessor_holder = context; |
+ __ LoadP(accessor_holder, MemOperand(sp, (argc() + 1 + 4) * kPointerSize)); |
+ __ LoadP(scratch, FieldMemOperand(accessor_holder, HeapObject::kMapOffset)); |
+ __ GetMapConstructor(scratch, scratch, context, callee); |
+ __ LoadP(context, FieldMemOperand(scratch, JSFunction::kContextOffset)); |
+ } else { |
+ // Load context from callee |
+ __ LoadP(context, FieldMemOperand(callee, JSFunction::kContextOffset)); |
+ } |
+ |
__ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); |
// return value |
__ push(scratch); |