Index: src/ppc/builtins-ppc.cc |
diff --git a/src/ppc/builtins-ppc.cc b/src/ppc/builtins-ppc.cc |
index 98b73ed941f5b1ed7dea372d8f8502f879cdd780..b50add6c2958647274b013773519267c80ff327c 100644 |
--- a/src/ppc/builtins-ppc.cc |
+++ b/src/ppc/builtins-ppc.cc |
@@ -968,6 +968,20 @@ void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { |
Generate_JSEntryTrampolineHelper(masm, true); |
} |
+static void LeaveInterpreterFrame(MacroAssembler* masm, Register scratch) { |
+ Register args_count = scratch; |
+ |
+ // Get the arguments + receiver count. |
+ __ LoadP(args_count, |
+ MemOperand(fp, InterpreterFrameConstants::kBytecodeArrayFromFp)); |
+ __ lwz(args_count, |
+ FieldMemOperand(args_count, BytecodeArray::kParameterSizeOffset)); |
+ |
+ // Leave the frame (also dropping the register file). |
+ __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
+ |
+ __ add(sp, sp, args_count); |
+} |
// Generate code for entering a JS function with the interpreter. |
// On entry to the function the receiver and arguments have been pushed on the |
@@ -1077,15 +1091,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { |
masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset()); |
// The return value is in r3. |
- |
- // Get the arguments + reciever count. |
- __ LoadP(r5, MemOperand(fp, InterpreterFrameConstants::kBytecodeArrayFromFp)); |
- __ lwz(r5, FieldMemOperand(r5, BytecodeArray::kParameterSizeOffset)); |
- |
- // Leave the frame (also dropping the register file). |
- __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
- |
- __ add(sp, sp, r5); |
+ LeaveInterpreterFrame(masm, r5); |
__ blr(); |
// If the bytecode array is no longer present, then the underlying function |
@@ -1101,6 +1107,30 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { |
__ JumpToJSEntry(r7); |
} |
+void Builtins::Generate_InterpreterMarkBaselineOnReturn(MacroAssembler* masm) { |
+ // Save the function and context for call to CompileBaseline. |
+ __ LoadP(r4, MemOperand(fp, StandardFrameConstants::kFunctionOffset)); |
+ __ LoadP(kContextRegister, |
+ MemOperand(fp, StandardFrameConstants::kContextOffset)); |
+ |
+ // Leave the frame before recompiling for baseline so that we don't count as |
+ // an activation on the stack. |
+ LeaveInterpreterFrame(masm, r5); |
+ |
+ { |
+ FrameScope frame_scope(masm, StackFrame::INTERNAL); |
+ // Push return value. |
+ __ push(r3); |
+ |
+ // Push function as argument and compile for baseline. |
+ __ push(r4); |
+ __ CallRuntime(Runtime::kCompileBaseline); |
+ |
+ // Restore return value. |
+ __ pop(r3); |
+ } |
+ __ blr(); |
+} |
static void Generate_InterpreterPushArgs(MacroAssembler* masm, Register index, |
Register count, Register scratch) { |