| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 AssemblerBuffer(); | 73 AssemblerBuffer(); |
| 74 ~AssemblerBuffer(); | 74 ~AssemblerBuffer(); |
| 75 | 75 |
| 76 // Basic support for emitting, loading, and storing. | 76 // Basic support for emitting, loading, and storing. |
| 77 template<typename T> void Emit(T value) { | 77 template<typename T> void Emit(T value) { |
| 78 ASSERT(HasEnsuredCapacity()); | 78 ASSERT(HasEnsuredCapacity()); |
| 79 *reinterpret_cast<T*>(cursor_) = value; | 79 *reinterpret_cast<T*>(cursor_) = value; |
| 80 cursor_ += sizeof(T); | 80 cursor_ += sizeof(T); |
| 81 } | 81 } |
| 82 | 82 |
| 83 template<typename T> void Remit() { |
| 84 ASSERT(Size() >= static_cast<intptr_t>(sizeof(T))); |
| 85 cursor_ -= sizeof(T); |
| 86 } |
| 87 |
| 83 template<typename T> T Load(int position) { | 88 template<typename T> T Load(int position) { |
| 84 ASSERT(position >= 0 && position <= (Size() - static_cast<int>(sizeof(T)))); | 89 ASSERT(position >= 0 && position <= (Size() - static_cast<int>(sizeof(T)))); |
| 85 return *reinterpret_cast<T*>(contents_ + position); | 90 return *reinterpret_cast<T*>(contents_ + position); |
| 86 } | 91 } |
| 87 | 92 |
| 88 template<typename T> void Store(int position, T value) { | 93 template<typename T> void Store(int position, T value) { |
| 89 ASSERT(position >= 0 && position <= (Size() - static_cast<int>(sizeof(T)))); | 94 ASSERT(position >= 0 && position <= (Size() - static_cast<int>(sizeof(T)))); |
| 90 *reinterpret_cast<T*>(contents_ + position) = value; | 95 *reinterpret_cast<T*>(contents_ + position) = value; |
| 91 } | 96 } |
| 92 | 97 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 #include "vm/assembler_x64.h" | 205 #include "vm/assembler_x64.h" |
| 201 #elif defined(TARGET_ARCH_ARM) | 206 #elif defined(TARGET_ARCH_ARM) |
| 202 #include "vm/assembler_arm.h" | 207 #include "vm/assembler_arm.h" |
| 203 #elif defined(TARGET_ARCH_MIPS) | 208 #elif defined(TARGET_ARCH_MIPS) |
| 204 #include "vm/assembler_mips.h" | 209 #include "vm/assembler_mips.h" |
| 205 #else | 210 #else |
| 206 #error Unknown architecture. | 211 #error Unknown architecture. |
| 207 #endif | 212 #endif |
| 208 | 213 |
| 209 #endif // VM_ASSEMBLER_H_ | 214 #endif // VM_ASSEMBLER_H_ |
| OLD | NEW |