OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_H_ | 5 #ifndef VM_ASSEMBLER_H_ |
6 #define VM_ASSEMBLER_H_ | 6 #define VM_ASSEMBLER_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 168 |
169 // When building the C++ tests, assertion code is enabled. To allow | 169 // When building the C++ tests, assertion code is enabled. To allow |
170 // asserting that the user of the assembler buffer has ensured the | 170 // asserting that the user of the assembler buffer has ensured the |
171 // capacity needed for emitting, we add a dummy method in non-debug mode. | 171 // capacity needed for emitting, we add a dummy method in non-debug mode. |
172 bool HasEnsuredCapacity() const { return true; } | 172 bool HasEnsuredCapacity() const { return true; } |
173 #endif | 173 #endif |
174 | 174 |
175 // Returns the position in the instruction stream. | 175 // Returns the position in the instruction stream. |
176 intptr_t GetPosition() const { return cursor_ - contents_; } | 176 intptr_t GetPosition() const { return cursor_ - contents_; } |
177 | 177 |
| 178 void Reset() { cursor_ = contents_; } |
| 179 |
178 private: | 180 private: |
179 // The limit is set to kMinimumGap bytes before the end of the data area. | 181 // The limit is set to kMinimumGap bytes before the end of the data area. |
180 // This leaves enough space for the longest possible instruction and allows | 182 // This leaves enough space for the longest possible instruction and allows |
181 // for a single, fast space check per instruction. | 183 // for a single, fast space check per instruction. |
182 static const intptr_t kMinimumGap = 32; | 184 static const intptr_t kMinimumGap = 32; |
183 | 185 |
184 uword contents_; | 186 uword contents_; |
185 uword cursor_; | 187 uword cursor_; |
186 uword limit_; | 188 uword limit_; |
187 AssemblerFixup* fixup_; | 189 AssemblerFixup* fixup_; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 #include "vm/assembler_arm64.h" | 342 #include "vm/assembler_arm64.h" |
341 #elif defined(TARGET_ARCH_MIPS) | 343 #elif defined(TARGET_ARCH_MIPS) |
342 #include "vm/assembler_mips.h" | 344 #include "vm/assembler_mips.h" |
343 #elif defined(TARGET_ARCH_DBC) | 345 #elif defined(TARGET_ARCH_DBC) |
344 #include "vm/assembler_dbc.h" | 346 #include "vm/assembler_dbc.h" |
345 #else | 347 #else |
346 #error Unknown architecture. | 348 #error Unknown architecture. |
347 #endif | 349 #endif |
348 | 350 |
349 #endif // VM_ASSEMBLER_H_ | 351 #endif // VM_ASSEMBLER_H_ |
OLD | NEW |