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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 290 |
291 FieldAddress& operator=(const FieldAddress& other) { | 291 FieldAddress& operator=(const FieldAddress& other) { |
292 Address::operator=(other); | 292 Address::operator=(other); |
293 return *this; | 293 return *this; |
294 } | 294 } |
295 }; | 295 }; |
296 | 296 |
297 | 297 |
298 class Assembler : public ValueObject { | 298 class Assembler : public ValueObject { |
299 public: | 299 public: |
300 Assembler() | 300 explicit Assembler(bool use_far_branches = false) |
301 : buffer_(), | 301 : buffer_(), |
302 object_pool_(GrowableObjectArray::Handle()), | 302 object_pool_(GrowableObjectArray::Handle()), |
303 prologue_offset_(-1), | 303 prologue_offset_(-1), |
| 304 use_far_branches_(use_far_branches), |
304 comments_() { } | 305 comments_() { } |
305 ~Assembler() { } | 306 ~Assembler() { } |
306 | 307 |
307 void PopRegister(Register r) { Pop(r); } | 308 void PopRegister(Register r) { Pop(r); } |
308 | 309 |
309 void Bind(Label* label); | 310 void Bind(Label* label); |
310 | 311 |
311 // Misc. functionality | 312 // Misc. functionality |
312 int CodeSize() const { return buffer_.Size(); } | 313 int CodeSize() const { return buffer_.Size(); } |
313 int prologue_offset() const { return prologue_offset_; } | 314 int prologue_offset() const { return prologue_offset_; } |
314 const ZoneGrowableArray<int>& GetPointerOffsets() const { | 315 const ZoneGrowableArray<int>& GetPointerOffsets() const { |
315 ASSERT(buffer_.pointer_offsets().length() == 0); // No pointers in code. | 316 ASSERT(buffer_.pointer_offsets().length() == 0); // No pointers in code. |
316 return buffer_.pointer_offsets(); | 317 return buffer_.pointer_offsets(); |
317 } | 318 } |
318 const GrowableObjectArray& object_pool() const { return object_pool_; } | 319 const GrowableObjectArray& object_pool() const { return object_pool_; } |
319 | 320 |
| 321 bool use_far_branches() const { |
| 322 return FLAG_use_far_branches || use_far_branches_; |
| 323 } |
| 324 |
320 void FinalizeInstructions(const MemoryRegion& region) { | 325 void FinalizeInstructions(const MemoryRegion& region) { |
321 buffer_.FinalizeInstructions(region); | 326 buffer_.FinalizeInstructions(region); |
322 } | 327 } |
323 | 328 |
324 // Debugging and bringup support. | 329 // Debugging and bringup support. |
325 void Stop(const char* message); | 330 void Stop(const char* message); |
326 void Unimplemented(const char* message); | 331 void Unimplemented(const char* message); |
327 void Untested(const char* message); | 332 void Untested(const char* message); |
328 void Unreachable(const char* message); | 333 void Unreachable(const char* message); |
329 | 334 |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 Register instance_reg); | 731 Register instance_reg); |
727 | 732 |
728 // Emit data (e.g encoded instruction or immediate) in instruction stream. | 733 // Emit data (e.g encoded instruction or immediate) in instruction stream. |
729 void Emit(int32_t value); | 734 void Emit(int32_t value); |
730 | 735 |
731 private: | 736 private: |
732 AssemblerBuffer buffer_; // Contains position independent code. | 737 AssemblerBuffer buffer_; // Contains position independent code. |
733 GrowableObjectArray& object_pool_; // Objects and patchable jump targets. | 738 GrowableObjectArray& object_pool_; // Objects and patchable jump targets. |
734 int32_t prologue_offset_; | 739 int32_t prologue_offset_; |
735 | 740 |
| 741 const bool use_far_branches_; |
| 742 |
736 int32_t AddObject(const Object& obj); | 743 int32_t AddObject(const Object& obj); |
737 int32_t AddExternalLabel(const ExternalLabel* label); | 744 int32_t AddExternalLabel(const ExternalLabel* label); |
738 | 745 |
739 class CodeComment : public ZoneAllocated { | 746 class CodeComment : public ZoneAllocated { |
740 public: | 747 public: |
741 CodeComment(intptr_t pc_offset, const String& comment) | 748 CodeComment(intptr_t pc_offset, const String& comment) |
742 : pc_offset_(pc_offset), comment_(comment) { } | 749 : pc_offset_(pc_offset), comment_(comment) { } |
743 | 750 |
744 intptr_t pc_offset() const { return pc_offset_; } | 751 intptr_t pc_offset() const { return pc_offset_; } |
745 const String& comment() const { return comment_; } | 752 const String& comment() const { return comment_; } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 SRegister sm); | 849 SRegister sm); |
843 | 850 |
844 void EmitSIMDqqq(int32_t opcode, OperandSize sz, | 851 void EmitSIMDqqq(int32_t opcode, OperandSize sz, |
845 QRegister qd, QRegister qn, QRegister qm); | 852 QRegister qd, QRegister qn, QRegister qm); |
846 | 853 |
847 void EmitSIMDddd(int32_t opcode, OperandSize sz, | 854 void EmitSIMDddd(int32_t opcode, OperandSize sz, |
848 DRegister dd, DRegister dn, DRegister dm); | 855 DRegister dd, DRegister dn, DRegister dm); |
849 | 856 |
850 void EmitFarBranch(Condition cond, int32_t offset, bool link); | 857 void EmitFarBranch(Condition cond, int32_t offset, bool link); |
851 void EmitBranch(Condition cond, Label* label, bool link); | 858 void EmitBranch(Condition cond, Label* label, bool link); |
852 static int32_t EncodeBranchOffset(int32_t offset, int32_t inst); | 859 int32_t EncodeBranchOffset(int32_t offset, int32_t inst); |
853 static int DecodeBranchOffset(int32_t inst); | 860 static int DecodeBranchOffset(int32_t inst); |
854 int32_t EncodeTstOffset(int32_t offset, int32_t inst); | 861 int32_t EncodeTstOffset(int32_t offset, int32_t inst); |
855 int DecodeTstOffset(int32_t inst); | 862 int DecodeTstOffset(int32_t inst); |
856 | 863 |
857 void StoreIntoObjectFilter(Register object, Register value, Label* no_update); | 864 void StoreIntoObjectFilter(Register object, Register value, Label* no_update); |
858 | 865 |
859 // Shorter filtering sequence that assumes that value is not a smi. | 866 // Shorter filtering sequence that assumes that value is not a smi. |
860 void StoreIntoObjectFilterNoSmi(Register object, | 867 void StoreIntoObjectFilterNoSmi(Register object, |
861 Register value, | 868 Register value, |
862 Label* no_update); | 869 Label* no_update); |
863 | 870 |
864 DISALLOW_ALLOCATION(); | 871 DISALLOW_ALLOCATION(); |
865 DISALLOW_COPY_AND_ASSIGN(Assembler); | 872 DISALLOW_COPY_AND_ASSIGN(Assembler); |
866 }; | 873 }; |
867 | 874 |
868 } // namespace dart | 875 } // namespace dart |
869 | 876 |
870 #endif // VM_ASSEMBLER_ARM_H_ | 877 #endif // VM_ASSEMBLER_ARM_H_ |
OLD | NEW |