| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 ASSERT(HasEnsuredCapacity()); | 82 ASSERT(HasEnsuredCapacity()); |
| 83 *reinterpret_cast<T*>(cursor_) = value; | 83 *reinterpret_cast<T*>(cursor_) = value; |
| 84 cursor_ += sizeof(T); | 84 cursor_ += sizeof(T); |
| 85 } | 85 } |
| 86 | 86 |
| 87 template<typename T> void Remit() { | 87 template<typename T> void Remit() { |
| 88 ASSERT(Size() >= static_cast<intptr_t>(sizeof(T))); | 88 ASSERT(Size() >= static_cast<intptr_t>(sizeof(T))); |
| 89 cursor_ -= sizeof(T); | 89 cursor_ -= sizeof(T); |
| 90 } | 90 } |
| 91 | 91 |
| 92 // Return address to code at |position| bytes. |
| 93 uword Address(intptr_t position) { |
| 94 return reinterpret_cast<uword>(contents_ + position); |
| 95 } |
| 96 |
| 92 template<typename T> T Load(intptr_t position) { | 97 template<typename T> T Load(intptr_t position) { |
| 93 ASSERT(position >= 0 && | 98 ASSERT(position >= 0 && |
| 94 position <= (Size() - static_cast<intptr_t>(sizeof(T)))); | 99 position <= (Size() - static_cast<intptr_t>(sizeof(T)))); |
| 95 return *reinterpret_cast<T*>(contents_ + position); | 100 return *reinterpret_cast<T*>(contents_ + position); |
| 96 } | 101 } |
| 97 | 102 |
| 98 template<typename T> void Store(intptr_t position, T value) { | 103 template<typename T> void Store(intptr_t position, T value) { |
| 99 ASSERT(position >= 0 && | 104 ASSERT(position >= 0 && |
| 100 position <= (Size() - static_cast<intptr_t>(sizeof(T)))); | 105 position <= (Size() - static_cast<intptr_t>(sizeof(T)))); |
| 101 *reinterpret_cast<T*>(contents_ + position) = value; | 106 *reinterpret_cast<T*>(contents_ + position) = value; |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 #include "vm/assembler_arm.h" | 304 #include "vm/assembler_arm.h" |
| 300 #elif defined(TARGET_ARCH_ARM64) | 305 #elif defined(TARGET_ARCH_ARM64) |
| 301 #include "vm/assembler_arm64.h" | 306 #include "vm/assembler_arm64.h" |
| 302 #elif defined(TARGET_ARCH_MIPS) | 307 #elif defined(TARGET_ARCH_MIPS) |
| 303 #include "vm/assembler_mips.h" | 308 #include "vm/assembler_mips.h" |
| 304 #else | 309 #else |
| 305 #error Unknown architecture. | 310 #error Unknown architecture. |
| 306 #endif | 311 #endif |
| 307 | 312 |
| 308 #endif // VM_ASSEMBLER_H_ | 313 #endif // VM_ASSEMBLER_H_ |
| OLD | NEW |