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 #ifndef VM_ASSEMBLER_ARM_H_ | 5 #ifndef VM_ASSEMBLER_ARM_H_ |
6 #define VM_ASSEMBLER_ARM_H_ | 6 #define VM_ASSEMBLER_ARM_H_ |
7 | 7 |
8 #ifndef VM_ASSEMBLER_H_ | 8 #ifndef VM_ASSEMBLER_H_ |
9 #error Do not include assembler_arm.h directly; use assembler.h instead. | 9 #error Do not include assembler_arm.h directly; use assembler.h instead. |
10 #endif | 10 #endif |
(...skipping 12 matching lines...) Expand all Loading... |
23 public: | 23 public: |
24 Label() : position_(0) { } | 24 Label() : position_(0) { } |
25 | 25 |
26 ~Label() { | 26 ~Label() { |
27 // Assert if label is being destroyed with unresolved branches pending. | 27 // Assert if label is being destroyed with unresolved branches pending. |
28 ASSERT(!IsLinked()); | 28 ASSERT(!IsLinked()); |
29 } | 29 } |
30 | 30 |
31 // Returns the position for bound and linked labels. Cannot be used | 31 // Returns the position for bound and linked labels. Cannot be used |
32 // for unused labels. | 32 // for unused labels. |
33 int Position() const { | 33 intptr_t Position() const { |
34 ASSERT(!IsUnused()); | 34 ASSERT(!IsUnused()); |
35 return IsBound() ? -position_ - kWordSize : position_ - kWordSize; | 35 return IsBound() ? -position_ - kWordSize : position_ - kWordSize; |
36 } | 36 } |
37 | 37 |
38 bool IsBound() const { return position_ < 0; } | 38 bool IsBound() const { return position_ < 0; } |
39 bool IsUnused() const { return position_ == 0; } | 39 bool IsUnused() const { return position_ == 0; } |
40 bool IsLinked() const { return position_ > 0; } | 40 bool IsLinked() const { return position_ > 0; } |
41 | 41 |
42 private: | 42 private: |
43 int position_; | 43 intptr_t position_; |
44 | 44 |
45 void Reinitialize() { | 45 void Reinitialize() { |
46 position_ = 0; | 46 position_ = 0; |
47 } | 47 } |
48 | 48 |
49 void BindTo(int position) { | 49 void BindTo(intptr_t position) { |
50 ASSERT(!IsBound()); | 50 ASSERT(!IsBound()); |
51 position_ = -position - kWordSize; | 51 position_ = -position - kWordSize; |
52 ASSERT(IsBound()); | 52 ASSERT(IsBound()); |
53 } | 53 } |
54 | 54 |
55 void LinkTo(int position) { | 55 void LinkTo(intptr_t position) { |
56 ASSERT(!IsBound()); | 56 ASSERT(!IsBound()); |
57 position_ = position + kWordSize; | 57 position_ = position + kWordSize; |
58 ASSERT(IsLinked()); | 58 ASSERT(IsLinked()); |
59 } | 59 } |
60 | 60 |
61 friend class Assembler; | 61 friend class Assembler; |
62 DISALLOW_COPY_AND_ASSIGN(Label); | 62 DISALLOW_COPY_AND_ASSIGN(Label); |
63 }; | 63 }; |
64 | 64 |
65 | 65 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 prologue_offset_(-1), | 303 prologue_offset_(-1), |
304 use_far_branches_(use_far_branches), | 304 use_far_branches_(use_far_branches), |
305 comments_() { } | 305 comments_() { } |
306 ~Assembler() { } | 306 ~Assembler() { } |
307 | 307 |
308 void PopRegister(Register r) { Pop(r); } | 308 void PopRegister(Register r) { Pop(r); } |
309 | 309 |
310 void Bind(Label* label); | 310 void Bind(Label* label); |
311 | 311 |
312 // Misc. functionality | 312 // Misc. functionality |
313 int CodeSize() const { return buffer_.Size(); } | 313 intptr_t CodeSize() const { return buffer_.Size(); } |
314 int prologue_offset() const { return prologue_offset_; } | 314 intptr_t prologue_offset() const { return prologue_offset_; } |
315 const ZoneGrowableArray<int>& GetPointerOffsets() const { | 315 const ZoneGrowableArray<intptr_t>& GetPointerOffsets() const { |
316 ASSERT(buffer_.pointer_offsets().length() == 0); // No pointers in code. | 316 ASSERT(buffer_.pointer_offsets().length() == 0); // No pointers in code. |
317 return buffer_.pointer_offsets(); | 317 return buffer_.pointer_offsets(); |
318 } | 318 } |
319 const GrowableObjectArray& object_pool() const { return object_pool_; } | 319 const GrowableObjectArray& object_pool() const { return object_pool_; } |
320 | 320 |
321 bool use_far_branches() const { | 321 bool use_far_branches() const { |
322 return FLAG_use_far_branches || use_far_branches_; | 322 return FLAG_use_far_branches || use_far_branches_; |
323 } | 323 } |
324 | 324 |
325 void FinalizeInstructions(const MemoryRegion& region) { | 325 void FinalizeInstructions(const MemoryRegion& region) { |
326 buffer_.FinalizeInstructions(region); | 326 buffer_.FinalizeInstructions(region); |
327 } | 327 } |
328 | 328 |
329 // Debugging and bringup support. | 329 // Debugging and bringup support. |
330 void Stop(const char* message); | 330 void Stop(const char* message); |
331 void Unimplemented(const char* message); | 331 void Unimplemented(const char* message); |
332 void Untested(const char* message); | 332 void Untested(const char* message); |
333 void Unreachable(const char* message); | 333 void Unreachable(const char* message); |
334 | 334 |
335 static void InitializeMemoryWithBreakpoints(uword data, int length); | 335 static void InitializeMemoryWithBreakpoints(uword data, intptr_t length); |
336 | 336 |
337 void Comment(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 337 void Comment(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
338 | 338 |
339 const Code::Comments& GetCodeComments() const; | 339 const Code::Comments& GetCodeComments() const; |
340 | 340 |
341 static const char* RegisterName(Register reg); | 341 static const char* RegisterName(Register reg); |
342 | 342 |
343 static const char* FpuRegisterName(FpuRegister reg); | 343 static const char* FpuRegisterName(FpuRegister reg); |
344 | 344 |
345 // Data-processing instructions. | 345 // Data-processing instructions. |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 Register value, | 868 Register value, |
869 Label* no_update); | 869 Label* no_update); |
870 | 870 |
871 DISALLOW_ALLOCATION(); | 871 DISALLOW_ALLOCATION(); |
872 DISALLOW_COPY_AND_ASSIGN(Assembler); | 872 DISALLOW_COPY_AND_ASSIGN(Assembler); |
873 }; | 873 }; |
874 | 874 |
875 } // namespace dart | 875 } // namespace dart |
876 | 876 |
877 #endif // VM_ASSEMBLER_ARM_H_ | 877 #endif // VM_ASSEMBLER_ARM_H_ |
OLD | NEW |