Index: src/builtins/s390/builtins-s390.cc |
diff --git a/src/builtins/s390/builtins-s390.cc b/src/builtins/s390/builtins-s390.cc |
index d5002cade500ae2fdae033d544fa98f5a759d07a..87cd866a05cc164ee267606ec28e5fe89fde887d 100644 |
--- a/src/builtins/s390/builtins-s390.cc |
+++ b/src/builtins/s390/builtins-s390.cc |
@@ -556,6 +556,7 @@ namespace { |
void Generate_JSConstructStubHelper(MacroAssembler* masm, bool is_api_function, |
bool create_implicit_receiver, |
bool check_derived_construct) { |
+ Label post_instantiation_deopt_entry; |
// ----------- S t a t e ------------- |
// -- r2 : number of arguments |
// -- r3 : constructor function |
@@ -606,6 +607,9 @@ void Generate_JSConstructStubHelper(MacroAssembler* masm, bool is_api_function, |
__ Push(r6, r6); |
} |
+ // Deoptimizer re-enters stub code here. |
+ __ bind(&post_instantiation_deopt_entry); |
+ |
// Set up pointer to last argument. |
__ la(r4, MemOperand(fp, StandardFrameConstants::kCallerSPOffset)); |
@@ -641,7 +645,8 @@ void Generate_JSConstructStubHelper(MacroAssembler* masm, bool is_api_function, |
// Store offset of return address for deoptimizer. |
if (create_implicit_receiver && !is_api_function) { |
- masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); |
+ masm->isolate()->heap()->SetConstructStubInvokeDeoptPCOffset( |
+ masm->pc_offset()); |
} |
// Restore context from the frame. |
@@ -707,6 +712,35 @@ void Generate_JSConstructStubHelper(MacroAssembler* masm, bool is_api_function, |
__ IncrementCounter(isolate->counters()->constructed_objects(), 1, r3, r4); |
} |
__ Ret(); |
+ |
+ // Store offset of trampoline address for deoptimizer. This is the bailout |
+ // point after the receiver instantiation but before the function invocation. |
+ // We need to restore some registers in order to continue the above code. |
+ if (create_implicit_receiver && !is_api_function) { |
+ masm->isolate()->heap()->SetConstructStubCreateDeoptPCOffset( |
+ masm->pc_offset()); |
+ |
+ // ----------- S t a t e ------------- |
+ // -- r2 : newly allocated object |
+ // -- sp[0] : constructor function |
+ // ----------------------------------- |
+ |
+ __ pop(r3); |
+ __ Push(r2, r2); |
+ |
+ // Retrieve smi-tagged arguments count from the stack. |
+ __ LoadP(r2, MemOperand(fp, ConstructFrameConstants::kLengthOffset)); |
+ __ SmiUntag(r2); |
+ |
+ // Retrieve the new target value from the stack. This was placed into the |
+ // frame description in place of the receiver by the optimizing compiler. |
+ __ la(r5, MemOperand(fp, StandardFrameConstants::kCallerSPOffset)); |
+ __ ShiftLeftP(ip, r2, Operand(kPointerSizeLog2)); |
+ __ LoadP(r5, MemOperand(r2, ip)); |
+ |
+ // Continue with constructor function invocation. |
+ __ b(&post_instantiation_deopt_entry); |
+ } |
} |
} // namespace |