| 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 RUNTIME_VM_PRECOMPILER_H_ | 5 #ifndef RUNTIME_VM_PRECOMPILER_H_ |
| 6 #define RUNTIME_VM_PRECOMPILER_H_ | 6 #define RUNTIME_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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 public: | 62 public: |
| 63 // Typedefs needed for the DirectChainedHashMap template. | 63 // Typedefs needed for the DirectChainedHashMap template. |
| 64 typedef const String* Key; | 64 typedef const String* Key; |
| 65 typedef const String* Value; | 65 typedef const String* Value; |
| 66 typedef const String* Pair; | 66 typedef const String* Pair; |
| 67 | 67 |
| 68 static Key KeyOf(Pair kv) { return kv; } | 68 static Key KeyOf(Pair kv) { return kv; } |
| 69 | 69 |
| 70 static Value ValueOf(Pair kv) { return kv; } | 70 static Value ValueOf(Pair kv) { return kv; } |
| 71 | 71 |
| 72 static inline intptr_t Hashcode(Key key) { | 72 static inline intptr_t Hashcode(Key key) { return key->Hash(); } |
| 73 return key->Hash(); | |
| 74 } | |
| 75 | 73 |
| 76 static inline bool IsKeyEqual(Pair pair, Key key) { | 74 static inline bool IsKeyEqual(Pair pair, Key key) { |
| 77 return pair->raw() == key->raw(); | 75 return pair->raw() == key->raw(); |
| 78 } | 76 } |
| 79 }; | 77 }; |
| 80 | 78 |
| 81 typedef DirectChainedHashMap<SymbolKeyValueTrait> SymbolSet; | 79 typedef DirectChainedHashMap<SymbolKeyValueTrait> SymbolSet; |
| 82 | 80 |
| 83 class StackmapKeyValueTrait { | 81 class StackmapKeyValueTrait { |
| 84 public: | 82 public: |
| 85 // Typedefs needed for the DirectChainedHashMap template. | 83 // Typedefs needed for the DirectChainedHashMap template. |
| 86 typedef const Stackmap* Key; | 84 typedef const Stackmap* Key; |
| 87 typedef const Stackmap* Value; | 85 typedef const Stackmap* Value; |
| 88 typedef const Stackmap* Pair; | 86 typedef const Stackmap* Pair; |
| 89 | 87 |
| 90 static Key KeyOf(Pair kv) { return kv; } | 88 static Key KeyOf(Pair kv) { return kv; } |
| 91 | 89 |
| 92 static Value ValueOf(Pair kv) { return kv; } | 90 static Value ValueOf(Pair kv) { return kv; } |
| 93 | 91 |
| 94 static inline intptr_t Hashcode(Key key) { | 92 static inline intptr_t Hashcode(Key key) { return key->PcOffset(); } |
| 95 return key->PcOffset(); | |
| 96 } | |
| 97 | 93 |
| 98 static inline bool IsKeyEqual(Pair pair, Key key) { | 94 static inline bool IsKeyEqual(Pair pair, Key key) { |
| 99 return pair->Equals(*key); | 95 return pair->Equals(*key); |
| 100 } | 96 } |
| 101 }; | 97 }; |
| 102 | 98 |
| 103 typedef DirectChainedHashMap<StackmapKeyValueTrait> StackmapSet; | 99 typedef DirectChainedHashMap<StackmapKeyValueTrait> StackmapSet; |
| 104 | 100 |
| 105 | 101 |
| 106 class ArrayKeyValueTrait { | 102 class ArrayKeyValueTrait { |
| 107 public: | 103 public: |
| 108 // Typedefs needed for the DirectChainedHashMap template. | 104 // Typedefs needed for the DirectChainedHashMap template. |
| 109 typedef const Array* Key; | 105 typedef const Array* Key; |
| 110 typedef const Array* Value; | 106 typedef const Array* Value; |
| 111 typedef const Array* Pair; | 107 typedef const Array* Pair; |
| 112 | 108 |
| 113 static Key KeyOf(Pair kv) { return kv; } | 109 static Key KeyOf(Pair kv) { return kv; } |
| 114 | 110 |
| 115 static Value ValueOf(Pair kv) { return kv; } | 111 static Value ValueOf(Pair kv) { return kv; } |
| 116 | 112 |
| 117 static inline intptr_t Hashcode(Key key) { | 113 static inline intptr_t Hashcode(Key key) { return key->Length(); } |
| 118 return key->Length(); | |
| 119 } | |
| 120 | 114 |
| 121 static inline bool IsKeyEqual(Pair pair, Key key) { | 115 static inline bool IsKeyEqual(Pair pair, Key key) { |
| 122 if (pair->Length() != key->Length()) { | 116 if (pair->Length() != key->Length()) { |
| 123 return false; | 117 return false; |
| 124 } | 118 } |
| 125 for (intptr_t i = 0; i < pair->Length(); i++) { | 119 for (intptr_t i = 0; i < pair->Length(); i++) { |
| 126 if (pair->At(i) != key->At(i)) { | 120 if (pair->At(i) != key->At(i)) { |
| 127 return false; | 121 return false; |
| 128 } | 122 } |
| 129 } | 123 } |
| 130 return true; | 124 return true; |
| 131 } | 125 } |
| 132 }; | 126 }; |
| 133 | 127 |
| 134 typedef DirectChainedHashMap<ArrayKeyValueTrait> ArraySet; | 128 typedef DirectChainedHashMap<ArrayKeyValueTrait> ArraySet; |
| 135 | 129 |
| 136 | 130 |
| 137 class InstructionsKeyValueTrait { | 131 class InstructionsKeyValueTrait { |
| 138 public: | 132 public: |
| 139 // Typedefs needed for the DirectChainedHashMap template. | 133 // Typedefs needed for the DirectChainedHashMap template. |
| 140 typedef const Instructions* Key; | 134 typedef const Instructions* Key; |
| 141 typedef const Instructions* Value; | 135 typedef const Instructions* Value; |
| 142 typedef const Instructions* Pair; | 136 typedef const Instructions* Pair; |
| 143 | 137 |
| 144 static Key KeyOf(Pair kv) { return kv; } | 138 static Key KeyOf(Pair kv) { return kv; } |
| 145 | 139 |
| 146 static Value ValueOf(Pair kv) { return kv; } | 140 static Value ValueOf(Pair kv) { return kv; } |
| 147 | 141 |
| 148 static inline intptr_t Hashcode(Key key) { | 142 static inline intptr_t Hashcode(Key key) { return key->size(); } |
| 149 return key->size(); | |
| 150 } | |
| 151 | 143 |
| 152 static inline bool IsKeyEqual(Pair pair, Key key) { | 144 static inline bool IsKeyEqual(Pair pair, Key key) { |
| 153 return pair->Equals(*key); | 145 return pair->Equals(*key); |
| 154 } | 146 } |
| 155 }; | 147 }; |
| 156 | 148 |
| 157 typedef DirectChainedHashMap<InstructionsKeyValueTrait> InstructionsSet; | 149 typedef DirectChainedHashMap<InstructionsKeyValueTrait> InstructionsSet; |
| 158 | 150 |
| 159 | 151 |
| 160 class UnlinkedCallKeyValueTrait { | 152 class UnlinkedCallKeyValueTrait { |
| 161 public: | 153 public: |
| 162 // Typedefs needed for the DirectChainedHashMap template. | 154 // Typedefs needed for the DirectChainedHashMap template. |
| 163 typedef const UnlinkedCall* Key; | 155 typedef const UnlinkedCall* Key; |
| 164 typedef const UnlinkedCall* Value; | 156 typedef const UnlinkedCall* Value; |
| 165 typedef const UnlinkedCall* Pair; | 157 typedef const UnlinkedCall* Pair; |
| 166 | 158 |
| 167 static Key KeyOf(Pair kv) { return kv; } | 159 static Key KeyOf(Pair kv) { return kv; } |
| 168 | 160 |
| 169 static Value ValueOf(Pair kv) { return kv; } | 161 static Value ValueOf(Pair kv) { return kv; } |
| 170 | 162 |
| 171 static inline intptr_t Hashcode(Key key) { | 163 static inline intptr_t Hashcode(Key key) { |
| 172 return String::Handle(key->target_name()).Hash(); | 164 return String::Handle(key->target_name()).Hash(); |
| 173 } | 165 } |
| 174 | 166 |
| 175 static inline bool IsKeyEqual(Pair pair, Key key) { | 167 static inline bool IsKeyEqual(Pair pair, Key key) { |
| 176 return (pair->target_name() == key->target_name()) && | 168 return (pair->target_name() == key->target_name()) && |
| 177 (pair->args_descriptor() == key->args_descriptor()); | 169 (pair->args_descriptor() == key->args_descriptor()); |
| 178 } | 170 } |
| 179 }; | 171 }; |
| 180 | 172 |
| 181 typedef DirectChainedHashMap<UnlinkedCallKeyValueTrait> UnlinkedCallSet; | 173 typedef DirectChainedHashMap<UnlinkedCallKeyValueTrait> UnlinkedCallSet; |
| 182 | 174 |
| 183 | 175 |
| 184 class FunctionKeyValueTrait { | 176 class FunctionKeyValueTrait { |
| 185 public: | 177 public: |
| 186 // Typedefs needed for the DirectChainedHashMap template. | 178 // Typedefs needed for the DirectChainedHashMap template. |
| 187 typedef const Function* Key; | 179 typedef const Function* Key; |
| 188 typedef const Function* Value; | 180 typedef const Function* Value; |
| 189 typedef const Function* Pair; | 181 typedef const Function* Pair; |
| 190 | 182 |
| 191 static Key KeyOf(Pair kv) { return kv; } | 183 static Key KeyOf(Pair kv) { return kv; } |
| 192 | 184 |
| 193 static Value ValueOf(Pair kv) { return kv; } | 185 static Value ValueOf(Pair kv) { return kv; } |
| 194 | 186 |
| 195 static inline intptr_t Hashcode(Key key) { | 187 static inline intptr_t Hashcode(Key key) { return key->token_pos().value(); } |
| 196 return key->token_pos().value(); | |
| 197 } | |
| 198 | 188 |
| 199 static inline bool IsKeyEqual(Pair pair, Key key) { | 189 static inline bool IsKeyEqual(Pair pair, Key key) { |
| 200 return pair->raw() == key->raw(); | 190 return pair->raw() == key->raw(); |
| 201 } | 191 } |
| 202 }; | 192 }; |
| 203 | 193 |
| 204 typedef DirectChainedHashMap<FunctionKeyValueTrait> FunctionSet; | 194 typedef DirectChainedHashMap<FunctionKeyValueTrait> FunctionSet; |
| 205 | 195 |
| 206 | 196 |
| 207 class FieldKeyValueTrait { | 197 class FieldKeyValueTrait { |
| 208 public: | 198 public: |
| 209 // Typedefs needed for the DirectChainedHashMap template. | 199 // Typedefs needed for the DirectChainedHashMap template. |
| 210 typedef const Field* Key; | 200 typedef const Field* Key; |
| 211 typedef const Field* Value; | 201 typedef const Field* Value; |
| 212 typedef const Field* Pair; | 202 typedef const Field* Pair; |
| 213 | 203 |
| 214 static Key KeyOf(Pair kv) { return kv; } | 204 static Key KeyOf(Pair kv) { return kv; } |
| 215 | 205 |
| 216 static Value ValueOf(Pair kv) { return kv; } | 206 static Value ValueOf(Pair kv) { return kv; } |
| 217 | 207 |
| 218 static inline intptr_t Hashcode(Key key) { | 208 static inline intptr_t Hashcode(Key key) { return key->token_pos().value(); } |
| 219 return key->token_pos().value(); | |
| 220 } | |
| 221 | 209 |
| 222 static inline bool IsKeyEqual(Pair pair, Key key) { | 210 static inline bool IsKeyEqual(Pair pair, Key key) { |
| 223 return pair->raw() == key->raw(); | 211 return pair->raw() == key->raw(); |
| 224 } | 212 } |
| 225 }; | 213 }; |
| 226 | 214 |
| 227 typedef DirectChainedHashMap<FieldKeyValueTrait> FieldSet; | 215 typedef DirectChainedHashMap<FieldKeyValueTrait> FieldSet; |
| 228 | 216 |
| 229 | 217 |
| 230 class ClassKeyValueTrait { | 218 class ClassKeyValueTrait { |
| 231 public: | 219 public: |
| 232 // Typedefs needed for the DirectChainedHashMap template. | 220 // Typedefs needed for the DirectChainedHashMap template. |
| 233 typedef const Class* Key; | 221 typedef const Class* Key; |
| 234 typedef const Class* Value; | 222 typedef const Class* Value; |
| 235 typedef const Class* Pair; | 223 typedef const Class* Pair; |
| 236 | 224 |
| 237 static Key KeyOf(Pair kv) { return kv; } | 225 static Key KeyOf(Pair kv) { return kv; } |
| 238 | 226 |
| 239 static Value ValueOf(Pair kv) { return kv; } | 227 static Value ValueOf(Pair kv) { return kv; } |
| 240 | 228 |
| 241 static inline intptr_t Hashcode(Key key) { | 229 static inline intptr_t Hashcode(Key key) { return key->token_pos().value(); } |
| 242 return key->token_pos().value(); | |
| 243 } | |
| 244 | 230 |
| 245 static inline bool IsKeyEqual(Pair pair, Key key) { | 231 static inline bool IsKeyEqual(Pair pair, Key key) { |
| 246 return pair->raw() == key->raw(); | 232 return pair->raw() == key->raw(); |
| 247 } | 233 } |
| 248 }; | 234 }; |
| 249 | 235 |
| 250 typedef DirectChainedHashMap<ClassKeyValueTrait> ClassSet; | 236 typedef DirectChainedHashMap<ClassKeyValueTrait> ClassSet; |
| 251 | 237 |
| 252 | 238 |
| 253 class AbstractTypeKeyValueTrait { | 239 class AbstractTypeKeyValueTrait { |
| 254 public: | 240 public: |
| 255 // Typedefs needed for the DirectChainedHashMap template. | 241 // Typedefs needed for the DirectChainedHashMap template. |
| 256 typedef const AbstractType* Key; | 242 typedef const AbstractType* Key; |
| 257 typedef const AbstractType* Value; | 243 typedef const AbstractType* Value; |
| 258 typedef const AbstractType* Pair; | 244 typedef const AbstractType* Pair; |
| 259 | 245 |
| 260 static Key KeyOf(Pair kv) { return kv; } | 246 static Key KeyOf(Pair kv) { return kv; } |
| 261 | 247 |
| 262 static Value ValueOf(Pair kv) { return kv; } | 248 static Value ValueOf(Pair kv) { return kv; } |
| 263 | 249 |
| 264 static inline intptr_t Hashcode(Key key) { | 250 static inline intptr_t Hashcode(Key key) { return key->Hash(); } |
| 265 return key->Hash(); | |
| 266 } | |
| 267 | 251 |
| 268 static inline bool IsKeyEqual(Pair pair, Key key) { | 252 static inline bool IsKeyEqual(Pair pair, Key key) { |
| 269 return pair->raw() == key->raw(); | 253 return pair->raw() == key->raw(); |
| 270 } | 254 } |
| 271 }; | 255 }; |
| 272 | 256 |
| 273 typedef DirectChainedHashMap<AbstractTypeKeyValueTrait> AbstractTypeSet; | 257 typedef DirectChainedHashMap<AbstractTypeKeyValueTrait> AbstractTypeSet; |
| 274 | 258 |
| 275 | 259 |
| 276 class TypeArgumentsKeyValueTrait { | 260 class TypeArgumentsKeyValueTrait { |
| 277 public: | 261 public: |
| 278 // Typedefs needed for the DirectChainedHashMap template. | 262 // Typedefs needed for the DirectChainedHashMap template. |
| 279 typedef const TypeArguments* Key; | 263 typedef const TypeArguments* Key; |
| 280 typedef const TypeArguments* Value; | 264 typedef const TypeArguments* Value; |
| 281 typedef const TypeArguments* Pair; | 265 typedef const TypeArguments* Pair; |
| 282 | 266 |
| 283 static Key KeyOf(Pair kv) { return kv; } | 267 static Key KeyOf(Pair kv) { return kv; } |
| 284 | 268 |
| 285 static Value ValueOf(Pair kv) { return kv; } | 269 static Value ValueOf(Pair kv) { return kv; } |
| 286 | 270 |
| 287 static inline intptr_t Hashcode(Key key) { | 271 static inline intptr_t Hashcode(Key key) { return key->Hash(); } |
| 288 return key->Hash(); | |
| 289 } | |
| 290 | 272 |
| 291 static inline bool IsKeyEqual(Pair pair, Key key) { | 273 static inline bool IsKeyEqual(Pair pair, Key key) { |
| 292 return pair->raw() == key->raw(); | 274 return pair->raw() == key->raw(); |
| 293 } | 275 } |
| 294 }; | 276 }; |
| 295 | 277 |
| 296 typedef DirectChainedHashMap<TypeArgumentsKeyValueTrait> TypeArgumentsSet; | 278 typedef DirectChainedHashMap<TypeArgumentsKeyValueTrait> TypeArgumentsSet; |
| 297 | 279 |
| 298 | 280 |
| 299 class InstanceKeyValueTrait { | 281 class InstanceKeyValueTrait { |
| 300 public: | 282 public: |
| 301 // Typedefs needed for the DirectChainedHashMap template. | 283 // Typedefs needed for the DirectChainedHashMap template. |
| 302 typedef const Instance* Key; | 284 typedef const Instance* Key; |
| 303 typedef const Instance* Value; | 285 typedef const Instance* Value; |
| 304 typedef const Instance* Pair; | 286 typedef const Instance* Pair; |
| 305 | 287 |
| 306 static Key KeyOf(Pair kv) { return kv; } | 288 static Key KeyOf(Pair kv) { return kv; } |
| 307 | 289 |
| 308 static Value ValueOf(Pair kv) { return kv; } | 290 static Value ValueOf(Pair kv) { return kv; } |
| 309 | 291 |
| 310 static inline intptr_t Hashcode(Key key) { | 292 static inline intptr_t Hashcode(Key key) { return key->GetClassId(); } |
| 311 return key->GetClassId(); | |
| 312 } | |
| 313 | 293 |
| 314 static inline bool IsKeyEqual(Pair pair, Key key) { | 294 static inline bool IsKeyEqual(Pair pair, Key key) { |
| 315 return pair->raw() == key->raw(); | 295 return pair->raw() == key->raw(); |
| 316 } | 296 } |
| 317 }; | 297 }; |
| 318 | 298 |
| 319 typedef DirectChainedHashMap<InstanceKeyValueTrait> InstanceSet; | 299 typedef DirectChainedHashMap<InstanceKeyValueTrait> InstanceSet; |
| 320 | 300 |
| 321 | 301 |
| 322 struct FieldTypePair { | 302 struct FieldTypePair { |
| 323 // Typedefs needed for the DirectChainedHashMap template. | 303 // Typedefs needed for the DirectChainedHashMap template. |
| 324 typedef const Field* Key; | 304 typedef const Field* Key; |
| 325 typedef intptr_t Value; | 305 typedef intptr_t Value; |
| 326 typedef FieldTypePair Pair; | 306 typedef FieldTypePair Pair; |
| 327 | 307 |
| 328 static Key KeyOf(Pair kv) { return kv.field_; } | 308 static Key KeyOf(Pair kv) { return kv.field_; } |
| 329 | 309 |
| 330 static Value ValueOf(Pair kv) { return kv.cid_; } | 310 static Value ValueOf(Pair kv) { return kv.cid_; } |
| 331 | 311 |
| 332 static inline intptr_t Hashcode(Key key) { | 312 static inline intptr_t Hashcode(Key key) { return key->token_pos().value(); } |
| 333 return key->token_pos().value(); | |
| 334 } | |
| 335 | 313 |
| 336 static inline bool IsKeyEqual(Pair pair, Key key) { | 314 static inline bool IsKeyEqual(Pair pair, Key key) { |
| 337 return pair.field_->raw() == key->raw(); | 315 return pair.field_->raw() == key->raw(); |
| 338 } | 316 } |
| 339 | 317 |
| 340 FieldTypePair(const Field* f, intptr_t cid) : field_(f), cid_(cid) { } | 318 FieldTypePair(const Field* f, intptr_t cid) : field_(f), cid_(cid) {} |
| 341 | 319 |
| 342 FieldTypePair() : field_(NULL), cid_(-1) { } | 320 FieldTypePair() : field_(NULL), cid_(-1) {} |
| 343 | 321 |
| 344 void Print() const; | 322 void Print() const; |
| 345 | 323 |
| 346 const Field* field_; | 324 const Field* field_; |
| 347 intptr_t cid_; | 325 intptr_t cid_; |
| 348 }; | 326 }; |
| 349 | 327 |
| 350 typedef DirectChainedHashMap<FieldTypePair> FieldTypeMap; | 328 typedef DirectChainedHashMap<FieldTypePair> FieldTypeMap; |
| 351 | 329 |
| 352 | 330 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 366 static RawObject* ExecuteOnce(SequenceNode* fragment); | 344 static RawObject* ExecuteOnce(SequenceNode* fragment); |
| 367 | 345 |
| 368 static RawFunction* CompileStaticInitializer(const Field& field, | 346 static RawFunction* CompileStaticInitializer(const Field& field, |
| 369 bool compute_type); | 347 bool compute_type); |
| 370 | 348 |
| 371 // Returns true if get:runtimeType is not overloaded by any class. | 349 // Returns true if get:runtimeType is not overloaded by any class. |
| 372 bool get_runtime_type_is_unique() const { | 350 bool get_runtime_type_is_unique() const { |
| 373 return get_runtime_type_is_unique_; | 351 return get_runtime_type_is_unique_; |
| 374 } | 352 } |
| 375 | 353 |
| 376 FieldTypeMap* field_type_map() { | 354 FieldTypeMap* field_type_map() { return &field_type_map_; } |
| 377 return &field_type_map_; | |
| 378 } | |
| 379 | 355 |
| 380 private: | 356 private: |
| 381 Precompiler(Thread* thread, bool reset_fields); | 357 Precompiler(Thread* thread, bool reset_fields); |
| 382 | 358 |
| 383 void DoCompileAll(Dart_QualifiedFunctionName embedder_entry_points[]); | 359 void DoCompileAll(Dart_QualifiedFunctionName embedder_entry_points[]); |
| 384 void ClearAllCode(); | 360 void ClearAllCode(); |
| 385 void AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]); | 361 void AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]); |
| 386 void AddEntryPoints(Dart_QualifiedFunctionName entry_points[]); | 362 void AddEntryPoints(Dart_QualifiedFunctionName entry_points[]); |
| 387 void Iterate(); | 363 void Iterate(); |
| 388 | 364 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 void DedupStackmaps(); | 396 void DedupStackmaps(); |
| 421 void DedupLists(); | 397 void DedupLists(); |
| 422 void DedupInstructions(); | 398 void DedupInstructions(); |
| 423 void ResetPrecompilerState(); | 399 void ResetPrecompilerState(); |
| 424 | 400 |
| 425 void CollectDynamicFunctionNames(); | 401 void CollectDynamicFunctionNames(); |
| 426 | 402 |
| 427 void PrecompileStaticInitializers(); | 403 void PrecompileStaticInitializers(); |
| 428 void PrecompileConstructors(); | 404 void PrecompileConstructors(); |
| 429 | 405 |
| 430 template<typename T> | 406 template <typename T> |
| 431 class Visitor : public ValueObject { | 407 class Visitor : public ValueObject { |
| 432 public: | 408 public: |
| 433 virtual ~Visitor() {} | 409 virtual ~Visitor() {} |
| 434 virtual void Visit(const T& obj) = 0; | 410 virtual void Visit(const T& obj) = 0; |
| 435 }; | 411 }; |
| 436 typedef Visitor<Function> FunctionVisitor; | 412 typedef Visitor<Function> FunctionVisitor; |
| 437 typedef Visitor<Class> ClassVisitor; | 413 typedef Visitor<Class> ClassVisitor; |
| 438 | 414 |
| 439 void VisitFunctions(FunctionVisitor* visitor); | 415 void VisitFunctions(FunctionVisitor* visitor); |
| 440 void VisitClasses(ClassVisitor* visitor); | 416 void VisitClasses(ClassVisitor* visitor); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 return a_s.raw() == b_s.raw(); | 472 return a_s.raw() == b_s.raw(); |
| 497 } | 473 } |
| 498 static uword Hash(const Object& obj) { | 474 static uword Hash(const Object& obj) { |
| 499 if (obj.IsFunction()) { | 475 if (obj.IsFunction()) { |
| 500 return String::Handle(Function::Cast(obj).name()).Hash(); | 476 return String::Handle(Function::Cast(obj).name()).Hash(); |
| 501 } else { | 477 } else { |
| 502 ASSERT(String::Cast(obj).IsSymbol()); | 478 ASSERT(String::Cast(obj).IsSymbol()); |
| 503 return String::Cast(obj).Hash(); | 479 return String::Cast(obj).Hash(); |
| 504 } | 480 } |
| 505 } | 481 } |
| 506 static RawObject* NewKey(const Function& function) { | 482 static RawObject* NewKey(const Function& function) { return function.raw(); } |
| 507 return function.raw(); | |
| 508 } | |
| 509 }; | 483 }; |
| 510 | 484 |
| 511 typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet; | 485 typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet; |
| 512 | 486 |
| 513 | 487 |
| 514 } // namespace dart | 488 } // namespace dart |
| 515 | 489 |
| 516 #endif // RUNTIME_VM_PRECOMPILER_H_ | 490 #endif // RUNTIME_VM_PRECOMPILER_H_ |
| OLD | NEW |