OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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_PRECOMPILER_H_ | 5 #ifndef VM_PRECOMPILER_H_ |
6 #define VM_PRECOMPILER_H_ | 6 #define VM_PRECOMPILER_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/hash_map.h" | 9 #include "vm/hash_map.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // Typedefs needed for the DirectChainedHashMap template. | 69 // Typedefs needed for the DirectChainedHashMap template. |
70 typedef const Function* Key; | 70 typedef const Function* Key; |
71 typedef const Function* Value; | 71 typedef const Function* Value; |
72 typedef const Function* Pair; | 72 typedef const Function* Pair; |
73 | 73 |
74 static Key KeyOf(Pair kv) { return kv; } | 74 static Key KeyOf(Pair kv) { return kv; } |
75 | 75 |
76 static Value ValueOf(Pair kv) { return kv; } | 76 static Value ValueOf(Pair kv) { return kv; } |
77 | 77 |
78 static inline intptr_t Hashcode(Key key) { | 78 static inline intptr_t Hashcode(Key key) { |
79 return key->token_pos(); | 79 return key->token_pos().value(); |
80 } | 80 } |
81 | 81 |
82 static inline bool IsKeyEqual(Pair pair, Key key) { | 82 static inline bool IsKeyEqual(Pair pair, Key key) { |
83 return pair->raw() == key->raw(); | 83 return pair->raw() == key->raw(); |
84 } | 84 } |
85 }; | 85 }; |
86 | 86 |
87 typedef DirectChainedHashMap<FunctionKeyValueTrait> FunctionSet; | 87 typedef DirectChainedHashMap<FunctionKeyValueTrait> FunctionSet; |
88 | 88 |
89 | 89 |
90 class FieldKeyValueTrait { | 90 class FieldKeyValueTrait { |
91 public: | 91 public: |
92 // Typedefs needed for the DirectChainedHashMap template. | 92 // Typedefs needed for the DirectChainedHashMap template. |
93 typedef const Field* Key; | 93 typedef const Field* Key; |
94 typedef const Field* Value; | 94 typedef const Field* Value; |
95 typedef const Field* Pair; | 95 typedef const Field* Pair; |
96 | 96 |
97 static Key KeyOf(Pair kv) { return kv; } | 97 static Key KeyOf(Pair kv) { return kv; } |
98 | 98 |
99 static Value ValueOf(Pair kv) { return kv; } | 99 static Value ValueOf(Pair kv) { return kv; } |
100 | 100 |
101 static inline intptr_t Hashcode(Key key) { | 101 static inline intptr_t Hashcode(Key key) { |
102 return key->token_pos(); | 102 return key->token_pos().value(); |
103 } | 103 } |
104 | 104 |
105 static inline bool IsKeyEqual(Pair pair, Key key) { | 105 static inline bool IsKeyEqual(Pair pair, Key key) { |
106 return pair->raw() == key->raw(); | 106 return pair->raw() == key->raw(); |
107 } | 107 } |
108 }; | 108 }; |
109 | 109 |
110 typedef DirectChainedHashMap<FieldKeyValueTrait> FieldSet; | 110 typedef DirectChainedHashMap<FieldKeyValueTrait> FieldSet; |
111 | 111 |
112 | 112 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 const GrowableObjectArray& pending_functions_; | 185 const GrowableObjectArray& pending_functions_; |
186 SymbolSet sent_selectors_; | 186 SymbolSet sent_selectors_; |
187 FunctionSet enqueued_functions_; | 187 FunctionSet enqueued_functions_; |
188 FieldSet fields_to_retain_; | 188 FieldSet fields_to_retain_; |
189 Error& error_; | 189 Error& error_; |
190 }; | 190 }; |
191 | 191 |
192 } // namespace dart | 192 } // namespace dart |
193 | 193 |
194 #endif // VM_PRECOMPILER_H_ | 194 #endif // VM_PRECOMPILER_H_ |
OLD | NEW |