Index: runtime/vm/cha.h |
=================================================================== |
--- runtime/vm/cha.h (revision 39070) |
+++ runtime/vm/cha.h (working copy) |
@@ -6,6 +6,7 @@ |
#define VM_CHA_H_ |
#include "vm/allocation.h" |
+#include "vm/growable_array.h" |
namespace dart { |
@@ -14,33 +15,41 @@ |
template <typename T> class ZoneGrowableArray; |
class String; |
-class CHA : public AllStatic { |
+class CHA : public StackResource { |
public: |
+ explicit CHA(Isolate* isolate) |
+ : StackResource(isolate), |
+ isolate_(isolate), |
+ cha_classes_(isolate, 1), |
+ previous_(isolate->cha()) { |
+ isolate->set_cha(this); |
+ } |
+ |
+ ~CHA() { |
+ ASSERT(isolate_->cha() == this); |
+ isolate_->set_cha(previous_); |
+ } |
+ |
// Returns true if the class given by its cid has subclasses. |
- static bool HasSubclasses(intptr_t cid); |
+ bool HasSubclasses(intptr_t cid); |
// Use only on known private classes that can never be subclassed by lazy |
// class finalization. Does not affect Isolate::use_cha flag. |
- static bool HasSubclassesSafe(intptr_t cid); |
+ bool HasSubclassesSafe(intptr_t cid); |
- // Returns an array containing the cids of the direct and indirect subclasses |
- // of the class given by its cid. |
- // Must not be called for kInstanceCid. |
- static ZoneGrowableArray<intptr_t>* GetSubclassIdsOf(intptr_t cid); |
Florian Schneider
2014/08/12 11:37:10
I removed these methods since are never used (exce
|
+ // Returns true if any subclass of 'cls' contains the function. |
+ bool HasOverride(const Class& cls, const String& function_name); |
- // Returns an array containing instance functions of the given name and |
- // belonging to the classes given by their cids. |
- // Cids must not contain kInstanceCid. |
- static ZoneGrowableArray<Function*>* GetNamedInstanceFunctionsOf( |
- const ZoneGrowableArray<intptr_t>& cids, |
- const String& function_name); |
+ const GrowableArray<Class*>& cha_classes() const { |
+ return cha_classes_; |
+ } |
- // Returns an array of functions overriding the given function. |
- // Must not be called for a function of class Object. |
- static ZoneGrowableArray<Function*>* GetOverridesOf(const Function& function); |
+ private: |
+ void AddToCHAClasses(Class* cls); |
- // Returns true if any subclass of 'cls' contains the function. |
- static bool HasOverride(const Class& cls, const String& function_name); |
+ Isolate* isolate_; |
+ GrowableArray<Class*> cha_classes_; |
+ CHA* previous_; |
}; |
} // namespace dart |