Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_X64_H_ | 5 #ifndef VM_ASSEMBLER_X64_H_ |
| 6 #define VM_ASSEMBLER_X64_H_ | 6 #define VM_ASSEMBLER_X64_H_ |
| 7 | 7 |
| 8 #ifndef VM_ASSEMBLER_H_ | 8 #ifndef VM_ASSEMBLER_H_ |
| 9 #error Do not include assembler_x64.h directly; use assembler.h instead. | 9 #error Do not include assembler_x64.h directly; use assembler.h instead. |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 #include "platform/assert.h" | 12 #include "platform/assert.h" |
| 13 #include "platform/utils.h" | 13 #include "platform/utils.h" |
| 14 #include "vm/constants_x64.h" | 14 #include "vm/constants_x64.h" |
| 15 #include "vm/hash_map.h" | |
| 15 | 16 |
| 16 namespace dart { | 17 namespace dart { |
| 17 | 18 |
| 18 // Forward declarations. | 19 // Forward declarations. |
| 19 class RuntimeEntry; | 20 class RuntimeEntry; |
| 20 | 21 |
| 21 class Immediate : public ValueObject { | 22 class Immediate : public ValueObject { |
| 22 public: | 23 public: |
| 23 explicit Immediate(int64_t value) : value_(value) { } | 24 explicit Immediate(int64_t value) : value_(value) { } |
| 24 | 25 |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 830 | 831 |
| 831 private: | 832 private: |
| 832 AssemblerBuffer buffer_; | 833 AssemblerBuffer buffer_; |
| 833 | 834 |
| 834 // Objects and jump targets. | 835 // Objects and jump targets. |
| 835 GrowableObjectArray& object_pool_; | 836 GrowableObjectArray& object_pool_; |
| 836 | 837 |
| 837 // Patchability of pool entries. | 838 // Patchability of pool entries. |
| 838 GrowableArray<Patchability> patchable_pool_entries_; | 839 GrowableArray<Patchability> patchable_pool_entries_; |
| 839 | 840 |
| 841 // Pair type parameter for DirectChainedHashMap. | |
| 842 class ObjIndexPair { | |
| 843 public: | |
| 844 typedef RawObject* Key; | |
|
Florian Schneider
2013/09/09 19:03:11
The hash map contains raw pointers, but won't be v
zra
2013/09/13 16:49:34
After discussion with Ivan and fixing up the asser
| |
| 845 typedef intptr_t Value; | |
| 846 typedef ObjIndexPair Pair; | |
| 847 | |
| 848 ObjIndexPair(Key key, Value value) : key_(key), value_(value) { } | |
| 849 | |
| 850 static Key KeyOf(Pair kv) { return kv.key_; } | |
| 851 | |
| 852 static Value ValueOf(Pair kv) { return kv.value_; } | |
| 853 | |
| 854 static intptr_t Hashcode(Key key) { | |
| 855 return String::Hash(reinterpret_cast<uint8_t*>(&key), sizeof(&key)); | |
| 856 } | |
| 857 | |
| 858 static inline bool IsKeyEqual(Pair kv, Key key) { | |
| 859 return kv.key_ == key; | |
| 860 } | |
| 861 | |
| 862 private: | |
| 863 Key key_; | |
| 864 Value value_; | |
| 865 }; | |
| 866 | |
| 867 // Hashmap for fast lookup in object pool. | |
| 868 DirectChainedHashMap<ObjIndexPair> object_pool_index_table_; | |
| 869 | |
| 840 int prologue_offset_; | 870 int prologue_offset_; |
| 841 | 871 |
| 842 class CodeComment : public ZoneAllocated { | 872 class CodeComment : public ZoneAllocated { |
| 843 public: | 873 public: |
| 844 CodeComment(intptr_t pc_offset, const String& comment) | 874 CodeComment(intptr_t pc_offset, const String& comment) |
| 845 : pc_offset_(pc_offset), comment_(comment) { } | 875 : pc_offset_(pc_offset), comment_(comment) { } |
| 846 | 876 |
| 847 intptr_t pc_offset() const { return pc_offset_; } | 877 intptr_t pc_offset() const { return pc_offset_; } |
| 848 const String& comment() const { return comment_; } | 878 const String& comment() const { return comment_; } |
| 849 | 879 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 981 } | 1011 } |
| 982 | 1012 |
| 983 | 1013 |
| 984 inline void Assembler::EmitOperandSizeOverride() { | 1014 inline void Assembler::EmitOperandSizeOverride() { |
| 985 EmitUint8(0x66); | 1015 EmitUint8(0x66); |
| 986 } | 1016 } |
| 987 | 1017 |
| 988 } // namespace dart | 1018 } // namespace dart |
| 989 | 1019 |
| 990 #endif // VM_ASSEMBLER_X64_H_ | 1020 #endif // VM_ASSEMBLER_X64_H_ |
| OLD | NEW |