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/longjump.h" | 9 #include "vm/longjump.h" |
10 #include "vm/runtime_entry.h" | 10 #include "vm/runtime_entry.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 int mode = encoding_ & ((8|4|1) << 21); | 171 int mode = encoding_ & ((8|4|1) << 21); |
172 ASSERT((mode == Offset) || (mode == NegOffset)); | 172 ASSERT((mode == Offset) || (mode == NegOffset)); |
173 uint32_t vencoding = (encoding_ & (0xf << kRnShift)) | (offset >> 2); | 173 uint32_t vencoding = (encoding_ & (0xf << kRnShift)) | (offset >> 2); |
174 if (mode == Offset) { | 174 if (mode == Offset) { |
175 vencoding |= 1 << 23; | 175 vencoding |= 1 << 23; |
176 } | 176 } |
177 return vencoding; | 177 return vencoding; |
178 } | 178 } |
179 | 179 |
180 | 180 |
181 void Assembler::InitializeMemoryWithBreakpoints(uword data, int length) { | 181 void Assembler::InitializeMemoryWithBreakpoints(uword data, intptr_t length) { |
182 ASSERT(Utils::IsAligned(data, 4)); | 182 ASSERT(Utils::IsAligned(data, 4)); |
183 ASSERT(Utils::IsAligned(length, 4)); | 183 ASSERT(Utils::IsAligned(length, 4)); |
184 const uword end = data + length; | 184 const uword end = data + length; |
185 while (data < end) { | 185 while (data < end) { |
186 *reinterpret_cast<int32_t*>(data) = Instr::kBreakPointInstruction; | 186 *reinterpret_cast<int32_t*>(data) = Instr::kBreakPointInstruction; |
187 data += 4; | 187 data += 4; |
188 } | 188 } |
189 } | 189 } |
190 | 190 |
191 | 191 |
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1760 offset |= (movw & 0xf0000) >> 4; | 1760 offset |= (movw & 0xf0000) >> 4; |
1761 offset |= movw & 0xfff; | 1761 offset |= movw & 0xfff; |
1762 return offset; | 1762 return offset; |
1763 } | 1763 } |
1764 | 1764 |
1765 | 1765 |
1766 class PatchFarBranch : public AssemblerFixup { | 1766 class PatchFarBranch : public AssemblerFixup { |
1767 public: | 1767 public: |
1768 PatchFarBranch() {} | 1768 PatchFarBranch() {} |
1769 | 1769 |
1770 void Process(const MemoryRegion& region, int position) { | 1770 void Process(const MemoryRegion& region, intptr_t position) { |
1771 const int32_t movw = region.Load<int32_t>(position); | 1771 const int32_t movw = region.Load<int32_t>(position); |
1772 const int32_t movt = region.Load<int32_t>(position + Instr::kInstrSize); | 1772 const int32_t movt = region.Load<int32_t>(position + Instr::kInstrSize); |
1773 const int32_t bx = region.Load<int32_t>(position + 2 * Instr::kInstrSize); | 1773 const int32_t bx = region.Load<int32_t>(position + 2 * Instr::kInstrSize); |
1774 | 1774 |
1775 if (((movt & 0xfff0f000) == 0xe340c000) && // movt IP, high | 1775 if (((movt & 0xfff0f000) == 0xe340c000) && // movt IP, high |
1776 ((movw & 0xfff0f000) == 0xe300c000)) { // movw IP, low | 1776 ((movw & 0xfff0f000) == 0xe300c000)) { // movw IP, low |
1777 const int32_t offset = DecodeLoadImmediate(movt, movw); | 1777 const int32_t offset = DecodeLoadImmediate(movt, movw); |
1778 const int32_t dest = region.start() + offset; | 1778 const int32_t dest = region.start() + offset; |
1779 const uint16_t dest_high = Utils::High16Bits(dest); | 1779 const uint16_t dest_high = Utils::High16Bits(dest); |
1780 const uint16_t dest_low = Utils::Low16Bits(dest); | 1780 const uint16_t dest_low = Utils::Low16Bits(dest); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1827 // Use the offset field of the branch instruction for linking the sites. | 1827 // Use the offset field of the branch instruction for linking the sites. |
1828 EmitType5(cond, label->position_, link); | 1828 EmitType5(cond, label->position_, link); |
1829 } | 1829 } |
1830 label->LinkTo(position); | 1830 label->LinkTo(position); |
1831 } | 1831 } |
1832 } | 1832 } |
1833 | 1833 |
1834 | 1834 |
1835 void Assembler::Bind(Label* label) { | 1835 void Assembler::Bind(Label* label) { |
1836 ASSERT(!label->IsBound()); | 1836 ASSERT(!label->IsBound()); |
1837 int bound_pc = buffer_.Size(); | 1837 intptr_t bound_pc = buffer_.Size(); |
1838 while (label->IsLinked()) { | 1838 while (label->IsLinked()) { |
1839 const int32_t position = label->Position(); | 1839 const int32_t position = label->Position(); |
1840 int32_t dest = bound_pc - position; | 1840 int32_t dest = bound_pc - position; |
1841 if (use_far_branches() && !CanEncodeBranchOffset(dest)) { | 1841 if (use_far_branches() && !CanEncodeBranchOffset(dest)) { |
1842 // Far branches are enabled and we can't encode the branch offset. | 1842 // Far branches are enabled and we can't encode the branch offset. |
1843 | 1843 |
1844 // Grab instructions that load the offset. | 1844 // Grab instructions that load the offset. |
1845 const int32_t movw = | 1845 const int32_t movw = |
1846 buffer_.Load<int32_t>(position); | 1846 buffer_.Load<int32_t>(position); |
1847 const int32_t movt = | 1847 const int32_t movt = |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2679 | 2679 |
2680 | 2680 |
2681 int32_t Assembler::AddObject(const Object& obj) { | 2681 int32_t Assembler::AddObject(const Object& obj) { |
2682 ASSERT(obj.IsNotTemporaryScopedHandle()); | 2682 ASSERT(obj.IsNotTemporaryScopedHandle()); |
2683 ASSERT(obj.IsOld()); | 2683 ASSERT(obj.IsOld()); |
2684 if (object_pool_.IsNull()) { | 2684 if (object_pool_.IsNull()) { |
2685 // The object pool cannot be used in the vm isolate. | 2685 // The object pool cannot be used in the vm isolate. |
2686 ASSERT(Isolate::Current() != Dart::vm_isolate()); | 2686 ASSERT(Isolate::Current() != Dart::vm_isolate()); |
2687 object_pool_ = GrowableObjectArray::New(Heap::kOld); | 2687 object_pool_ = GrowableObjectArray::New(Heap::kOld); |
2688 } | 2688 } |
2689 for (int i = 0; i < object_pool_.Length(); i++) { | 2689 for (intptr_t i = 0; i < object_pool_.Length(); i++) { |
2690 if (object_pool_.At(i) == obj.raw()) { | 2690 if (object_pool_.At(i) == obj.raw()) { |
2691 return i; | 2691 return i; |
2692 } | 2692 } |
2693 } | 2693 } |
2694 object_pool_.Add(obj, Heap::kOld); | 2694 object_pool_.Add(obj, Heap::kOld); |
2695 return object_pool_.Length() - 1; | 2695 return object_pool_.Length() - 1; |
2696 } | 2696 } |
2697 | 2697 |
2698 | 2698 |
2699 int32_t Assembler::AddExternalLabel(const ExternalLabel* label) { | 2699 int32_t Assembler::AddExternalLabel(const ExternalLabel* label) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2735 | 2735 |
2736 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 2736 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
2737 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); | 2737 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); |
2738 return fpu_reg_names[reg]; | 2738 return fpu_reg_names[reg]; |
2739 } | 2739 } |
2740 | 2740 |
2741 } // namespace dart | 2741 } // namespace dart |
2742 | 2742 |
2743 #endif // defined TARGET_ARCH_ARM | 2743 #endif // defined TARGET_ARCH_ARM |
2744 | 2744 |
OLD | NEW |