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

Unified Diff: sdk/lib/_internal/compiler/implementation/types/flat_type_mask.dart

Issue 23883004: Fix bug http://code.google.com/p/dart/issues/detail?id=12941 by doing speculative optimizations eve… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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/types/flat_type_mask.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/types/flat_type_mask.dart (revision 27115)
+++ sdk/lib/_internal/compiler/implementation/types/flat_type_mask.dart (working copy)
@@ -461,11 +461,10 @@
}
/**
- * Returns whether a [selector] call will hit a method at runtime,
- * and not go through [noSuchMethod].
+ * Returns whether this [TypeMask] understands [selector].
*/
- bool willHit(Selector selector, Compiler compiler) {
- Element cls;
+ bool understands(Selector selector, Compiler compiler) {
+ ClassElement cls;
if (isEmpty) {
if (!isNullable) return false;
cls = compiler.backend.nullImplementation;
@@ -473,26 +472,9 @@
cls = base.element;
}
- if (!cls.isAbstract(compiler)) {
- return hasConcreteMatch(cls, selector, compiler);
- }
-
- Set<ClassElement> subtypesToCheck;
- if (isExact) {
- return false;
- } else if (isSubtype) {
- subtypesToCheck = compiler.world.subtypesOf(cls);
- } else {
- assert(isSubclass);
- subtypesToCheck = compiler.world.subclassesOf(cls);
- }
-
- return subtypesToCheck != null
- && subtypesToCheck.every((ClassElement cls) {
- return cls.isAbstract(compiler)
- ? true
- : hasConcreteMatch(cls, selector, compiler);
- });
+ // Use [lookupMember] because finding abstract members is okay.
+ Element element = cls.implementation.lookupMember(selector.name);
+ return element != null && selector.appliesUntyped(element, compiler);
}
bool needsNoSuchMethodHandling(Selector selector, Compiler compiler) {

Powered by Google App Engine
This is Rietveld 408576698