Index: src/builtins/ppc/builtins-ppc.cc |
diff --git a/src/builtins/ppc/builtins-ppc.cc b/src/builtins/ppc/builtins-ppc.cc |
index ebea58e1438b5b0ee07acdd9fbe563c0f6f65bf9..4fbfa1fa310d4ead639d0696ba8c361e48db58ec 100644 |
--- a/src/builtins/ppc/builtins-ppc.cc |
+++ b/src/builtins/ppc/builtins-ppc.cc |
@@ -560,6 +560,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 ------------- |
// -- r3 : number of arguments |
// -- r4 : constructor function |
@@ -608,6 +609,9 @@ void Generate_JSConstructStubHelper(MacroAssembler* masm, bool is_api_function, |
__ Push(r7, r7); |
} |
+ // Deoptimizer re-enters stub code here. |
+ __ bind(&post_instantiation_deopt_entry); |
+ |
// Set up pointer to last argument. |
__ addi(r5, fp, Operand(StandardFrameConstants::kCallerSPOffset)); |
@@ -643,7 +647,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. |
@@ -708,6 +713,34 @@ void Generate_JSConstructStubHelper(MacroAssembler* masm, bool is_api_function, |
__ IncrementCounter(isolate->counters()->constructed_objects(), 1, r4, r5); |
} |
__ blr(); |
+ // 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 ------------- |
+ // -- r3 : newly allocated object |
+ // -- sp[0] : constructor function |
+ // ----------------------------------- |
+ |
+ __ pop(r4); |
+ __ Push(r3, r3); |
+ |
+ // Retrieve smi-tagged arguments count from the stack. |
+ __ LoadP(r3, MemOperand(fp, ConstructFrameConstants::kLengthOffset)); |
+ __ SmiUntag(r3); |
+ |
+ // Retrieve the new target value from the stack. This was placed into the |
+ // frame description in place of the receiver by the optimizing compiler. |
+ __ addi(r6, fp, Operand(StandardFrameConstants::kCallerSPOffset)); |
+ __ ShiftLeftImm(ip, r3, Operand(kPointerSizeLog2)); |
+ __ LoadPX(r6, MemOperand(r6, ip)); |
+ |
+ // Continue with constructor function invocation. |
+ __ b(&post_instantiation_deopt_entry); |
+ } |
} |
} // namespace |