Index: src/builtins/mips64/builtins-mips64.cc |
diff --git a/src/builtins/mips64/builtins-mips64.cc b/src/builtins/mips64/builtins-mips64.cc |
index 4d80993952b6f70cd4d54c37c2617bc93cdfe81e..41f842c0a103cb7a062a03fa77a3da48ef36229c 100644 |
--- a/src/builtins/mips64/builtins-mips64.cc |
+++ b/src/builtins/mips64/builtins-mips64.cc |
@@ -1647,6 +1647,68 @@ void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { |
Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); |
} |
+void Builtins::Generate_NotifyBuiltinContinuation(MacroAssembler* masm) { |
+ { |
+ FrameScope scope(masm, StackFrame::INTERNAL); |
+ |
+ // Preserve registers across notification, this is important for compiled |
+ // stubs that tail call the runtime on deopts passing their parameters in |
+ // registers. |
+ __ MultiPush(kJSCallerSaved | kCalleeSaved); |
+ // Pass the function and deoptimization type to the runtime system. |
+ __ CallRuntime(Runtime::kNotifyStubFailure, false); |
+ __ MultiPop(kJSCallerSaved | kCalleeSaved); |
+ } |
+ |
+ __ Daddu(sp, sp, Operand(kPointerSize)); // Ignore state |
+ __ Jump(ra); // Jump to miss handler |
+} |
+ |
+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) { |
+ __ Sd(v0, MemOperand(sp, config->num_allocatable_general_registers() * |
+ kPointerSize + |
+ TYPED_FRAME_SIZE(1))); |
+ } |
+ 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)); |
+ } |
+ } |
+ __ Ld(fp, MemOperand(sp, 2 * kPointerSize)); |
+ __ Pop(t0); |
+ __ Daddu(sp, sp, Operand(2 * kPointerSize)); |
+ __ Pop(ra); |
+ __ Daddu(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) { |
{ |