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

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

Issue 1354603002: Revert "Enqueue superclasses instead of supertypes." (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 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
« no previous file with comments | « pkg/compiler/lib/src/universe/universe.dart ('k') | sdk/lib/_internal/js_runtime/lib/interceptors.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/world.dart
diff --git a/pkg/compiler/lib/src/world.dart b/pkg/compiler/lib/src/world.dart
index 502ea8e9073d6de6b26250f58e5654a9e52679a0..12bb5dcf3b5a30b91643183d655486654774d9ce 100644
--- a/pkg/compiler/lib/src/world.dart
+++ b/pkg/compiler/lib/src/world.dart
@@ -66,9 +66,6 @@ abstract class ClassWorld {
/// Returns `true` if [cls] is instantiated.
bool isInstantiated(ClassElement cls);
- /// Returns `true` if [cls] is implemented by an instantiated class.
- bool isImplemented(ClassElement cls);
-
/// Returns `true` if the class world is closed.
bool get isClosed;
@@ -126,9 +123,6 @@ abstract class ClassWorld {
/// Returns `true` if closed-world assumptions can be made, that is,
/// incremental compilation isn't enabled.
bool get hasClosedWorldAssumption;
-
- /// Returns a string representation of the closed world.
- String dump();
}
class World implements ClassWorld {
@@ -151,11 +145,10 @@ class World implements ClassWorld {
invariant(cls, cls.isDeclaration,
message: '$cls must be the declaration.') &&
invariant(cls, cls.isResolved,
- message: '$cls must be resolved.')/* &&
- // TODO(johnniwinther): Reinsert this or similar invariant.
+ message: '$cls must be resolved.') &&
(!mustBeInstantiated ||
invariant(cls, isInstantiated(cls),
- message: '$cls is not instantiated.'))*/;
+ message: '$cls is not instantiated.'));
}
/// Returns `true` if [x] is a subtype of [y], that is, if [x] implements an
@@ -185,17 +178,11 @@ class World implements ClassWorld {
return false;
}
- /// Returns `true` if [cls] is instantiated either directly or through a
- /// subclass.
+ /// Returns `true` if [cls] is instantiated.
bool isInstantiated(ClassElement cls) {
return compiler.resolverWorld.isInstantiated(cls);
}
- /// Returns `true` if [cls] is implemented by an instantiated class.
- bool isImplemented(ClassElement cls) {
- return compiler.resolverWorld.isImplemented(cls);
- }
-
/// Returns an iterable over the directly instantiated classes that extend
/// [cls] possibly including [cls] itself, if it is live.
Iterable<ClassElement> subclassesOf(ClassElement cls) {
@@ -321,23 +308,9 @@ class World implements ClassWorld {
if (_liveMixinUses == null) {
_liveMixinUses = new Map<ClassElement, List<MixinApplicationElement>>();
for (ClassElement mixin in _mixinUses.keys) {
- List<MixinApplicationElement> uses = <MixinApplicationElement>[];
-
- void addLiveUse(MixinApplicationElement mixinApplication) {
- if (isInstantiated(mixinApplication)) {
- uses.add(mixinApplication);
- } else if (mixinApplication.isNamedMixinApplication) {
- List<MixinApplicationElement> next = _mixinUses[mixinApplication];
- if (next != null) {
- next.forEach(addLiveUse);
- }
- }
- }
-
- _mixinUses[mixin].forEach(addLiveUse);
- if (uses.isNotEmpty) {
- _liveMixinUses[mixin] = uses;
- }
+ Iterable<MixinApplicationElement> uses =
+ _mixinUses[mixin].where(isInstantiated);
+ if (uses.isNotEmpty) _liveMixinUses[mixin] = uses.toList();
}
}
Iterable<MixinApplicationElement> uses = _liveMixinUses[cls];
@@ -526,15 +499,6 @@ class World implements ClassWorld {
compiler.resolverWorld.directlyInstantiatedClasses.forEach(addSubtypes);
}
- @override
- String dump() {
- StringBuffer sb = new StringBuffer();
- sb.write("Instantiated classes in the closed world:\n");
- getClassHierarchyNode(compiler.objectClass)
- .printOn(sb, ' ', instantiatedOnly: true);
- return sb.toString();
- }
-
void registerMixinUse(MixinApplicationElement mixinApplication,
ClassElement mixin) {
// TODO(johnniwinther): Add map restricted to live classes.
« no previous file with comments | « pkg/compiler/lib/src/universe/universe.dart ('k') | sdk/lib/_internal/js_runtime/lib/interceptors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698