Index: src/arm64/builtins-arm64.cc |
diff --git a/src/arm64/builtins-arm64.cc b/src/arm64/builtins-arm64.cc |
index be372e65a674e8856bcf981b0aaef97f30b00d45..67a354e35c57734793e9b1966c704fc18502dcc3 100644 |
--- a/src/arm64/builtins-arm64.cc |
+++ b/src/arm64/builtins-arm64.cc |
@@ -963,6 +963,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.W(), |
+ FieldMemOperand(args_count, BytecodeArray::kParameterSizeOffset)); |
+ |
+ // Leave the frame (also dropping the register file). |
+ __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
+ |
+ // Drop receiver + arguments. |
+ __ Drop(args_count, 1); |
+} |
+ |
// 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 |
@@ -1064,16 +1080,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { |
masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset()); |
// The return value is in x0. |
- |
- // Get the arguments + reciever count. |
- __ ldr(x1, MemOperand(fp, InterpreterFrameConstants::kBytecodeArrayFromFp)); |
- __ Ldr(w1, FieldMemOperand(x1, BytecodeArray::kParameterSizeOffset)); |
- |
- // Leave the frame (also dropping the register file). |
- __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
- |
- // Drop receiver + arguments and return. |
- __ Drop(x1, 1); |
+ LeaveInterpreterFrame(masm, x2); |
__ Ret(); |
// Load debug copy of the bytecode array. |
@@ -1095,6 +1102,31 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { |
__ Jump(x7); |
} |
+void Builtins::Generate_InterpreterMarkBaselineOnReturn(MacroAssembler* masm) { |
+ // Save the function and context for call to CompileBaseline. |
+ __ ldr(x1, 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, x2); |
+ |
+ { |
+ FrameScope frame_scope(masm, StackFrame::INTERNAL); |
+ // Push return value. |
+ __ push(x0); |
+ |
+ // Push function as argument and compile for baseline. |
+ __ push(x1); |
+ __ CallRuntime(Runtime::kCompileBaseline); |
+ |
+ // Restore return value. |
+ __ pop(x0); |
+ } |
+ __ Ret(); |
+} |
+ |
// static |
void Builtins::Generate_InterpreterPushArgsAndCallImpl( |
MacroAssembler* masm, TailCallMode tail_call_mode) { |