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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 ClassSet classes_to_retain_; | 365 ClassSet classes_to_retain_; |
366 TypeArgumentsSet typeargs_to_retain_; | 366 TypeArgumentsSet typeargs_to_retain_; |
367 AbstractTypeSet types_to_retain_; | 367 AbstractTypeSet types_to_retain_; |
368 InstanceSet consts_to_retain_; | 368 InstanceSet consts_to_retain_; |
369 Error& error_; | 369 Error& error_; |
370 }; | 370 }; |
371 | 371 |
372 | 372 |
373 class FunctionsTraits { | 373 class FunctionsTraits { |
374 public: | 374 public: |
| 375 static const char* Name() { return "FunctionsTraits"; } |
| 376 |
375 static bool IsMatch(const Object& a, const Object& b) { | 377 static bool IsMatch(const Object& a, const Object& b) { |
376 Zone* zone = Thread::Current()->zone(); | 378 Zone* zone = Thread::Current()->zone(); |
377 String& a_s = String::Handle(zone); | 379 String& a_s = String::Handle(zone); |
378 String& b_s = String::Handle(zone); | 380 String& b_s = String::Handle(zone); |
379 a_s = a.IsFunction() ? Function::Cast(a).name() : String::Cast(a).raw(); | 381 a_s = a.IsFunction() ? Function::Cast(a).name() : String::Cast(a).raw(); |
380 b_s = b.IsFunction() ? Function::Cast(b).name() : String::Cast(b).raw(); | 382 b_s = b.IsFunction() ? Function::Cast(b).name() : String::Cast(b).raw(); |
381 ASSERT(a_s.IsSymbol() && b_s.IsSymbol()); | 383 ASSERT(a_s.IsSymbol() && b_s.IsSymbol()); |
382 return a_s.raw() == b_s.raw(); | 384 return a_s.raw() == b_s.raw(); |
383 } | 385 } |
384 static uword Hash(const Object& obj) { | 386 static uword Hash(const Object& obj) { |
385 if (obj.IsFunction()) { | 387 if (obj.IsFunction()) { |
386 return String::Handle(Function::Cast(obj).name()).Hash(); | 388 return String::Handle(Function::Cast(obj).name()).Hash(); |
387 } else { | 389 } else { |
388 ASSERT(String::Cast(obj).IsSymbol()); | 390 ASSERT(String::Cast(obj).IsSymbol()); |
389 return String::Cast(obj).Hash(); | 391 return String::Cast(obj).Hash(); |
390 } | 392 } |
391 } | 393 } |
392 static RawObject* NewKey(const Function& function) { | 394 static RawObject* NewKey(const Function& function) { |
393 return function.raw(); | 395 return function.raw(); |
394 } | 396 } |
395 }; | 397 }; |
396 | 398 |
397 typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet; | 399 typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet; |
398 | 400 |
399 | 401 |
400 } // namespace dart | 402 } // namespace dart |
401 | 403 |
402 #endif // VM_PRECOMPILER_H_ | 404 #endif // VM_PRECOMPILER_H_ |
OLD | NEW |