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

Unified Diff: runtime/vm/cha.cc

Issue 1867913004: Specialize instance calls when the call receiver is the method receiver and the method class has a … (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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/cha.h ('k') | runtime/vm/flow_graph.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/cha.cc
diff --git a/runtime/vm/cha.cc b/runtime/vm/cha.cc
index ed5255e664bd9f5d425346fb7753093fe124e65d..57214bb10fe32e6562bc4dea38da5d956cbe972c 100644
--- a/runtime/vm/cha.cc
+++ b/runtime/vm/cha.cc
@@ -48,6 +48,31 @@ bool CHA::HasSubclasses(intptr_t cid) const {
}
+bool CHA::ConcreteSubclasses(const Class& cls,
+ GrowableArray<intptr_t> *class_ids) {
+ if (cls.InVMHeap()) return false;
+ if (cls.IsObjectClass()) return false;
+
+ if (!cls.is_abstract()) {
+ class_ids->Add(cls.id());
+ }
+
+ const GrowableObjectArray& direct_subclasses =
+ GrowableObjectArray::Handle(cls.direct_subclasses());
+ if (direct_subclasses.IsNull()) {
+ return true;
+ }
+ Class& subclass = Class::Handle();
+ for (intptr_t i = 0; i < direct_subclasses.Length(); i++) {
+ subclass ^= direct_subclasses.At(i);
+ if (!ConcreteSubclasses(subclass, class_ids)) {
+ return false;
+ }
+ }
+ return true;
+}
+
+
bool CHA::IsImplemented(const Class& cls) {
// Function type aliases have different type checking rules.
ASSERT(!cls.IsTypedefClass());
« no previous file with comments | « runtime/vm/cha.h ('k') | runtime/vm/flow_graph.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698