Index: src/ppc/builtins-ppc.cc |
diff --git a/src/ppc/builtins-ppc.cc b/src/ppc/builtins-ppc.cc |
index e5ef3188413605a7495ebbb4f6c5e5d5b01a1816..5817e8cb2ed296651f5ba12d6a65ad5c0cc4be6d 100644 |
--- a/src/ppc/builtins-ppc.cc |
+++ b/src/ppc/builtins-ppc.cc |
@@ -931,6 +931,90 @@ void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
} |
+static void Generate_InterpreterNotifyDeoptimizedHelper( |
+ MacroAssembler* masm, Deoptimizer::BailoutType type) { |
+ // Enter an internal frame. |
+ { |
+ FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
+ // Save accumulator register and pass the deoptimization type to |
+ // the runtime system. |
+ __ LoadSmiLiteral(r4, Smi::FromInt(static_cast<int>(type))); |
+ __ Push(kInterpreterAccumulatorRegister, r4); |
+ __ CallRuntime(Runtime::kNotifyDeoptimized, 1); |
+ __ pop(kInterpreterAccumulatorRegister); // Restore accumulator register. |
+ // Tear down internal frame. |
+ } |
+ |
+ // Drop state (we don't use these for interpreter deopts) and push PC at top |
+ // of stack (to simulate initial call to bytecode handler in interpreter entry |
+ // trampoline). |
+ __ pop(r4); |
+ __ StoreP(r4, MemOperand(sp, 0)); |
+ |
+ // Initialize register file register and dispatch table register. |
+ __ addi(kInterpreterRegisterFileRegister, fp, |
+ Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); |
+ __ LoadRoot(kInterpreterDispatchTableRegister, |
+ Heap::kInterpreterTableRootIndex); |
+ __ addi(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister, |
+ Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
+ |
+ // Get the context from the frame. |
+ // TODO(rmcilroy): Update interpreter frame to expect current context at the |
+ // context slot instead of the function context. |
+ __ LoadP(kContextRegister, |
+ MemOperand(kInterpreterRegisterFileRegister, |
+ InterpreterFrameConstants::kContextFromRegisterPointer)); |
+ |
+ // Get the bytecode array pointer from the frame. |
+ __ LoadP(r4, |
+ MemOperand(kInterpreterRegisterFileRegister, |
+ InterpreterFrameConstants::kFunctionFromRegisterPointer)); |
+ __ LoadP(r4, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
+ __ LoadP(kInterpreterBytecodeArrayRegister, |
+ FieldMemOperand(r4, SharedFunctionInfo::kFunctionDataOffset)); |
+ |
+ if (FLAG_debug_code) { |
+ // Check function data field is actually a BytecodeArray object. |
+ __ TestIfSmi(kInterpreterBytecodeArrayRegister, r0); |
+ __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
+ __ CompareObjectType(kInterpreterBytecodeArrayRegister, r4, no_reg, |
+ BYTECODE_ARRAY_TYPE); |
+ __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
+ } |
+ |
+ // Get the target bytecode offset from the frame. |
+ __ LoadP(kInterpreterBytecodeOffsetRegister, |
+ MemOperand( |
+ kInterpreterRegisterFileRegister, |
+ InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer)); |
+ __ SmiUntag(kInterpreterBytecodeOffsetRegister); |
+ |
+ // Dispatch to the target bytecode. |
+ __ lbzx(r4, MemOperand(kInterpreterBytecodeArrayRegister, |
+ kInterpreterBytecodeOffsetRegister)); |
+ __ ShiftLeftImm(ip, r4, Operand(kPointerSizeLog2)); |
+ __ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); |
+ __ addi(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); |
+ __ Jump(ip); |
+} |
+ |
+ |
+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_CompileLazy(MacroAssembler* masm) { |
CallRuntimePassFunction(masm, Runtime::kCompileLazy); |
GenerateTailCallToReturnedCode(masm); |