OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 | 9 |
10 #include "vm/runtime_entry.h" | 10 #include "vm/runtime_entry.h" |
(...skipping 1692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1703 // Restore volatile CPU registers. | 1703 // Restore volatile CPU registers. |
1704 LeaveFrame(kDartVolatileCpuRegs | (1 << FP)); | 1704 LeaveFrame(kDartVolatileCpuRegs | (1 << FP)); |
1705 } | 1705 } |
1706 | 1706 |
1707 | 1707 |
1708 void Assembler::CallRuntime(const RuntimeEntry& entry) { | 1708 void Assembler::CallRuntime(const RuntimeEntry& entry) { |
1709 entry.Call(this); | 1709 entry.Call(this); |
1710 } | 1710 } |
1711 | 1711 |
1712 | 1712 |
| 1713 void Assembler::EnterDartFrame(intptr_t frame_size) { |
| 1714 const intptr_t offset = CodeSize(); |
| 1715 // Save PC in frame for fast identification of corresponding code. |
| 1716 // Note that callee-saved registers can be added to the register list. |
| 1717 EnterFrame((1 << PP) | (1 << FP) | (1 << LR) | (1 << PC), 0); |
| 1718 |
| 1719 if (offset != 0) { |
| 1720 // Adjust saved PC for any intrinsic code that could have been generated |
| 1721 // before a frame is created. Use PP as temp register. |
| 1722 ldr(PP, Address(FP, 2 * kWordSize)); |
| 1723 AddImmediate(PP, PP, -offset); |
| 1724 str(PP, Address(FP, 2 * kWordSize)); |
| 1725 } |
| 1726 |
| 1727 // Setup pool pointer for this dart function. |
| 1728 const intptr_t object_pool_pc_dist = |
| 1729 Instructions::HeaderSize() - Instructions::object_pool_offset() + |
| 1730 CodeSize() + Instr::kPCReadOffset; |
| 1731 ldr(PP, Address(PC, -object_pool_pc_dist)); |
| 1732 |
| 1733 // Reserve space for locals. |
| 1734 AddImmediate(SP, -frame_size); |
| 1735 } |
| 1736 |
| 1737 |
| 1738 void Assembler::LeaveDartFrame() { |
| 1739 LeaveFrame((1 << PP) | (1 << FP) | (1 << LR)); |
| 1740 // Adjust SP for PC pushed in EnterDartFrame. |
| 1741 AddImmediate(SP, kWordSize); |
| 1742 } |
| 1743 |
| 1744 |
| 1745 void Assembler::EnterStubFrame() { |
| 1746 // Push 0 as saved PC for stub frames. |
| 1747 mov(IP, ShifterOperand(LR)); |
| 1748 mov(LR, ShifterOperand(0)); |
| 1749 EnterFrame((1 << FP) | (1 << IP) | (1 << LR), 0); |
| 1750 } |
| 1751 |
| 1752 |
| 1753 void Assembler::LeaveStubFrame() { |
| 1754 LeaveFrame((1 << FP) | (1 << LR)); |
| 1755 // Adjust SP for null PC pushed in EnterStubFrame. |
| 1756 AddImmediate(SP, kWordSize); |
| 1757 } |
| 1758 |
| 1759 |
| 1760 void Assembler::TryAllocate(const Class& cls, |
| 1761 Label* failure, |
| 1762 bool near_jump, |
| 1763 Register instance_reg) { |
| 1764 UNIMPLEMENTED(); |
| 1765 } |
| 1766 |
| 1767 |
1713 void Assembler::Stop(const char* message) { | 1768 void Assembler::Stop(const char* message) { |
1714 if (FLAG_print_stop_message) { | 1769 if (FLAG_print_stop_message) { |
1715 PushList((1 << R0) | (1 << IP) | (1 << LR)); // Preserve R0, IP, LR. | 1770 PushList((1 << R0) | (1 << IP) | (1 << LR)); // Preserve R0, IP, LR. |
1716 LoadImmediate(R0, reinterpret_cast<int32_t>(message)); | 1771 LoadImmediate(R0, reinterpret_cast<int32_t>(message)); |
1717 // PrintStopMessage() preserves all registers. | 1772 // PrintStopMessage() preserves all registers. |
1718 BranchLink(&StubCode::PrintStopMessageLabel()); // Passing message in R0. | 1773 BranchLink(&StubCode::PrintStopMessageLabel()); // Passing message in R0. |
1719 PopList((1 << R0) | (1 << IP) | (1 << LR)); // Restore R0, IP, LR. | 1774 PopList((1 << R0) | (1 << IP) | (1 << LR)); // Restore R0, IP, LR. |
1720 } | 1775 } |
1721 // Emit the message address before the svc instruction, so that we can | 1776 // Emit the message address before the svc instruction, so that we can |
1722 // 'unstop' and continue execution in the simulator or jump to the next | 1777 // 'unstop' and continue execution in the simulator or jump to the next |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1777 // Do not reuse an existing entry, since each reference may be patched | 1832 // Do not reuse an existing entry, since each reference may be patched |
1778 // independently. | 1833 // independently. |
1779 object_pool_.Add(smi); | 1834 object_pool_.Add(smi); |
1780 return object_pool_.Length() - 1; | 1835 return object_pool_.Length() - 1; |
1781 } | 1836 } |
1782 | 1837 |
1783 } // namespace dart | 1838 } // namespace dart |
1784 | 1839 |
1785 #endif // defined TARGET_ARCH_ARM | 1840 #endif // defined TARGET_ARCH_ARM |
1786 | 1841 |
OLD | NEW |