Index: src/arm/builtins-arm.cc |
diff --git a/src/arm/builtins-arm.cc b/src/arm/builtins-arm.cc |
index 031b483cca13474be4dca6f4f1e2b9645d5880ea..4d855004944e78f1ae58311f22d5f31725478812 100644 |
--- a/src/arm/builtins-arm.cc |
+++ b/src/arm/builtins-arm.cc |
@@ -959,6 +959,22 @@ 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. |
+ __ ldr(args_count, |
+ MemOperand(fp, InterpreterFrameConstants::kBytecodeArrayFromFp)); |
+ __ ldr(args_count, |
+ FieldMemOperand(args_count, BytecodeArray::kParameterSizeOffset)); |
+ |
+ // Leave the frame (also dropping the register file). |
+ __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
+ |
+ // Drop receiver + arguments. |
+ __ add(sp, sp, args_count, LeaveCC); |
+} |
+ |
// Generate code for entering a JS function with the interpreter. |
// On entry to the function the receiver and arguments have been pushed on the |
// stack left to right. The actual argument count matches the formal parameter |
@@ -1062,15 +1078,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { |
masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset()); |
// The return value is in r0. |
- |
- // Get the arguments + reciever count. |
- __ ldr(r2, MemOperand(fp, InterpreterFrameConstants::kBytecodeArrayFromFp)); |
- __ ldr(r2, FieldMemOperand(r2, BytecodeArray::kParameterSizeOffset)); |
- |
- // Leave the frame (also dropping the register file). |
- __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
- |
- __ add(sp, sp, r2, LeaveCC); |
+ LeaveInterpreterFrame(masm, r2); |
__ Jump(lr); |
// If the bytecode array is no longer present, then the underlying function |
@@ -1086,6 +1094,31 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { |
__ Jump(r4); |
} |
+void Builtins::Generate_InterpreterMarkBaselineOnReturn(MacroAssembler* masm) { |
+ // Save the function and context for call to CompileBaseline. |
+ __ ldr(r1, MemOperand(fp, StandardFrameConstants::kFunctionOffset)); |
+ __ ldr(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, r2); |
+ |
+ { |
+ FrameScope frame_scope(masm, StackFrame::INTERNAL); |
+ // Push return value. |
+ __ push(r0); |
+ |
+ // Push function as argument and compile for baseline. |
+ __ push(r1); |
+ __ CallRuntime(Runtime::kCompileBaseline); |
+ |
+ // Restore return value. |
+ __ pop(r0); |
+ } |
+ __ Jump(lr); |
+} |
+ |
static void Generate_InterpreterPushArgs(MacroAssembler* masm, Register index, |
Register limit, Register scratch) { |
Label loop_header, loop_check; |