Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Unified Diff: src/ppc/builtins-ppc.cc

Issue 1989983002: PPC/S390: [Interpreter] Remove InterpreterExitTrampoline and replace with returning to the entry tr… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/full-codegen/s390/full-codegen-s390.cc ('k') | src/s390/builtins-s390.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ppc/builtins-ppc.cc
diff --git a/src/ppc/builtins-ppc.cc b/src/ppc/builtins-ppc.cc
index 0f251f21e46a37f0ffe402bca82ea2d0ee7f5593..98b73ed941f5b1ed7dea372d8f8502f879cdd780 100644
--- a/src/ppc/builtins-ppc.cc
+++ b/src/ppc/builtins-ppc.cc
@@ -1074,8 +1074,19 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip));
__ Call(ip);
- // Even though the first bytecode handler was called, we will never return.
- __ Abort(kUnexpectedReturnFromBytecodeHandler);
+ 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);
+ __ blr();
// If the bytecode array is no longer present, then the underlying function
// has been switched to a different kind of code and we heal the closure by
@@ -1091,20 +1102,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
}
-void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) {
- // The return value is in accumulator, which is already in r3.
-
- // Leave the frame (also dropping the register file).
- __ LeaveFrame(StackFrame::JAVA_SCRIPT);
-
- // Drop receiver + arguments and return.
- __ lwz(r0, FieldMemOperand(kInterpreterBytecodeArrayRegister,
- BytecodeArray::kParameterSizeOffset));
- __ add(sp, sp, r0);
- __ blr();
-}
-
-
static void Generate_InterpreterPushArgs(MacroAssembler* masm, Register index,
Register count, Register scratch) {
Label loop;
@@ -1116,7 +1113,6 @@ static void Generate_InterpreterPushArgs(MacroAssembler* masm, Register index,
__ bdnz(&loop);
}
-
// static
void Builtins::Generate_InterpreterPushArgsAndCallImpl(
MacroAssembler* masm, TailCallMode tail_call_mode) {
@@ -1140,7 +1136,6 @@ void Builtins::Generate_InterpreterPushArgsAndCallImpl(
RelocInfo::CODE_TARGET);
}
-
// static
void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
// ----------- S t a t e -------------
@@ -1165,8 +1160,17 @@ 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));
+ __ Move(r5, masm->isolate()->builtins()->InterpreterEntryTrampoline());
+ __ addi(r0, r5, Operand(interpreter_entry_return_pc_offset->value() +
+ Code::kHeaderSize - kHeapObjectTag));
+ __ mtlr(r0);
-static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) {
// Initialize the dispatch table register.
__ mov(kInterpreterDispatchTableRegister,
Operand(ExternalReference::interpreter_dispatch_table_address(
@@ -1199,56 +1203,6 @@ static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) {
}
-static void Generate_InterpreterNotifyDeoptimizedHelper(
- MacroAssembler* masm, Deoptimizer::BailoutType type) {
- // Enter an internal frame.
- {
- FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
-
- // Pass the deoptimization type to the runtime system.
- __ LoadSmiLiteral(r4, Smi::FromInt(static_cast<int>(type)));
- __ Push(r4);
- __ 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.
- __ mov(r0,
- Operand(masm->isolate()->builtins()->InterpreterEntryTrampoline()));
- __ mtlr(r0);
-
- Generate_EnterBytecodeDispatch(masm);
-}
-
-
void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r3 : argument count (preserved for callee)
@@ -1541,14 +1495,17 @@ static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm,
__ SmiUntag(r9);
// Switch on the state.
Label with_tos_register, unknown_state;
- __ cmpi(r9, Operand(FullCodeGenerator::NO_REGISTERS));
+ __ cmpi(r9,
+ Operand(static_cast<int>(Deoptimizer::BailoutState::NO_REGISTERS)));
__ bne(&with_tos_register);
__ addi(sp, sp, Operand(1 * kPointerSize)); // Remove state.
__ Ret();
__ bind(&with_tos_register);
+ DCHECK_EQ(kInterpreterAccumulatorRegister.code(), r3.code());
__ LoadP(r3, MemOperand(sp, 1 * kPointerSize));
- __ cmpi(r9, Operand(FullCodeGenerator::TOS_REG));
+ __ cmpi(r9,
+ Operand(static_cast<int>(Deoptimizer::BailoutState::TOS_REGISTER)));
__ bne(&unknown_state);
__ addi(sp, sp, Operand(2 * kPointerSize)); // Remove state.
__ Ret();
« no previous file with comments | « src/full-codegen/s390/full-codegen-s390.cc ('k') | src/s390/builtins-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698