| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_CHA_H_ | 5 #ifndef VM_CHA_H_ |
| 6 #define VM_CHA_H_ | 6 #define VM_CHA_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/growable_array.h" | 9 #include "vm/growable_array.h" |
| 10 #include "vm/thread.h" | 10 #include "vm/thread.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 ~CHA() { | 29 ~CHA() { |
| 30 ASSERT(thread_->cha() == this); | 30 ASSERT(thread_->cha() == this); |
| 31 thread_->set_cha(previous_); | 31 thread_->set_cha(previous_); |
| 32 } | 32 } |
| 33 | 33 |
| 34 // Returns true if the class has subclasses. | 34 // Returns true if the class has subclasses. |
| 35 static bool HasSubclasses(const Class& cls); | 35 static bool HasSubclasses(const Class& cls); |
| 36 bool HasSubclasses(intptr_t cid) const; | 36 bool HasSubclasses(intptr_t cid) const; |
| 37 | 37 |
| 38 bool ConcreteSubclasses(const Class& cls, GrowableArray<intptr_t> *class_ids); |
| 39 |
| 38 // Return true if the class is implemented by some other class. | 40 // Return true if the class is implemented by some other class. |
| 39 static bool IsImplemented(const Class& cls); | 41 static bool IsImplemented(const Class& cls); |
| 40 | 42 |
| 41 // Returns true if any subclass of 'cls' contains the function. | 43 // Returns true if any subclass of 'cls' contains the function. |
| 42 bool HasOverride(const Class& cls, const String& function_name); | 44 bool HasOverride(const Class& cls, const String& function_name); |
| 43 | 45 |
| 44 const GrowableArray<Class*>& leaf_classes() const { | 46 const GrowableArray<Class*>& leaf_classes() const { |
| 45 return leaf_classes_; | 47 return leaf_classes_; |
| 46 } | 48 } |
| 47 | 49 |
| 48 // Adds class 'cls' to the list of guarded leaf classes, deoptimization occurs | 50 // Adds class 'cls' to the list of guarded leaf classes, deoptimization occurs |
| 49 // if any of those leaf classes gets subclassed through later loaded/finalized | 51 // if any of those leaf classes gets subclassed through later loaded/finalized |
| 50 // libraries. Only classes that were used for CHA optimizations are added. | 52 // libraries. Only classes that were used for CHA optimizations are added. |
| 51 void AddToLeafClasses(const Class& cls); | 53 void AddToLeafClasses(const Class& cls); |
| 52 | 54 |
| 53 private: | 55 private: |
| 54 Thread* thread_; | 56 Thread* thread_; |
| 55 GrowableArray<Class*> leaf_classes_; | 57 GrowableArray<Class*> leaf_classes_; |
| 56 CHA* previous_; | 58 CHA* previous_; |
| 57 }; | 59 }; |
| 58 | 60 |
| 59 } // namespace dart | 61 } // namespace dart |
| 60 | 62 |
| 61 #endif // VM_CHA_H_ | 63 #endif // VM_CHA_H_ |
| OLD | NEW |