Index: src/ia32/builtins-ia32.cc |
diff --git a/src/ia32/builtins-ia32.cc b/src/ia32/builtins-ia32.cc |
index a9759a2df96a54705eb7ced005a6f3cdc8ed96ca..745a470375361a9cc512a3da66b1b9180c52ed64 100644 |
--- a/src/ia32/builtins-ia32.cc |
+++ b/src/ia32/builtins-ia32.cc |
@@ -620,9 +620,22 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { |
__ mov(ebx, Operand(kInterpreterDispatchTableRegister, ebx, |
times_pointer_size, 0)); |
__ call(ebx); |
+ masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset()); |
- // Even though the first bytecode handler was called, we will never return. |
- __ Abort(kUnexpectedReturnFromBytecodeHandler); |
+ // The return value is in eax. |
+ |
+ // Get the arguments + reciever count. |
+ __ mov(ebx, Operand(ebp, InterpreterFrameConstants::kBytecodeArrayFromFp)); |
+ __ mov(ebx, FieldOperand(ebx, BytecodeArray::kParameterSizeOffset)); |
+ |
+ // Leave the frame (also dropping the register file). |
+ __ leave(); |
+ |
+ // Drop receiver + arguments and return. |
+ __ pop(ecx); |
+ __ add(esp, ebx); |
+ __ push(ecx); |
+ __ ret(0); |
// Load debug copy of the bytecode array. |
__ bind(&load_debug_bytecode_array); |
@@ -648,23 +661,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { |
__ jmp(ecx); |
} |
- |
-void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { |
- // The return value is in accumulator, which is already in eax. |
- |
- // Leave the frame (also dropping the register file). |
- __ leave(); |
- |
- // Drop receiver + arguments and return. |
- __ mov(ebx, FieldOperand(kInterpreterBytecodeArrayRegister, |
- BytecodeArray::kParameterSizeOffset)); |
- __ pop(ecx); |
- __ add(esp, ebx); |
- __ push(ecx); |
- __ ret(0); |
-} |
- |
- |
static void Generate_InterpreterPushArgs(MacroAssembler* masm, |
Register array_limit) { |
// ----------- S t a t e ------------- |
@@ -682,7 +678,6 @@ static void Generate_InterpreterPushArgs(MacroAssembler* masm, |
__ j(greater, &loop_header, Label::kNear); |
} |
- |
// static |
void Builtins::Generate_InterpreterPushArgsAndCallImpl( |
MacroAssembler* masm, TailCallMode tail_call_mode) { |
@@ -751,8 +746,18 @@ void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
__ 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)); |
+ __ LoadHeapObject(ebx, |
+ masm->isolate()->builtins()->InterpreterEntryTrampoline()); |
+ __ add(ebx, Immediate(interpreter_entry_return_pc_offset->value() + |
+ Code::kHeaderSize - kHeapObjectTag)); |
+ __ push(ebx); |
-static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { |
// Initialize the dispatch table register. |
__ mov(kInterpreterDispatchTableRegister, |
Immediate(ExternalReference::interpreter_dispatch_table_address( |
@@ -783,58 +788,6 @@ static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { |
__ jmp(ebx); |
} |
- |
-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. |
- __ Push(Smi::FromInt(static_cast<int>(type))); |
- __ 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 and push PC at top |
- // of stack (to simulate initial call to bytecode handler in interpreter entry |
- // trampoline). |
- __ Pop(ebx); |
- __ Drop(1); |
- __ Pop(kInterpreterAccumulatorRegister); |
- __ Push(ebx); |
- |
- // 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. |
- __ Push(masm->isolate()->builtins()->InterpreterEntryTrampoline()); |
- |
- Generate_EnterBytecodeDispatch(masm); |
-} |
- |
- |
void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
// ----------- S t a t e ------------- |
// -- eax : argument count (preserved for callee) |
@@ -1131,13 +1084,14 @@ static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, |
// Switch on the state. |
Label not_no_registers, not_tos_eax; |
- __ cmp(ecx, FullCodeGenerator::NO_REGISTERS); |
+ __ cmp(ecx, static_cast<int>(Deoptimizer::BailoutState::NO_REGISTERS)); |
__ j(not_equal, ¬_no_registers, Label::kNear); |
__ ret(1 * kPointerSize); // Remove state. |
__ bind(¬_no_registers); |
+ DCHECK_EQ(kInterpreterAccumulatorRegister.code(), eax.code()); |
__ mov(eax, Operand(esp, 2 * kPointerSize)); |
- __ cmp(ecx, FullCodeGenerator::TOS_REG); |
+ __ cmp(ecx, static_cast<int>(Deoptimizer::BailoutState::TOS_REGISTER)); |
__ j(not_equal, ¬_tos_eax, Label::kNear); |
__ ret(2 * kPointerSize); // Remove state, eax. |