| 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/object.h" | 11 #include "vm/object.h" | 
| 11 | 12 | 
| 12 namespace dart { | 13 namespace dart { | 
| 13 | 14 | 
| 14 // Forward declarations. | 15 // Forward declarations. | 
| 15 class Class; | 16 class Class; | 
| 16 class Error; | 17 class Error; | 
| 17 class Field; | 18 class Field; | 
| 18 class Function; | 19 class Function; | 
| 19 class GrowableObjectArray; | 20 class GrowableObjectArray; | 
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 335   const GrowableObjectArray& pending_functions_; | 336   const GrowableObjectArray& pending_functions_; | 
| 336   SymbolSet sent_selectors_; | 337   SymbolSet sent_selectors_; | 
| 337   FunctionSet enqueued_functions_; | 338   FunctionSet enqueued_functions_; | 
| 338   FieldSet fields_to_retain_; | 339   FieldSet fields_to_retain_; | 
| 339   ClassSet classes_to_retain_; | 340   ClassSet classes_to_retain_; | 
| 340   TypeArgumentsSet typeargs_to_retain_; | 341   TypeArgumentsSet typeargs_to_retain_; | 
| 341   AbstractTypeSet types_to_retain_; | 342   AbstractTypeSet types_to_retain_; | 
| 342   Error& error_; | 343   Error& error_; | 
| 343 }; | 344 }; | 
| 344 | 345 | 
|  | 346 | 
|  | 347 class FunctionsTraits { | 
|  | 348  public: | 
|  | 349   static bool IsMatch(const Object& a, const Object& b) { | 
|  | 350     Zone* zone = Thread::Current()->zone(); | 
|  | 351     String& a_s = String::Handle(zone); | 
|  | 352     String& b_s = String::Handle(zone); | 
|  | 353     a_s = a.IsFunction() ? Function::Cast(a).name() : String::Cast(a).raw(); | 
|  | 354     b_s = b.IsFunction() ? Function::Cast(b).name() : String::Cast(b).raw(); | 
|  | 355     ASSERT(a_s.IsSymbol() && b_s.IsSymbol()); | 
|  | 356     return a_s.raw() == b_s.raw(); | 
|  | 357   } | 
|  | 358   static uword Hash(const Object& obj) { | 
|  | 359     if (obj.IsFunction()) { | 
|  | 360       return String::Handle(Function::Cast(obj).name()).Hash(); | 
|  | 361     } else { | 
|  | 362       ASSERT(String::Cast(obj).IsSymbol()); | 
|  | 363       return String::Cast(obj).Hash(); | 
|  | 364     } | 
|  | 365   } | 
|  | 366   static RawObject* NewKey(const Function& function) { | 
|  | 367     return function.raw(); | 
|  | 368   } | 
|  | 369 }; | 
|  | 370 | 
|  | 371 typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet; | 
|  | 372 | 
|  | 373 | 
| 345 }  // namespace dart | 374 }  // namespace dart | 
| 346 | 375 | 
| 347 #endif  // VM_PRECOMPILER_H_ | 376 #endif  // VM_PRECOMPILER_H_ | 
| OLD | NEW | 
|---|