| 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 #include "vm/simulator.h" | 9 #include "vm/simulator.h" |
| 10 #include "vm/runtime_entry.h" | 10 #include "vm/runtime_entry.h" |
| (...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 ldr(rd, Address(PP, offset)); | 1251 ldr(rd, Address(PP, offset)); |
| 1252 } else { | 1252 } else { |
| 1253 int32_t offset_hi = offset & ~offset_mask; // signed | 1253 int32_t offset_hi = offset & ~offset_mask; // signed |
| 1254 uint32_t offset_lo = offset & offset_mask; // unsigned | 1254 uint32_t offset_lo = offset & offset_mask; // unsigned |
| 1255 AddImmediate(rd, PP, offset_hi); | 1255 AddImmediate(rd, PP, offset_hi); |
| 1256 ldr(rd, Address(rd, offset_lo)); | 1256 ldr(rd, Address(rd, offset_lo)); |
| 1257 } | 1257 } |
| 1258 } | 1258 } |
| 1259 | 1259 |
| 1260 | 1260 |
| 1261 void Assembler::PushObject(const Object& object) { |
| 1262 LoadObject(IP, object); |
| 1263 Push(IP); |
| 1264 } |
| 1265 |
| 1266 |
| 1261 void Assembler::Bind(Label* label) { | 1267 void Assembler::Bind(Label* label) { |
| 1262 ASSERT(!label->IsBound()); | 1268 ASSERT(!label->IsBound()); |
| 1263 int bound_pc = buffer_.Size(); | 1269 int bound_pc = buffer_.Size(); |
| 1264 while (label->IsLinked()) { | 1270 while (label->IsLinked()) { |
| 1265 int32_t position = label->Position(); | 1271 int32_t position = label->Position(); |
| 1266 int32_t next = buffer_.Load<int32_t>(position); | 1272 int32_t next = buffer_.Load<int32_t>(position); |
| 1267 int32_t encoded = Assembler::EncodeBranchOffset(bound_pc - position, next); | 1273 int32_t encoded = Assembler::EncodeBranchOffset(bound_pc - position, next); |
| 1268 buffer_.Store<int32_t>(position, encoded); | 1274 buffer_.Store<int32_t>(position, encoded); |
| 1269 label->position_ = Assembler::DecodeBranchOffset(next); | 1275 label->position_ = Assembler::DecodeBranchOffset(next); |
| 1270 } | 1276 } |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1786 // the C++ world. | 1792 // the C++ world. |
| 1787 AddImmediate(SP, -frame_space); | 1793 AddImmediate(SP, -frame_space); |
| 1788 if (OS::ActivationFrameAlignment() > 0) { | 1794 if (OS::ActivationFrameAlignment() > 0) { |
| 1789 bic(SP, SP, ShifterOperand(OS::ActivationFrameAlignment() - 1)); | 1795 bic(SP, SP, ShifterOperand(OS::ActivationFrameAlignment() - 1)); |
| 1790 } | 1796 } |
| 1791 } | 1797 } |
| 1792 | 1798 |
| 1793 | 1799 |
| 1794 void Assembler::EnterCallRuntimeFrame(intptr_t frame_space) { | 1800 void Assembler::EnterCallRuntimeFrame(intptr_t frame_space) { |
| 1795 // Preserve volatile CPU registers. | 1801 // Preserve volatile CPU registers. |
| 1796 EnterFrame(kDartVolatileCpuRegs | (1 << FP), 0); | 1802 EnterFrame(kDartVolatileCpuRegs | (1 << FP) | (1 << LR), 0); |
| 1797 | 1803 |
| 1798 // Preserve all volatile FPU registers. | 1804 // Preserve all volatile FPU registers. |
| 1799 vstmd(DB_W, SP, kDartFirstVolatileFpuReg, kDartLastVolatileFpuReg); | 1805 vstmd(DB_W, SP, kDartFirstVolatileFpuReg, kDartLastVolatileFpuReg); |
| 1800 | 1806 |
| 1801 ReserveAlignedFrameSpace(frame_space); | 1807 ReserveAlignedFrameSpace(frame_space); |
| 1802 } | 1808 } |
| 1803 | 1809 |
| 1804 | 1810 |
| 1805 void Assembler::LeaveCallRuntimeFrame() { | 1811 void Assembler::LeaveCallRuntimeFrame() { |
| 1806 // SP might have been modified to reserve space for arguments | 1812 // SP might have been modified to reserve space for arguments |
| 1807 // and ensure proper alignment of the stack frame. | 1813 // and ensure proper alignment of the stack frame. |
| 1808 // We need to restore it before restoring registers. | 1814 // We need to restore it before restoring registers. |
| 1809 const intptr_t kPushedRegistersSize = | 1815 const intptr_t kPushedRegistersSize = |
| 1810 kDartVolatileCpuRegCount * kWordSize + | 1816 kDartVolatileCpuRegCount * kWordSize + |
| 1811 kDartVolatileFpuRegCount * 2 * kWordSize; | 1817 kDartVolatileFpuRegCount * 2 * kWordSize; |
| 1812 AddImmediate(SP, FP, -kPushedRegistersSize); | 1818 AddImmediate(SP, FP, -kPushedRegistersSize); |
| 1813 | 1819 |
| 1814 // Restore all volatile FPU registers. | 1820 // Restore all volatile FPU registers. |
| 1815 vldmd(IA_W, SP, kDartFirstVolatileFpuReg, kDartLastVolatileFpuReg); | 1821 vldmd(IA_W, SP, kDartFirstVolatileFpuReg, kDartLastVolatileFpuReg); |
| 1816 | 1822 |
| 1817 // Restore volatile CPU registers. | 1823 // Restore volatile CPU registers. |
| 1818 LeaveFrame(kDartVolatileCpuRegs | (1 << FP)); | 1824 LeaveFrame(kDartVolatileCpuRegs | (1 << FP) | (1 << LR)); |
| 1819 } | 1825 } |
| 1820 | 1826 |
| 1821 | 1827 |
| 1822 void Assembler::CallRuntime(const RuntimeEntry& entry) { | 1828 void Assembler::CallRuntime(const RuntimeEntry& entry) { |
| 1823 entry.Call(this); | 1829 entry.Call(this); |
| 1824 } | 1830 } |
| 1825 | 1831 |
| 1826 | 1832 |
| 1827 void Assembler::EnterDartFrame(intptr_t frame_size) { | 1833 void Assembler::EnterDartFrame(intptr_t frame_size) { |
| 1828 const intptr_t offset = CodeSize(); | 1834 const intptr_t offset = CodeSize(); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1946 // Do not reuse an existing entry, since each reference may be patched | 1952 // Do not reuse an existing entry, since each reference may be patched |
| 1947 // independently. | 1953 // independently. |
| 1948 object_pool_.Add(smi); | 1954 object_pool_.Add(smi); |
| 1949 return object_pool_.Length() - 1; | 1955 return object_pool_.Length() - 1; |
| 1950 } | 1956 } |
| 1951 | 1957 |
| 1952 } // namespace dart | 1958 } // namespace dart |
| 1953 | 1959 |
| 1954 #endif // defined TARGET_ARCH_ARM | 1960 #endif // defined TARGET_ARCH_ARM |
| 1955 | 1961 |
| OLD | NEW |