| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 }; | 288 }; |
| 289 | 289 |
| 290 | 290 |
| 291 class Assembler : public ValueObject { | 291 class Assembler : public ValueObject { |
| 292 public: | 292 public: |
| 293 explicit Assembler(bool use_far_branches = false) | 293 explicit Assembler(bool use_far_branches = false) |
| 294 : buffer_(), | 294 : buffer_(), |
| 295 object_pool_(GrowableObjectArray::Handle()), | 295 object_pool_(GrowableObjectArray::Handle()), |
| 296 prologue_offset_(-1), | 296 prologue_offset_(-1), |
| 297 use_far_branches_(use_far_branches), | 297 use_far_branches_(use_far_branches), |
| 298 comments_() { } | 298 comments_(), |
| 299 allow_constant_pool_(true) { } |
| 300 |
| 299 ~Assembler() { } | 301 ~Assembler() { } |
| 300 | 302 |
| 301 void PopRegister(Register r) { Pop(r); } | 303 void PopRegister(Register r) { Pop(r); } |
| 302 | 304 |
| 303 void Bind(Label* label); | 305 void Bind(Label* label); |
| 304 | 306 |
| 305 // Misc. functionality | 307 // Misc. functionality |
| 306 intptr_t CodeSize() const { return buffer_.Size(); } | 308 intptr_t CodeSize() const { return buffer_.Size(); } |
| 307 intptr_t prologue_offset() const { return prologue_offset_; } | 309 intptr_t prologue_offset() const { return prologue_offset_; } |
| 308 | 310 |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 Register temp2); | 823 Register temp2); |
| 822 | 824 |
| 823 // Emit data (e.g encoded instruction or immediate) in instruction stream. | 825 // Emit data (e.g encoded instruction or immediate) in instruction stream. |
| 824 void Emit(int32_t value); | 826 void Emit(int32_t value); |
| 825 | 827 |
| 826 // On some other platforms, we draw a distinction between safe and unsafe | 828 // On some other platforms, we draw a distinction between safe and unsafe |
| 827 // smis. | 829 // smis. |
| 828 static bool IsSafe(const Object& object) { return true; } | 830 static bool IsSafe(const Object& object) { return true; } |
| 829 static bool IsSafeSmi(const Object& object) { return object.IsSmi(); } | 831 static bool IsSafeSmi(const Object& object) { return object.IsSmi(); } |
| 830 | 832 |
| 833 bool allow_constant_pool() const { |
| 834 return allow_constant_pool_; |
| 835 } |
| 836 void set_allow_constant_pool(bool b) { |
| 837 allow_constant_pool_ = b; |
| 838 } |
| 839 |
| 831 private: | 840 private: |
| 832 AssemblerBuffer buffer_; // Contains position independent code. | 841 AssemblerBuffer buffer_; // Contains position independent code. |
| 833 GrowableObjectArray& object_pool_; // Objects and patchable jump targets. | 842 GrowableObjectArray& object_pool_; // Objects and patchable jump targets. |
| 834 int32_t prologue_offset_; | 843 int32_t prologue_offset_; |
| 835 | 844 |
| 836 bool use_far_branches_; | 845 bool use_far_branches_; |
| 837 | 846 |
| 838 int32_t AddObject(const Object& obj); | 847 int32_t AddObject(const Object& obj); |
| 839 int32_t AddExternalLabel(const ExternalLabel* label); | 848 int32_t AddExternalLabel(const ExternalLabel* label); |
| 840 | 849 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 851 | 860 |
| 852 private: | 861 private: |
| 853 intptr_t pc_offset_; | 862 intptr_t pc_offset_; |
| 854 const String& comment_; | 863 const String& comment_; |
| 855 | 864 |
| 856 DISALLOW_COPY_AND_ASSIGN(CodeComment); | 865 DISALLOW_COPY_AND_ASSIGN(CodeComment); |
| 857 }; | 866 }; |
| 858 | 867 |
| 859 GrowableArray<CodeComment*> comments_; | 868 GrowableArray<CodeComment*> comments_; |
| 860 | 869 |
| 870 bool allow_constant_pool_; |
| 871 |
| 861 void EmitType01(Condition cond, | 872 void EmitType01(Condition cond, |
| 862 int type, | 873 int type, |
| 863 Opcode opcode, | 874 Opcode opcode, |
| 864 int set_cc, | 875 int set_cc, |
| 865 Register rn, | 876 Register rn, |
| 866 Register rd, | 877 Register rd, |
| 867 Operand o); | 878 Operand o); |
| 868 | 879 |
| 869 void EmitType5(Condition cond, int32_t offset, bool link); | 880 void EmitType5(Condition cond, int32_t offset, bool link); |
| 870 | 881 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 Register value, | 977 Register value, |
| 967 Label* no_update); | 978 Label* no_update); |
| 968 | 979 |
| 969 DISALLOW_ALLOCATION(); | 980 DISALLOW_ALLOCATION(); |
| 970 DISALLOW_COPY_AND_ASSIGN(Assembler); | 981 DISALLOW_COPY_AND_ASSIGN(Assembler); |
| 971 }; | 982 }; |
| 972 | 983 |
| 973 } // namespace dart | 984 } // namespace dart |
| 974 | 985 |
| 975 #endif // VM_ASSEMBLER_ARM_H_ | 986 #endif // VM_ASSEMBLER_ARM_H_ |
| OLD | NEW |