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

Unified Diff: runtime/vm/cha.cc

Issue 11275110: Do not recompute unary_checks repeatedly. Add special (and quicker) way to check for method overrid… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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_optimizer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/cha.cc
===================================================================
--- runtime/vm/cha.cc (revision 14428)
+++ runtime/vm/cha.cc (working copy)
@@ -70,6 +70,27 @@
}
+bool CHA::HasOverride(const Class& cls, const String& function_name) {
+ const GrowableObjectArray& cls_direct_subclasses =
+ GrowableObjectArray::Handle(cls.direct_subclasses());
+ if (cls_direct_subclasses.IsNull()) {
+ return false;
+ }
+ Class& direct_subclass = Class::Handle();
+ for (intptr_t i = 0; i < cls_direct_subclasses.Length(); i++) {
+ direct_subclass ^= cls_direct_subclasses.At(i);
+ if (direct_subclass.LookupDynamicFunction(function_name) !=
+ Function::null()) {
+ return true;
+ }
+ if (HasOverride(direct_subclass, function_name)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+
ZoneGrowableArray<Function*>* CHA::GetNamedInstanceFunctionsOf(
const ZoneGrowableArray<intptr_t>& cids,
const String& function_name) {
« no previous file with comments | « runtime/vm/cha.h ('k') | runtime/vm/flow_graph_optimizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698