| 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:
|
| - // Returns true if the class given by its cid has subclasses.
|
| - static bool HasSubclasses(intptr_t cid);
|
| + explicit CHA(Isolate* isolate)
|
| + : StackResource(isolate),
|
| + isolate_(isolate),
|
| + cha_classes_(isolate, 1),
|
| + previous_(isolate->cha()) {
|
| + isolate->set_cha(this);
|
| + }
|
|
|
| - // 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);
|
| + ~CHA() {
|
| + ASSERT(isolate_->cha() == this);
|
| + isolate_->set_cha(previous_);
|
| + }
|
|
|
| - // 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);
|
| + // Returns true if the class has subclasses.
|
| + bool HasSubclasses(const Class& cls);
|
| + bool HasSubclasses(intptr_t cid);
|
|
|
| - // 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);
|
| + // Return true if the class is implemented by some other class.
|
| + bool IsImplemented(const Class& cls);
|
|
|
| - // 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);
|
| + // Returns true if any subclass of 'cls' contains the function.
|
| + bool HasOverride(const Class& cls, const String& function_name);
|
|
|
| - // Returns true if any subclass of 'cls' contains the function.
|
| - static bool HasOverride(const Class& cls, const String& function_name);
|
| + const GrowableArray<Class*>& cha_classes() const {
|
| + return cha_classes_;
|
| + }
|
| +
|
| + private:
|
| + void AddToCHAClasses(Class* cls);
|
| +
|
| + Isolate* isolate_;
|
| + GrowableArray<Class*> cha_classes_;
|
| + CHA* previous_;
|
| };
|
|
|
| } // namespace dart
|
|
|