Index: src/builtins/ppc/builtins-ppc.cc |
diff --git a/src/builtins/ppc/builtins-ppc.cc b/src/builtins/ppc/builtins-ppc.cc |
index b17ca60086520816a743977f59851bf15e8930a9..81cb4a61fefae69788225a5e320462a5be0bb3b4 100644 |
--- a/src/builtins/ppc/builtins-ppc.cc |
+++ b/src/builtins/ppc/builtins-ppc.cc |
@@ -1746,9 +1746,16 @@ void Builtins::Generate_HandleFastApiCall(MacroAssembler* masm) { |
__ TailCallRuntime(Runtime::kThrowIllegalInvocation); |
} |
-void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
+static void Generate_OnStackReplacementHelper(MacroAssembler* masm, |
+ bool has_handler_frame) { |
// Lookup the function in the JavaScript frame. |
- __ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
+ if (has_handler_frame) { |
+ __ LoadP(r3, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
+ __ LoadP(r3, MemOperand(r3, JavaScriptFrameConstants::kFunctionOffset)); |
+ } else { |
+ __ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
+ } |
+ |
{ |
FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
// Pass function as argument. |
@@ -1756,7 +1763,7 @@ void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
__ CallRuntime(Runtime::kCompileForOnStackReplacement); |
} |
- // If the code object is null, just return to the unoptimized code. |
+ // If the code object is null, just return to the caller. |
Label skip; |
__ CmpSmiLiteral(r3, Smi::FromInt(0), r0); |
__ bne(&skip); |
@@ -1764,6 +1771,12 @@ void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
__ bind(&skip); |
+ // Drop any potential handler frame that is be sitting on top of the actual |
+ // JavaScript frame. This is the case then OSR is triggered from bytecode. |
+ if (has_handler_frame) { |
+ __ LeaveFrame(StackFrame::STUB); |
+ } |
+ |
// Load deoptimization data from the code object. |
// <deopt_data> = <code>[#deoptimization_data_offset] |
__ LoadP(r4, FieldMemOperand(r3, Code::kDeoptimizationDataOffset)); |
@@ -1792,6 +1805,14 @@ void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
} |
} |
+void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
+ Generate_OnStackReplacementHelper(masm, false); |
+} |
+ |
+void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
+ Generate_OnStackReplacementHelper(masm, true); |
+} |
+ |
// static |
void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, |
int field_index) { |