Index: src/builtins/mips/builtins-mips.cc |
diff --git a/src/builtins/mips/builtins-mips.cc b/src/builtins/mips/builtins-mips.cc |
index 24fe271cb346d02bb131e52d391a5456c5ed8c75..76c3ec6c017eab2f25b28d855fad65b914c94313 100644 |
--- a/src/builtins/mips/builtins-mips.cc |
+++ b/src/builtins/mips/builtins-mips.cc |
@@ -1646,6 +1646,70 @@ void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { |
Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); |
} |
+void Builtins::Generate_NotifyBuiltinContinuation(MacroAssembler* masm) { |
+ { |
+ FrameScope scope(masm, StackFrame::INTERNAL); |
+ // Preserve possible return result from lazy deopt. |
+ __ Push(v0); |
+ // Pass the function and deoptimization type to the runtime system. |
+ __ CallRuntime(Runtime::kNotifyStubFailure, false); |
+ __ Pop(v0); |
+ } |
+ |
+ __ Addu(sp, sp, Operand(kPointerSize)); // Ignore state |
+ __ Jump(ra); // Jump to the ContinueToBuiltin stub |
+} |
+ |
+namespace { |
+void Generate_ContinueToBuiltinHelper(MacroAssembler* masm, |
+ bool java_script_builtin, |
+ bool with_result) { |
+ const RegisterConfiguration* config(RegisterConfiguration::Turbofan()); |
+ int allocatable_register_count = config->num_allocatable_general_registers(); |
+ if (with_result) { |
+ // Overwrite the hole inserted by the deoptimizer with the return value from |
+ // the LAZY deopt point. |
+ __ sw(v0, |
+ MemOperand( |
+ sp, config->num_allocatable_general_registers() * kPointerSize + |
+ BuiltinContinuationFrameConstants::kFixedFrameSize)); |
+ } |
+ for (int i = allocatable_register_count - 1; i >= 0; --i) { |
+ int code = config->GetAllocatableGeneralCode(i); |
+ __ Pop(Register::from_code(code)); |
+ if (java_script_builtin && code == kJavaScriptCallArgCountRegister.code()) { |
+ __ SmiUntag(Register::from_code(code)); |
+ } |
+ } |
+ __ lw(fp, MemOperand( |
+ sp, BuiltinContinuationFrameConstants::kFixedFrameSizeFromFp)); |
+ __ Pop(t0); |
+ __ Addu(sp, sp, |
+ Operand(BuiltinContinuationFrameConstants::kFixedFrameSizeFromFp)); |
+ __ Pop(ra); |
+ __ Addu(t0, t0, Operand(Code::kHeaderSize - kHeapObjectTag)); |
+ __ Jump(t0); |
+} |
+} // namespace |
+ |
+void Builtins::Generate_ContinueToCodeStubBuiltin(MacroAssembler* masm) { |
+ Generate_ContinueToBuiltinHelper(masm, false, false); |
+} |
+ |
+void Builtins::Generate_ContinueToCodeStubBuiltinWithResult( |
+ MacroAssembler* masm) { |
+ Generate_ContinueToBuiltinHelper(masm, false, true); |
+} |
+ |
+void Builtins::Generate_ContinueToJavaScriptBuiltin(MacroAssembler* masm) { |
+ Generate_ContinueToBuiltinHelper(masm, true, false); |
+} |
+ |
+void Builtins::Generate_ContinueToJavaScriptBuiltinWithResult( |
+ MacroAssembler* masm) { |
+ Generate_ContinueToBuiltinHelper(masm, true, true); |
+} |
+ |
static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, |
Deoptimizer::BailoutType type) { |
{ |