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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // Typedefs needed for the DirectChainedHashMap template. | 101 // Typedefs needed for the DirectChainedHashMap template. |
102 typedef const Function* Key; | 102 typedef const Function* Key; |
103 typedef const Function* Value; | 103 typedef const Function* Value; |
104 typedef const Function* Pair; | 104 typedef const Function* Pair; |
105 | 105 |
106 static Key KeyOf(Pair kv) { return kv; } | 106 static Key KeyOf(Pair kv) { return kv; } |
107 | 107 |
108 static Value ValueOf(Pair kv) { return kv; } | 108 static Value ValueOf(Pair kv) { return kv; } |
109 | 109 |
110 static inline intptr_t Hashcode(Key key) { | 110 static inline intptr_t Hashcode(Key key) { |
111 return key->token_pos(); | 111 return key->token_pos().value(); |
112 } | 112 } |
113 | 113 |
114 static inline bool IsKeyEqual(Pair pair, Key key) { | 114 static inline bool IsKeyEqual(Pair pair, Key key) { |
115 return pair->raw() == key->raw(); | 115 return pair->raw() == key->raw(); |
116 } | 116 } |
117 }; | 117 }; |
118 | 118 |
119 typedef DirectChainedHashMap<FunctionKeyValueTrait> FunctionSet; | 119 typedef DirectChainedHashMap<FunctionKeyValueTrait> FunctionSet; |
120 | 120 |
121 | 121 |
122 class FieldKeyValueTrait { | 122 class FieldKeyValueTrait { |
123 public: | 123 public: |
124 // Typedefs needed for the DirectChainedHashMap template. | 124 // Typedefs needed for the DirectChainedHashMap template. |
125 typedef const Field* Key; | 125 typedef const Field* Key; |
126 typedef const Field* Value; | 126 typedef const Field* Value; |
127 typedef const Field* Pair; | 127 typedef const Field* Pair; |
128 | 128 |
129 static Key KeyOf(Pair kv) { return kv; } | 129 static Key KeyOf(Pair kv) { return kv; } |
130 | 130 |
131 static Value ValueOf(Pair kv) { return kv; } | 131 static Value ValueOf(Pair kv) { return kv; } |
132 | 132 |
133 static inline intptr_t Hashcode(Key key) { | 133 static inline intptr_t Hashcode(Key key) { |
134 return key->token_pos(); | 134 return key->token_pos().value(); |
135 } | 135 } |
136 | 136 |
137 static inline bool IsKeyEqual(Pair pair, Key key) { | 137 static inline bool IsKeyEqual(Pair pair, Key key) { |
138 return pair->raw() == key->raw(); | 138 return pair->raw() == key->raw(); |
139 } | 139 } |
140 }; | 140 }; |
141 | 141 |
142 typedef DirectChainedHashMap<FieldKeyValueTrait> FieldSet; | 142 typedef DirectChainedHashMap<FieldKeyValueTrait> FieldSet; |
143 | 143 |
144 | 144 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 const GrowableObjectArray& pending_functions_; | 218 const GrowableObjectArray& pending_functions_; |
219 SymbolSet sent_selectors_; | 219 SymbolSet sent_selectors_; |
220 FunctionSet enqueued_functions_; | 220 FunctionSet enqueued_functions_; |
221 FieldSet fields_to_retain_; | 221 FieldSet fields_to_retain_; |
222 Error& error_; | 222 Error& error_; |
223 }; | 223 }; |
224 | 224 |
225 } // namespace dart | 225 } // namespace dart |
226 | 226 |
227 #endif // VM_PRECOMPILER_H_ | 227 #endif // VM_PRECOMPILER_H_ |
OLD | NEW |