Chromium Code Reviews| Index: src/builtins/x64/builtins-x64.cc |
| diff --git a/src/builtins/x64/builtins-x64.cc b/src/builtins/x64/builtins-x64.cc |
| index d4fb131afc79142508d97533d7f82ee3096de2f3..6c89891838f715a518f0575b48d0cc7c48ca9a65 100644 |
| --- a/src/builtins/x64/builtins-x64.cc |
| +++ b/src/builtins/x64/builtins-x64.cc |
| @@ -1425,6 +1425,69 @@ void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { |
| Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); |
| } |
| +void Builtins::Generate_NotifyBuiltinContinuation(MacroAssembler* masm) { |
| + // Enter an internal frame. |
| + { |
| + 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. |
|
Jarin
2017/05/24 06:41:22
Improve comment? (We do not really tail call runti
danno
2017/06/06 12:04:52
Done.
|
| + __ Pushad(); |
| + __ CallRuntime(Runtime::kNotifyStubFailure, false); |
| + __ Popad(); |
| + // Tear down internal frame. |
| + } |
| + |
| + __ DropUnderReturnAddress(1); // Ignore state offset |
| + __ ret(0); // Return to IC Miss stub, continuation still on stack. |
|
Jarin
2017/05/24 06:41:22
Fix comment.
danno
2017/06/06 12:04:52
Done.
|
| +} |
| + |
| +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) { |
| + __ movq(Operand(rsp, |
| + config->num_allocatable_general_registers() * kPointerSize + |
| + TYPED_FRAME_SIZE(1)), |
| + rax); |
|
Jarin
2017/05/24 06:41:22
Is this the bit that overwrites the hole inserted
danno
2017/06/06 12:04:52
Done.
|
| + } |
| + for (int i = allocatable_register_count - 1; i >= 0; --i) { |
| + int code = config->GetAllocatableGeneralCode(i); |
| + __ popq(Register::from_code(code)); |
| + if (java_script_builtin && code == kJavaScriptCallArgCountRegister.code()) { |
| + __ SmiToInteger32(Register::from_code(code), Register::from_code(code)); |
| + } |
| + } |
| + __ movq(rbp, Operand(rsp, 2 * kPointerSize)); |
| + __ popq(Operand(rsp, TYPED_FRAME_SIZE_FROM_SP(0))); |
| + __ addq(rsp, Immediate(kPointerSize)); |
| + __ addq(Operand(rsp, 0), Immediate(Code::kHeaderSize - kHeapObjectTag)); |
| + __ Ret(); |
| +} |
| +} // 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) { |
| // Enter an internal frame. |