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

Unified Diff: sdk/lib/_internal/compiler/implementation/universe/full_function_set.dart

Issue 14416014: After a dynamic call, refine the receiver type by looking at the potential targets of that call. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
Index: sdk/lib/_internal/compiler/implementation/universe/full_function_set.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/universe/full_function_set.dart (revision 22031)
+++ sdk/lib/_internal/compiler/implementation/universe/full_function_set.dart (working copy)
@@ -33,14 +33,16 @@
// TODO(kasperl): Check if any of the found classes may have a
// non-throwing noSuchMethod implementation in a subclass instead
// of always disabling the class list computation.
- if (compiler.enabledNoSuchMethod) return null;
+ if (compiler.enabledNoSuchMethod) {
+ return <ClassElement>[compiler.objectClass];
+ }
List<ClassElement> classes = <ClassElement>[];
int budget = MAX_CLASSES_STEPS;
L: for (Element element in functions) {
ClassElement enclosing = element.getEnclosingClass();
for (int i = 0; i < classes.length; i++) {
if (--budget <= 0) {
- return null;
+ return <ClassElement>[compiler.objectClass];
} else if (enclosing.isSubclassOf(classes[i])) {
continue L;
} else if (classes[i].isSubclassOf(enclosing)) {
@@ -48,26 +50,28 @@
continue L;
}
}
- if (classes.length >= MAX_CLASSES) return null;
+ if (classes.length >= MAX_CLASSES) {
+ return <ClassElement>[compiler.objectClass];
+ }
classes.add(enclosing);
}
return classes;
}
static bool isExactClass(List<ClassElement> classes, Compiler compiler) {
- if (classes == null || classes.length != 1) return false;
+ if (classes.length != 1) return false;
ClassElement single = classes[0];
// Return true if the single class in our list does not have a
// single instantiated subclass.
- Set<ClassElement> subtypes = compiler.world.subtypes[single];
- return subtypes == null
- || subtypes.every((ClassElement each) => !each.isSubclassOf(single));
+ Set<ClassElement> subclasses = compiler.world.subclasses[single];
+ return subclasses == null || subclasses.isEmpty;
}
}
class FullFunctionSetQuery extends FunctionSetQuery {
- final List<ClassElement> classes;
final bool isExact;
- FullFunctionSetQuery(List<Element> functions, this.classes, this.isExact)
- : super(functions);
+ FullFunctionSetQuery(List<Element> functions,
+ Iterable<ClassElement> classes,
+ this.isExact)
+ : super(functions, classes);
}

Powered by Google App Engine
This is Rietveld 408576698