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 { return use_far_branches_; } | |
322 | |
320 void FinalizeInstructions(const MemoryRegion& region) { | 323 void FinalizeInstructions(const MemoryRegion& region) { |
321 buffer_.FinalizeInstructions(region); | 324 buffer_.FinalizeInstructions(region); |
322 } | 325 } |
323 | 326 |
324 // Debugging and bringup support. | 327 // Debugging and bringup support. |
325 void Stop(const char* message); | 328 void Stop(const char* message); |
326 void Unimplemented(const char* message); | 329 void Unimplemented(const char* message); |
327 void Untested(const char* message); | 330 void Untested(const char* message); |
328 void Unreachable(const char* message); | 331 void Unreachable(const char* message); |
329 | 332 |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
726 Register instance_reg); | 729 Register instance_reg); |
727 | 730 |
728 // Emit data (e.g encoded instruction or immediate) in instruction stream. | 731 // Emit data (e.g encoded instruction or immediate) in instruction stream. |
729 void Emit(int32_t value); | 732 void Emit(int32_t value); |
730 | 733 |
731 private: | 734 private: |
732 AssemblerBuffer buffer_; // Contains position independent code. | 735 AssemblerBuffer buffer_; // Contains position independent code. |
733 GrowableObjectArray& object_pool_; // Objects and patchable jump targets. | 736 GrowableObjectArray& object_pool_; // Objects and patchable jump targets. |
734 int32_t prologue_offset_; | 737 int32_t prologue_offset_; |
735 | 738 |
739 bool use_far_branches_; | |
srdjan
2013/07/31 22:52:27
const
zra
2013/08/01 00:28:32
Done.
| |
740 | |
736 int32_t AddObject(const Object& obj); | 741 int32_t AddObject(const Object& obj); |
737 int32_t AddExternalLabel(const ExternalLabel* label); | 742 int32_t AddExternalLabel(const ExternalLabel* label); |
738 | 743 |
739 class CodeComment : public ZoneAllocated { | 744 class CodeComment : public ZoneAllocated { |
740 public: | 745 public: |
741 CodeComment(intptr_t pc_offset, const String& comment) | 746 CodeComment(intptr_t pc_offset, const String& comment) |
742 : pc_offset_(pc_offset), comment_(comment) { } | 747 : pc_offset_(pc_offset), comment_(comment) { } |
743 | 748 |
744 intptr_t pc_offset() const { return pc_offset_; } | 749 intptr_t pc_offset() const { return pc_offset_; } |
745 const String& comment() const { return comment_; } | 750 const String& comment() const { return comment_; } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
842 SRegister sm); | 847 SRegister sm); |
843 | 848 |
844 void EmitSIMDqqq(int32_t opcode, OperandSize sz, | 849 void EmitSIMDqqq(int32_t opcode, OperandSize sz, |
845 QRegister qd, QRegister qn, QRegister qm); | 850 QRegister qd, QRegister qn, QRegister qm); |
846 | 851 |
847 void EmitSIMDddd(int32_t opcode, OperandSize sz, | 852 void EmitSIMDddd(int32_t opcode, OperandSize sz, |
848 DRegister dd, DRegister dn, DRegister dm); | 853 DRegister dd, DRegister dn, DRegister dm); |
849 | 854 |
850 void EmitFarBranch(Condition cond, int32_t offset, bool link); | 855 void EmitFarBranch(Condition cond, int32_t offset, bool link); |
851 void EmitBranch(Condition cond, Label* label, bool link); | 856 void EmitBranch(Condition cond, Label* label, bool link); |
852 static int32_t EncodeBranchOffset(int32_t offset, int32_t inst); | 857 int32_t EncodeBranchOffset(int32_t offset, int32_t inst); |
853 static int DecodeBranchOffset(int32_t inst); | 858 static int DecodeBranchOffset(int32_t inst); |
854 int32_t EncodeTstOffset(int32_t offset, int32_t inst); | 859 int32_t EncodeTstOffset(int32_t offset, int32_t inst); |
855 int DecodeTstOffset(int32_t inst); | 860 int DecodeTstOffset(int32_t inst); |
856 | 861 |
857 void StoreIntoObjectFilter(Register object, Register value, Label* no_update); | 862 void StoreIntoObjectFilter(Register object, Register value, Label* no_update); |
858 | 863 |
859 // Shorter filtering sequence that assumes that value is not a smi. | 864 // Shorter filtering sequence that assumes that value is not a smi. |
860 void StoreIntoObjectFilterNoSmi(Register object, | 865 void StoreIntoObjectFilterNoSmi(Register object, |
861 Register value, | 866 Register value, |
862 Label* no_update); | 867 Label* no_update); |
863 | 868 |
864 DISALLOW_ALLOCATION(); | 869 DISALLOW_ALLOCATION(); |
865 DISALLOW_COPY_AND_ASSIGN(Assembler); | 870 DISALLOW_COPY_AND_ASSIGN(Assembler); |
866 }; | 871 }; |
867 | 872 |
868 } // namespace dart | 873 } // namespace dart |
869 | 874 |
870 #endif // VM_ASSEMBLER_ARM_H_ | 875 #endif // VM_ASSEMBLER_ARM_H_ |
OLD | NEW |