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/hash_table.h" | 10 #include "vm/hash_table.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 } | 150 } |
151 | 151 |
152 static inline bool IsKeyEqual(Pair pair, Key key) { | 152 static inline bool IsKeyEqual(Pair pair, Key key) { |
153 return pair->Equals(*key); | 153 return pair->Equals(*key); |
154 } | 154 } |
155 }; | 155 }; |
156 | 156 |
157 typedef DirectChainedHashMap<InstructionsKeyValueTrait> InstructionsSet; | 157 typedef DirectChainedHashMap<InstructionsKeyValueTrait> InstructionsSet; |
158 | 158 |
159 | 159 |
| 160 class UnlinkedCallKeyValueTrait { |
| 161 public: |
| 162 // Typedefs needed for the DirectChainedHashMap template. |
| 163 typedef const UnlinkedCall* Key; |
| 164 typedef const UnlinkedCall* Value; |
| 165 typedef const UnlinkedCall* Pair; |
| 166 |
| 167 static Key KeyOf(Pair kv) { return kv; } |
| 168 |
| 169 static Value ValueOf(Pair kv) { return kv; } |
| 170 |
| 171 static inline intptr_t Hashcode(Key key) { |
| 172 return String::Handle(key->target_name()).Hash(); |
| 173 } |
| 174 |
| 175 static inline bool IsKeyEqual(Pair pair, Key key) { |
| 176 return (pair->target_name() == key->target_name()) && |
| 177 (pair->args_descriptor() == key->args_descriptor()); |
| 178 } |
| 179 }; |
| 180 |
| 181 typedef DirectChainedHashMap<UnlinkedCallKeyValueTrait> UnlinkedCallSet; |
| 182 |
| 183 |
160 class FunctionKeyValueTrait { | 184 class FunctionKeyValueTrait { |
161 public: | 185 public: |
162 // Typedefs needed for the DirectChainedHashMap template. | 186 // Typedefs needed for the DirectChainedHashMap template. |
163 typedef const Function* Key; | 187 typedef const Function* Key; |
164 typedef const Function* Value; | 188 typedef const Function* Value; |
165 typedef const Function* Pair; | 189 typedef const Function* Pair; |
166 | 190 |
167 static Key KeyOf(Pair kv) { return kv; } | 191 static Key KeyOf(Pair kv) { return kv; } |
168 | 192 |
169 static Value ValueOf(Pair kv) { return kv; } | 193 static Value ValueOf(Pair kv) { return kv; } |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 return function.raw(); | 495 return function.raw(); |
472 } | 496 } |
473 }; | 497 }; |
474 | 498 |
475 typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet; | 499 typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet; |
476 | 500 |
477 | 501 |
478 } // namespace dart | 502 } // namespace dart |
479 | 503 |
480 #endif // VM_PRECOMPILER_H_ | 504 #endif // VM_PRECOMPILER_H_ |
OLD | NEW |