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