OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/arm64/macro-assembler-arm64-inl.h" | 8 #include "src/arm64/macro-assembler-arm64-inl.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/counters.h" | 10 #include "src/counters.h" |
(...skipping 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1683 } | 1683 } |
1684 | 1684 |
1685 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { | 1685 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { |
1686 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); | 1686 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); |
1687 } | 1687 } |
1688 | 1688 |
1689 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { | 1689 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { |
1690 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); | 1690 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); |
1691 } | 1691 } |
1692 | 1692 |
| 1693 void Builtins::Generate_NotifyBuiltinContinuation(MacroAssembler* masm) { |
| 1694 { |
| 1695 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1696 // Preserve possible return result from lazy deopt. |
| 1697 __ Push(x0); |
| 1698 // Pass the function and deoptimization type to the runtime system. |
| 1699 __ CallRuntime(Runtime::kNotifyStubFailure, false); |
| 1700 __ Pop(x0); |
| 1701 } |
| 1702 |
| 1703 // Ignore state (pushed by Deoptimizer::EntryGenerator::Generate). |
| 1704 __ Drop(1); |
| 1705 |
| 1706 // Jump to the ContinueToBuiltin stub. Deoptimizer::EntryGenerator::Generate |
| 1707 // loads this into lr before it jumps here. |
| 1708 __ Br(lr); |
| 1709 } |
| 1710 |
| 1711 namespace { |
| 1712 void Generate_ContinueToBuiltinHelper(MacroAssembler* masm, |
| 1713 bool java_script_builtin, |
| 1714 bool with_result) { |
| 1715 const RegisterConfiguration* config(RegisterConfiguration::Turbofan()); |
| 1716 int allocatable_register_count = config->num_allocatable_general_registers(); |
| 1717 if (with_result) { |
| 1718 // Overwrite the hole inserted by the deoptimizer with the return value from |
| 1719 // the LAZY deopt point. |
| 1720 __ Str(x0, MemOperand( |
| 1721 jssp, |
| 1722 config->num_allocatable_general_registers() * kPointerSize + |
| 1723 BuiltinContinuationFrameConstants::kFixedFrameSize)); |
| 1724 } |
| 1725 for (int i = allocatable_register_count - 1; i >= 0; --i) { |
| 1726 int code = config->GetAllocatableGeneralCode(i); |
| 1727 __ Pop(Register::from_code(code)); |
| 1728 if (java_script_builtin && code == kJavaScriptCallArgCountRegister.code()) { |
| 1729 __ SmiUntag(Register::from_code(code)); |
| 1730 } |
| 1731 } |
| 1732 __ ldr(fp, |
| 1733 MemOperand(jssp, |
| 1734 BuiltinContinuationFrameConstants::kFixedFrameSizeFromFp)); |
| 1735 __ Pop(ip0); |
| 1736 __ Add(jssp, jssp, |
| 1737 Operand(BuiltinContinuationFrameConstants::kFixedFrameSizeFromFp)); |
| 1738 __ Pop(lr); |
| 1739 __ Add(ip0, ip0, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1740 __ Br(ip0); |
| 1741 } |
| 1742 } // namespace |
| 1743 |
| 1744 void Builtins::Generate_ContinueToCodeStubBuiltin(MacroAssembler* masm) { |
| 1745 Generate_ContinueToBuiltinHelper(masm, false, false); |
| 1746 } |
| 1747 |
| 1748 void Builtins::Generate_ContinueToCodeStubBuiltinWithResult( |
| 1749 MacroAssembler* masm) { |
| 1750 Generate_ContinueToBuiltinHelper(masm, false, true); |
| 1751 } |
| 1752 |
| 1753 void Builtins::Generate_ContinueToJavaScriptBuiltin(MacroAssembler* masm) { |
| 1754 Generate_ContinueToBuiltinHelper(masm, true, false); |
| 1755 } |
| 1756 |
| 1757 void Builtins::Generate_ContinueToJavaScriptBuiltinWithResult( |
| 1758 MacroAssembler* masm) { |
| 1759 Generate_ContinueToBuiltinHelper(masm, true, true); |
| 1760 } |
| 1761 |
1693 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, | 1762 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, |
1694 Deoptimizer::BailoutType type) { | 1763 Deoptimizer::BailoutType type) { |
1695 { | 1764 { |
1696 FrameScope scope(masm, StackFrame::INTERNAL); | 1765 FrameScope scope(masm, StackFrame::INTERNAL); |
1697 // Pass the deoptimization type to the runtime system. | 1766 // Pass the deoptimization type to the runtime system. |
1698 __ Mov(x0, Smi::FromInt(static_cast<int>(type))); | 1767 __ Mov(x0, Smi::FromInt(static_cast<int>(type))); |
1699 __ Push(x0); | 1768 __ Push(x0); |
1700 __ CallRuntime(Runtime::kNotifyDeoptimized); | 1769 __ CallRuntime(Runtime::kNotifyDeoptimized); |
1701 } | 1770 } |
1702 | 1771 |
(...skipping 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3214 // Now jump to the instructions of the returned code object. | 3283 // Now jump to the instructions of the returned code object. |
3215 __ Jump(x8); | 3284 __ Jump(x8); |
3216 } | 3285 } |
3217 | 3286 |
3218 #undef __ | 3287 #undef __ |
3219 | 3288 |
3220 } // namespace internal | 3289 } // namespace internal |
3221 } // namespace v8 | 3290 } // namespace v8 |
3222 | 3291 |
3223 #endif // V8_TARGET_ARCH_ARM | 3292 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |