Index: src/mips64/builtins-mips64.cc |
diff --git a/src/mips64/builtins-mips64.cc b/src/mips64/builtins-mips64.cc |
index cf67e9f4e0a6683984de6689c33a4b70bb64bf23..4cd9a388916ee6f41317d6b999f71d3c9ebcbe4b 100644 |
--- a/src/mips64/builtins-mips64.cc |
+++ b/src/mips64/builtins-mips64.cc |
@@ -940,6 +940,7 @@ |
Generate_JSEntryTrampolineHelper(masm, true); |
} |
+ |
// 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 |
@@ -1039,20 +1040,9 @@ |
__ Dlsa(at, kInterpreterDispatchTableRegister, a0, kPointerSizeLog2); |
__ ld(at, MemOperand(at)); |
__ Call(at); |
- masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset()); |
- |
- // The return value is in v0. |
- |
- // Get the arguments + reciever count. |
- __ ld(t0, MemOperand(fp, InterpreterFrameConstants::kBytecodeArrayFromFp)); |
- __ lw(t0, FieldMemOperand(t0, BytecodeArray::kParameterSizeOffset)); |
- |
- // Leave the frame (also dropping the register file). |
- __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
- |
- // Drop receiver + arguments and return. |
- __ Daddu(sp, sp, t0); |
- __ Jump(ra); |
+ |
+ // Even though the first bytecode handler was called, we will never return. |
+ __ Abort(kUnexpectedReturnFromBytecodeHandler); |
// Load debug copy of the bytecode array. |
__ bind(&load_debug_bytecode_array); |
@@ -1073,6 +1063,21 @@ |
__ Jump(a4); |
} |
+ |
+void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { |
+ // The return value is in accumulator, which is already in v0. |
+ |
+ // Leave the frame (also dropping the register file). |
+ __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
+ |
+ // Drop receiver + arguments and return. |
+ __ lw(at, FieldMemOperand(kInterpreterBytecodeArrayRegister, |
+ BytecodeArray::kParameterSizeOffset)); |
+ __ Daddu(sp, sp, at); |
+ __ Jump(ra); |
+} |
+ |
+ |
// static |
void Builtins::Generate_InterpreterPushArgsAndCallImpl( |
MacroAssembler* masm, TailCallMode tail_call_mode) { |
@@ -1105,6 +1110,7 @@ |
RelocInfo::CODE_TARGET); |
} |
+ |
// static |
void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
// ----------- S t a t e ------------- |
@@ -1135,16 +1141,8 @@ |
__ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
} |
-void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { |
- // Set the return address to the correct point in the interpreter entry |
- // trampoline. |
- Smi* interpreter_entry_return_pc_offset( |
- masm->isolate()->heap()->interpreter_entry_return_pc_offset()); |
- DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); |
- __ li(t0, Operand(masm->isolate()->builtins()->InterpreterEntryTrampoline())); |
- __ Daddu(ra, t0, Operand(interpreter_entry_return_pc_offset->value() + |
- Code::kHeaderSize - kHeapObjectTag)); |
- |
+ |
+static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { |
// Initialize the dispatch table register. |
__ li(kInterpreterDispatchTableRegister, |
Operand(ExternalReference::interpreter_dispatch_table_address( |
@@ -1177,6 +1175,55 @@ |
__ ld(a1, MemOperand(a1)); |
__ Jump(a1); |
} |
+ |
+ |
+static void Generate_InterpreterNotifyDeoptimizedHelper( |
+ MacroAssembler* masm, Deoptimizer::BailoutType type) { |
+ // Enter an internal frame. |
+ { |
+ FrameScope scope(masm, StackFrame::INTERNAL); |
+ |
+ // Pass the deoptimization type to the runtime system. |
+ __ li(a1, Operand(Smi::FromInt(static_cast<int>(type)))); |
+ __ push(a1); |
+ __ CallRuntime(Runtime::kNotifyDeoptimized); |
+ // Tear down internal frame. |
+ } |
+ |
+ // Drop state (we don't use these for interpreter deopts) and and pop the |
+ // accumulator value into the accumulator register. |
+ __ Drop(1); |
+ __ Pop(kInterpreterAccumulatorRegister); |
+ |
+ // Enter the bytecode dispatch. |
+ Generate_EnterBytecodeDispatch(masm); |
+} |
+ |
+ |
+void Builtins::Generate_InterpreterNotifyDeoptimized(MacroAssembler* masm) { |
+ Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); |
+} |
+ |
+ |
+void Builtins::Generate_InterpreterNotifySoftDeoptimized(MacroAssembler* masm) { |
+ Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); |
+} |
+ |
+ |
+void Builtins::Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm) { |
+ Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); |
+} |
+ |
+void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { |
+ // Set the address of the interpreter entry trampoline as a return address. |
+ // This simulates the initial call to bytecode handlers in interpreter entry |
+ // trampoline. The return will never actually be taken, but our stack walker |
+ // uses this address to determine whether a frame is interpreted. |
+ __ li(ra, Operand(masm->isolate()->builtins()->InterpreterEntryTrampoline())); |
+ |
+ Generate_EnterBytecodeDispatch(masm); |
+} |
+ |
void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
// ----------- S t a t e ------------- |
@@ -1474,17 +1521,15 @@ |
__ SmiUntag(a6); |
// Switch on the state. |
Label with_tos_register, unknown_state; |
- __ Branch(&with_tos_register, ne, a6, |
- Operand(static_cast<int>(Deoptimizer::BailoutState::NO_REGISTERS))); |
+ __ Branch(&with_tos_register, |
+ ne, a6, Operand(FullCodeGenerator::NO_REGISTERS)); |
__ Ret(USE_DELAY_SLOT); |
// Safe to fill delay slot Addu will emit one instruction. |
__ Daddu(sp, sp, Operand(1 * kPointerSize)); // Remove state. |
__ bind(&with_tos_register); |
- DCHECK_EQ(kInterpreterAccumulatorRegister.code(), v0.code()); |
__ ld(v0, MemOperand(sp, 1 * kPointerSize)); |
- __ Branch(&unknown_state, ne, t2, |
- Operand(static_cast<int>(Deoptimizer::BailoutState::TOS_REGISTER))); |
+ __ Branch(&unknown_state, ne, a6, Operand(FullCodeGenerator::TOS_REG)); |
__ Ret(USE_DELAY_SLOT); |
// Safe to fill delay slot Addu will emit one instruction. |