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

Unified Diff: pkg/compiler/lib/src/universe/universe.dart

Issue 1431513010: Revert "Normalize type masks to use the least upper instantiated subclass/type." (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 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 | « pkg/compiler/lib/src/universe/function_set.dart ('k') | pkg/compiler/lib/src/world.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/universe/universe.dart
diff --git a/pkg/compiler/lib/src/universe/universe.dart b/pkg/compiler/lib/src/universe/universe.dart
index c8e39a43242f6954403302d51f42ddbef6938466..5f9fd4632487d19bd496ee8ea7d03e65a56f5380 100644
--- a/pkg/compiler/lib/src/universe/universe.dart
+++ b/pkg/compiler/lib/src/universe/universe.dart
@@ -124,6 +124,12 @@ class Universe {
/// See [_directlyInstantiatedClasses].
final Set<DartType> _instantiatedTypes = new Set<DartType>();
+ /// The set of all instantiated classes, either directly, as superclasses or
+ /// as supertypes.
+ ///
+ /// Invariant: Elements are declaration elements.
+ final Set<ClassElement> _allInstantiatedClasses = new Set<ClassElement>();
+
/// Classes implemented by directly instantiated classes.
final Set<ClassElement> _implementedClasses = new Set<ClassElement>();
@@ -200,6 +206,13 @@ class Universe {
return _directlyInstantiatedClasses;
}
+ /// All instantiated classes, either directly, as superclasses or as
+ /// supertypes.
+ // TODO(johnniwinther): Improve semantic precision.
+ Iterable<ClassElement> get allInstantiatedClasses {
+ return _allInstantiatedClasses;
+ }
+
/// All directly instantiated types, that is, the types of the directly
/// instantiated classes.
///
@@ -207,6 +220,13 @@ class Universe {
// TODO(johnniwinther): Improve semantic precision.
Iterable<DartType> get instantiatedTypes => _instantiatedTypes;
+ /// Returns `true` if [cls] is considered to be instantiated, either directly,
+ /// through subclasses.
+ // TODO(johnniwinther): Improve semantic precision.
+ bool isInstantiated(ClassElement cls) {
+ return _allInstantiatedClasses.contains(cls.declaration);
+ }
+
/// Returns `true` if [cls] is considered to be implemented by an
/// instantiated class, either directly, through subclasses or through
/// subtypes. The latter case only contains spurious information from
@@ -251,6 +271,12 @@ class Universe {
}
});
}
+ while (cls != null) {
+ if (!_allInstantiatedClasses.add(cls)) {
+ return;
+ }
+ cls = cls.superclass;
+ }
}
bool _hasMatchingSelector(Map<Selector, SelectorConstraints> selectors,
@@ -377,6 +403,7 @@ class Universe {
fieldSetters.remove(element);
fieldGetters.remove(element);
_directlyInstantiatedClasses.remove(element);
+ _allInstantiatedClasses.remove(element);
if (element is ClassElement) {
assert(invariant(
element, element.thisType.isRaw,
« no previous file with comments | « pkg/compiler/lib/src/universe/function_set.dart ('k') | pkg/compiler/lib/src/world.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698