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

Unified Diff: runtime/vm/object.cc

Issue 10828399: Implement class hierarchy analysis in the VM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 11005)
+++ runtime/vm/object.cc (working copy)
@@ -1857,6 +1857,28 @@
}
+void Class::AddDirectSubclass(const Class& subclass) const {
+ ASSERT(!subclass.IsNull());
+ ASSERT(subclass.SuperClass() == raw());
+ // Do not keep track of the direct subclasses of class Object.
+ // TODO(regis): Replace assert below with ASSERT(id() != kDartObjectCid).
+ ASSERT(!IsObjectClass());
+ GrowableObjectArray& direct_subclasses =
+ GrowableObjectArray::Handle(raw_ptr()->direct_subclasses_);
+ if (direct_subclasses.IsNull()) {
+ direct_subclasses = GrowableObjectArray::New(4, Heap::kOld);
+ StorePointer(&raw_ptr()->direct_subclasses_, direct_subclasses.raw());
+ }
+#if defined(DEBUG)
+ // Verify that the same class is not added twice.
+ for (intptr_t i = 0; i < direct_subclasses.Length(); i++) {
+ ASSERT(direct_subclasses.At(i) != subclass.raw());
+ }
+#endif
+ direct_subclasses.Add(subclass);
+}
+
+
RawArray* Class::constants() const {
return raw_ptr()->constants_;
}
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698