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

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

Issue 1464773002: Remove WorldImpact from caches when no longer needed. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Make deferred uncaching global. 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/common/resolution.dart ('k') | pkg/compiler/lib/src/deferred_load.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/compiler.dart
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index 392b2026b6fc8cbf6e8d66de3db1a9ca40e7f80d..43c0d44dd48214b906e0198d385989808ea9d0b6 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -137,6 +137,7 @@ import 'universe/universe.dart' show
import 'universe/use.dart' show
StaticUse;
import 'universe/world_impact.dart' show
+ ImpactStrategy,
WorldImpact;
import 'util/util.dart' show
Link,
@@ -157,6 +158,8 @@ abstract class Compiler {
final CacheStrategy cacheStrategy;
+ ImpactStrategy impactStrategy = const ImpactStrategy();
+
/**
* Map from token to the first preceding comment token.
*/
@@ -975,6 +978,9 @@ abstract class Compiler {
// something to the resolution queue. So we cannot wait with
// this until after the resolution queue is processed.
deferredLoadTask.beforeResolution(this);
+ impactStrategy = backend.createImpactStrategy(
+ supportDeferredLoad: deferredLoadTask.isProgramSplit,
+ supportDumpInfo: dumpInfo);
phase = PHASE_RESOLVING;
if (analyzeAll) {
@@ -1130,6 +1136,9 @@ abstract class Compiler {
}
emptyQueue(world);
world.queueIsClosed = true;
+ // Notify the impact strategy impacts are no longer needed for this
+ // enqueuer.
+ impactStrategy.onImpactUsed(world.impactUse);
backend.onQueueClosed();
assert(compilationFailed || world.checkNoEnqueuedInvokedInstanceMethods());
}
@@ -2019,6 +2028,20 @@ class _CompilerResolution implements Resolution {
}
@override
+ void uncacheWorldImpact(Element element) {
+ assert(invariant(element, _worldImpactCache[element] != null,
+ message: "WorldImpact not computed for $element."));
+ _worldImpactCache[element] = const WorldImpact();
+ }
+
+ @override
+ void emptyCache() {
+ for (Element element in _worldImpactCache.keys) {
+ _worldImpactCache[element] = const WorldImpact();
+ }
+ }
+
+ @override
bool hasBeenResolved(Element element) {
return _worldImpactCache.containsKey(element);
}
« no previous file with comments | « pkg/compiler/lib/src/common/resolution.dart ('k') | pkg/compiler/lib/src/deferred_load.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698