Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(543)

Unified Diff: runtime/vm/cha.h

Issue 463103002: Fix bug with CHA dependencies by recording a set of classes for registering code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: address remaining comments Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/cha.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,47 @@
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),
+ leaf_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.
+ // Updates set of leaf classes that we register optimized code with for lazy
+ // deoptimization.
+ 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.
+ // Updates set of leaf classes that we register optimized code with for lazy
+ // deoptimization.
+ 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.
+ // Updates set of leaf classes that we register optimized code with for lazy
+ // deoptimization.
+ 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*>& leaf_classes() const {
+ return leaf_classes_;
+ }
+
+ private:
+ void AddToLeafClasses(const Class& cls);
+
+ Isolate* isolate_;
+ GrowableArray<Class*> leaf_classes_;
+ CHA* previous_;
};
} // namespace dart
« no previous file with comments | « no previous file | runtime/vm/cha.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698