OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_ARM | 5 #if V8_TARGET_ARCH_ARM |
6 | 6 |
7 #include "src/assembler-inl.h" | 7 #include "src/assembler-inl.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/counters.h" | 9 #include "src/counters.h" |
10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1638 } | 1638 } |
1639 | 1639 |
1640 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { | 1640 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { |
1641 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); | 1641 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); |
1642 } | 1642 } |
1643 | 1643 |
1644 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { | 1644 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { |
1645 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); | 1645 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); |
1646 } | 1646 } |
1647 | 1647 |
| 1648 void Builtins::Generate_NotifyBuiltinContinuation(MacroAssembler* masm) { |
| 1649 { |
| 1650 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 1651 // Preserve possible return result from lazy deopt. |
| 1652 __ push(r0); |
| 1653 // Pass the function and deoptimization type to the runtime system. |
| 1654 __ CallRuntime(Runtime::kNotifyStubFailure, false); |
| 1655 __ pop(r0); |
| 1656 } |
| 1657 |
| 1658 __ add(sp, sp, Operand(kPointerSize)); // Ignore state |
| 1659 __ mov(pc, lr); // Jump to ContinueToBuiltin stub |
| 1660 } |
| 1661 |
| 1662 namespace { |
| 1663 void Generate_ContinueToBuiltinHelper(MacroAssembler* masm, |
| 1664 bool java_script_builtin, |
| 1665 bool with_result) { |
| 1666 const RegisterConfiguration* config(RegisterConfiguration::Turbofan()); |
| 1667 int allocatable_register_count = config->num_allocatable_general_registers(); |
| 1668 if (with_result) { |
| 1669 // Overwrite the hole inserted by the deoptimizer with the return value from |
| 1670 // the LAZY deopt point. |
| 1671 __ str(r0, |
| 1672 MemOperand( |
| 1673 sp, config->num_allocatable_general_registers() * kPointerSize + |
| 1674 BuiltinContinuationFrameConstants::kFixedFrameSize)); |
| 1675 } |
| 1676 for (int i = allocatable_register_count - 1; i >= 0; --i) { |
| 1677 int code = config->GetAllocatableGeneralCode(i); |
| 1678 __ Pop(Register::from_code(code)); |
| 1679 if (java_script_builtin && code == kJavaScriptCallArgCountRegister.code()) { |
| 1680 __ SmiUntag(Register::from_code(code)); |
| 1681 } |
| 1682 } |
| 1683 __ ldr(fp, MemOperand( |
| 1684 sp, BuiltinContinuationFrameConstants::kFixedFrameSizeFromFp)); |
| 1685 __ Pop(ip); |
| 1686 __ add(sp, sp, |
| 1687 Operand(BuiltinContinuationFrameConstants::kFixedFrameSizeFromFp)); |
| 1688 __ Pop(lr); |
| 1689 __ add(pc, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1690 } |
| 1691 } // namespace |
| 1692 |
| 1693 void Builtins::Generate_ContinueToCodeStubBuiltin(MacroAssembler* masm) { |
| 1694 Generate_ContinueToBuiltinHelper(masm, false, false); |
| 1695 } |
| 1696 |
| 1697 void Builtins::Generate_ContinueToCodeStubBuiltinWithResult( |
| 1698 MacroAssembler* masm) { |
| 1699 Generate_ContinueToBuiltinHelper(masm, false, true); |
| 1700 } |
| 1701 |
| 1702 void Builtins::Generate_ContinueToJavaScriptBuiltin(MacroAssembler* masm) { |
| 1703 Generate_ContinueToBuiltinHelper(masm, true, false); |
| 1704 } |
| 1705 |
| 1706 void Builtins::Generate_ContinueToJavaScriptBuiltinWithResult( |
| 1707 MacroAssembler* masm) { |
| 1708 Generate_ContinueToBuiltinHelper(masm, true, true); |
| 1709 } |
| 1710 |
1648 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, | 1711 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, |
1649 Deoptimizer::BailoutType type) { | 1712 Deoptimizer::BailoutType type) { |
1650 { | 1713 { |
1651 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 1714 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
1652 // Pass the function and deoptimization type to the runtime system. | 1715 // Pass the function and deoptimization type to the runtime system. |
1653 __ mov(r0, Operand(Smi::FromInt(static_cast<int>(type)))); | 1716 __ mov(r0, Operand(Smi::FromInt(static_cast<int>(type)))); |
1654 __ push(r0); | 1717 __ push(r0); |
1655 __ CallRuntime(Runtime::kNotifyDeoptimized); | 1718 __ CallRuntime(Runtime::kNotifyDeoptimized); |
1656 } | 1719 } |
1657 | 1720 |
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3053 } | 3116 } |
3054 // Now jump to the instructions of the returned code object. | 3117 // Now jump to the instructions of the returned code object. |
3055 __ Jump(r8); | 3118 __ Jump(r8); |
3056 } | 3119 } |
3057 #undef __ | 3120 #undef __ |
3058 | 3121 |
3059 } // namespace internal | 3122 } // namespace internal |
3060 } // namespace v8 | 3123 } // namespace v8 |
3061 | 3124 |
3062 #endif // V8_TARGET_ARCH_ARM | 3125 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |