Index: src/builtins/arm/builtins-arm.cc |
diff --git a/src/builtins/arm/builtins-arm.cc b/src/builtins/arm/builtins-arm.cc |
index 286df2eea793f370a964cde4388c808fad7e9a36..704d011c2333664bf68166b64b3e9b0840e929c7 100644 |
--- a/src/builtins/arm/builtins-arm.cc |
+++ b/src/builtins/arm/builtins-arm.cc |
@@ -1645,6 +1645,67 @@ void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { |
Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); |
} |
+void Builtins::Generate_NotifyBuiltinContinuation(MacroAssembler* masm) { |
+ { |
+ FrameAndConstantPoolScope 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. |
+ __ stm(db_w, sp, kJSCallerSaved | kCalleeSaved); |
+ // Pass the function and deoptimization type to the runtime system. |
+ __ CallRuntime(Runtime::kNotifyStubFailure, false); |
+ __ ldm(ia_w, sp, kJSCallerSaved | kCalleeSaved); |
+ } |
+ |
+ __ add(sp, sp, Operand(kPointerSize)); // Ignore state |
+ __ mov(pc, lr); // 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) { |
+ __ str(r0, 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)); |
+ } |
+ } |
+ __ ldr(fp, MemOperand(sp, 2 * kPointerSize)); |
+ __ Pop(ip); |
+ __ add(sp, sp, Operand(2 * kPointerSize)); |
+ __ Pop(lr); |
+ __ add(pc, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); |
+} |
+} // 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) { |
{ |