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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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"; } | 375 static const char* Name() { return "FunctionsTraits"; } |
| 376 static bool ReportStats() { return false; } |
376 | 377 |
377 static bool IsMatch(const Object& a, const Object& b) { | 378 static bool IsMatch(const Object& a, const Object& b) { |
378 Zone* zone = Thread::Current()->zone(); | 379 Zone* zone = Thread::Current()->zone(); |
379 String& a_s = String::Handle(zone); | 380 String& a_s = String::Handle(zone); |
380 String& b_s = String::Handle(zone); | 381 String& b_s = String::Handle(zone); |
381 a_s = a.IsFunction() ? Function::Cast(a).name() : String::Cast(a).raw(); | 382 a_s = a.IsFunction() ? Function::Cast(a).name() : String::Cast(a).raw(); |
382 b_s = b.IsFunction() ? Function::Cast(b).name() : String::Cast(b).raw(); | 383 b_s = b.IsFunction() ? Function::Cast(b).name() : String::Cast(b).raw(); |
383 ASSERT(a_s.IsSymbol() && b_s.IsSymbol()); | 384 ASSERT(a_s.IsSymbol() && b_s.IsSymbol()); |
384 return a_s.raw() == b_s.raw(); | 385 return a_s.raw() == b_s.raw(); |
385 } | 386 } |
386 static uword Hash(const Object& obj) { | 387 static uword Hash(const Object& obj) { |
387 if (obj.IsFunction()) { | 388 if (obj.IsFunction()) { |
388 return String::Handle(Function::Cast(obj).name()).Hash(); | 389 return String::Handle(Function::Cast(obj).name()).Hash(); |
389 } else { | 390 } else { |
390 ASSERT(String::Cast(obj).IsSymbol()); | 391 ASSERT(String::Cast(obj).IsSymbol()); |
391 return String::Cast(obj).Hash(); | 392 return String::Cast(obj).Hash(); |
392 } | 393 } |
393 } | 394 } |
394 static RawObject* NewKey(const Function& function) { | 395 static RawObject* NewKey(const Function& function) { |
395 return function.raw(); | 396 return function.raw(); |
396 } | 397 } |
397 }; | 398 }; |
398 | 399 |
399 typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet; | 400 typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet; |
400 | 401 |
401 | 402 |
402 } // namespace dart | 403 } // namespace dart |
403 | 404 |
404 #endif // VM_PRECOMPILER_H_ | 405 #endif // VM_PRECOMPILER_H_ |
OLD | NEW |