| 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" |
| 11 #include "vm/growable_array.h" | 11 #include "vm/growable_array.h" |
| 12 #include "vm/hash_map.h" |
| 12 #include "vm/object.h" | 13 #include "vm/object.h" |
| 13 | 14 |
| 14 namespace dart { | 15 namespace dart { |
| 15 | 16 |
| 16 #if defined(TARGET_ARCH_ARM) || \ | 17 #if defined(TARGET_ARCH_ARM) || \ |
| 17 defined(TARGET_ARCH_ARM64) || \ | 18 defined(TARGET_ARCH_ARM64) || \ |
| 18 defined(TARGET_ARCH_MIPS) | 19 defined(TARGET_ARCH_MIPS) |
| 19 DECLARE_FLAG(bool, use_far_branches); | 20 DECLARE_FLAG(bool, use_far_branches); |
| 20 #endif | 21 #endif |
| 21 | 22 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 250 |
| 250 static inline bool IsKeyEqual(Pair kv, Key key) { | 251 static inline bool IsKeyEqual(Pair kv, Key key) { |
| 251 return kv.key_->raw() == key->raw(); | 252 return kv.key_->raw() == key->raw(); |
| 252 } | 253 } |
| 253 | 254 |
| 254 private: | 255 private: |
| 255 Key key_; | 256 Key key_; |
| 256 Value value_; | 257 Value value_; |
| 257 }; | 258 }; |
| 258 | 259 |
| 260 |
| 261 enum Patchability { |
| 262 kPatchable, |
| 263 kNotPatchable, |
| 264 }; |
| 265 |
| 266 |
| 267 class ObjectPool : public ValueObject { |
| 268 public: |
| 269 ObjectPool() : object_pool_(GrowableObjectArray::Handle()) { } |
| 270 |
| 271 intptr_t AddObject(const Object& obj, Patchability patchable); |
| 272 intptr_t AddExternalLabel(const ExternalLabel* label, |
| 273 Patchability patchable); |
| 274 |
| 275 intptr_t FindObject(const Object& obj, Patchability patchable); |
| 276 intptr_t FindExternalLabel(const ExternalLabel* label, |
| 277 Patchability patchable); |
| 278 const GrowableObjectArray& data() const { return object_pool_; } |
| 279 private: |
| 280 // Objects and jump targets. |
| 281 GrowableObjectArray& object_pool_; |
| 282 |
| 283 // Patchability of pool entries. |
| 284 GrowableArray<Patchability> patchable_pool_entries_; |
| 285 |
| 286 // Hashmap for fast lookup in object pool. |
| 287 DirectChainedHashMap<ObjIndexPair> object_pool_index_table_; |
| 288 }; |
| 289 |
| 259 } // namespace dart | 290 } // namespace dart |
| 260 | 291 |
| 261 | 292 |
| 262 #if defined(TARGET_ARCH_IA32) | 293 #if defined(TARGET_ARCH_IA32) |
| 263 #include "vm/assembler_ia32.h" | 294 #include "vm/assembler_ia32.h" |
| 264 #elif defined(TARGET_ARCH_X64) | 295 #elif defined(TARGET_ARCH_X64) |
| 265 #include "vm/assembler_x64.h" | 296 #include "vm/assembler_x64.h" |
| 266 #elif defined(TARGET_ARCH_ARM) | 297 #elif defined(TARGET_ARCH_ARM) |
| 267 #include "vm/assembler_arm.h" | 298 #include "vm/assembler_arm.h" |
| 268 #elif defined(TARGET_ARCH_ARM64) | 299 #elif defined(TARGET_ARCH_ARM64) |
| 269 #include "vm/assembler_arm64.h" | 300 #include "vm/assembler_arm64.h" |
| 270 #elif defined(TARGET_ARCH_MIPS) | 301 #elif defined(TARGET_ARCH_MIPS) |
| 271 #include "vm/assembler_mips.h" | 302 #include "vm/assembler_mips.h" |
| 272 #else | 303 #else |
| 273 #error Unknown architecture. | 304 #error Unknown architecture. |
| 274 #endif | 305 #endif |
| 275 | 306 |
| 276 #endif // VM_ASSEMBLER_H_ | 307 #endif // VM_ASSEMBLER_H_ |
| OLD | NEW |