OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 RUNTIME_VM_ASSEMBLER_DBC_H_ | 5 #ifndef RUNTIME_VM_ASSEMBLER_DBC_H_ |
6 #define RUNTIME_VM_ASSEMBLER_DBC_H_ | 6 #define RUNTIME_VM_ASSEMBLER_DBC_H_ |
7 | 7 |
8 #ifndef RUNTIME_VM_ASSEMBLER_H_ | 8 #ifndef RUNTIME_VM_ASSEMBLER_H_ |
9 #error Do not include assembler_dbc.h directly; use assembler.h instead. | 9 #error Do not include assembler_dbc.h directly; use assembler.h instead. |
10 #endif | 10 #endif |
11 | 11 |
12 #include "platform/assert.h" | 12 #include "platform/assert.h" |
13 #include "platform/utils.h" | 13 #include "platform/utils.h" |
14 #include "vm/constants_dbc.h" | 14 #include "vm/constants_dbc.h" |
15 #include "vm/cpu.h" | 15 #include "vm/cpu.h" |
16 #include "vm/hash_map.h" | 16 #include "vm/hash_map.h" |
17 #include "vm/object.h" | 17 #include "vm/object.h" |
18 #include "vm/simulator.h" | 18 #include "vm/simulator.h" |
19 | 19 |
20 namespace dart { | 20 namespace dart { |
21 | 21 |
22 | |
23 // Dummy declaration to make things compile. | 22 // Dummy declaration to make things compile. |
24 class Address : public ValueObject { | 23 class Address : public ValueObject { |
25 private: | 24 private: |
26 Address(); | 25 Address(); |
27 }; | 26 }; |
28 | 27 |
29 | |
30 class Label : public ValueObject { | 28 class Label : public ValueObject { |
31 public: | 29 public: |
32 Label() : position_(0) {} | 30 Label() : position_(0) {} |
33 | 31 |
34 ~Label() { | 32 ~Label() { |
35 // Assert if label is being destroyed with unresolved branches pending. | 33 // Assert if label is being destroyed with unresolved branches pending. |
36 ASSERT(!IsLinked()); | 34 ASSERT(!IsLinked()); |
37 } | 35 } |
38 | 36 |
39 // Returns the position for bound and linked labels. Cannot be used | 37 // Returns the position for bound and linked labels. Cannot be used |
(...skipping 21 matching lines...) Expand all Loading... |
61 void LinkTo(intptr_t position) { | 59 void LinkTo(intptr_t position) { |
62 ASSERT(!IsBound()); | 60 ASSERT(!IsBound()); |
63 position_ = position + kWordSize; | 61 position_ = position + kWordSize; |
64 ASSERT(IsLinked()); | 62 ASSERT(IsLinked()); |
65 } | 63 } |
66 | 64 |
67 friend class Assembler; | 65 friend class Assembler; |
68 DISALLOW_COPY_AND_ASSIGN(Label); | 66 DISALLOW_COPY_AND_ASSIGN(Label); |
69 }; | 67 }; |
70 | 68 |
71 | |
72 class Assembler : public ValueObject { | 69 class Assembler : public ValueObject { |
73 public: | 70 public: |
74 explicit Assembler(bool use_far_branches = false) : buffer_(), comments_() {} | 71 explicit Assembler(bool use_far_branches = false) : buffer_(), comments_() {} |
75 | 72 |
76 ~Assembler() {} | 73 ~Assembler() {} |
77 | 74 |
78 void Bind(Label* label); | 75 void Bind(Label* label); |
79 void Jump(Label* label); | 76 void Jump(Label* label); |
80 | 77 |
81 // Misc. functionality | 78 // Misc. functionality |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 128 |
132 #define PARAMS_0 | 129 #define PARAMS_0 |
133 #define PARAMS_A_D uintptr_t ra, uintptr_t rd | 130 #define PARAMS_A_D uintptr_t ra, uintptr_t rd |
134 #define PARAMS_D uintptr_t rd | 131 #define PARAMS_D uintptr_t rd |
135 #define PARAMS_A_B_C uintptr_t ra, uintptr_t rb, uintptr_t rc | 132 #define PARAMS_A_B_C uintptr_t ra, uintptr_t rb, uintptr_t rc |
136 #define PARAMS_A uintptr_t ra | 133 #define PARAMS_A uintptr_t ra |
137 #define PARAMS_X intptr_t x | 134 #define PARAMS_X intptr_t x |
138 #define PARAMS_T intptr_t x | 135 #define PARAMS_T intptr_t x |
139 #define PARAMS_A_X uintptr_t ra, intptr_t x | 136 #define PARAMS_A_X uintptr_t ra, intptr_t x |
140 | 137 |
141 | |
142 BYTECODES_LIST(DECLARE_EMIT) | 138 BYTECODES_LIST(DECLARE_EMIT) |
143 | 139 |
144 #undef PARAMS_0 | 140 #undef PARAMS_0 |
145 #undef PARAMS_A_D | 141 #undef PARAMS_A_D |
146 #undef PARAMS_D | 142 #undef PARAMS_D |
147 #undef PARAMS_A_B_C | 143 #undef PARAMS_A_B_C |
148 #undef PARAMS_A | 144 #undef PARAMS_A |
149 #undef PARAMS_X | 145 #undef PARAMS_X |
150 #undef PARAMS_T | 146 #undef PARAMS_T |
151 #undef PARAMS_A_X | 147 #undef PARAMS_A_X |
(...skipping 26 matching lines...) Expand all Loading... |
178 | 174 |
179 DISALLOW_COPY_AND_ASSIGN(CodeComment); | 175 DISALLOW_COPY_AND_ASSIGN(CodeComment); |
180 }; | 176 }; |
181 | 177 |
182 GrowableArray<CodeComment*> comments_; | 178 GrowableArray<CodeComment*> comments_; |
183 | 179 |
184 DISALLOW_ALLOCATION(); | 180 DISALLOW_ALLOCATION(); |
185 DISALLOW_COPY_AND_ASSIGN(Assembler); | 181 DISALLOW_COPY_AND_ASSIGN(Assembler); |
186 }; | 182 }; |
187 | 183 |
188 | |
189 } // namespace dart | 184 } // namespace dart |
190 | 185 |
191 #endif // RUNTIME_VM_ASSEMBLER_DBC_H_ | 186 #endif // RUNTIME_VM_ASSEMBLER_DBC_H_ |
OLD | NEW |