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

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

Issue 1856713002: Test ResolutionImpact equivalence. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments Created 4 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
« no previous file with comments | « pkg/compiler/lib/src/common/resolution.dart ('k') | pkg/compiler/lib/src/elements/modelx.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 a05bcc787bf33a19116350b43ed642eae33ea25e..5665810615b69edba2091eeb2c78519b4852cab7 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -1960,6 +1960,7 @@ class _CompilerResolution implements Resolution {
final Map<Element, ResolutionImpact> _resolutionImpactCache =
<Element, ResolutionImpact>{};
final Map<Element, WorldImpact> _worldImpactCache = <Element, WorldImpact>{};
+ bool retainCaches = false;
_CompilerResolution(this.compiler);
@@ -2003,6 +2004,11 @@ class _CompilerResolution implements Resolution {
}
@override
+ bool hasResolutionImpact(Element element) {
+ return _resolutionImpactCache.containsKey(element);
+ }
+
+ @override
ResolutionImpact getResolutionImpact(Element element) {
ResolutionImpact resolutionImpact = _resolutionImpactCache[element];
assert(invariant(element, resolutionImpact != null,
@@ -2026,7 +2032,7 @@ class _CompilerResolution implements Resolution {
assert(invariant(element, !element.isSynthesized || tree == null));
ResolutionImpact resolutionImpact =
compiler.resolver.resolve(element);
- if (compiler.serialization.supportSerialization) {
+ if (compiler.serialization.supportSerialization || retainCaches) {
// [ResolutionImpact] is currently only used by serialization. The
// enqueuer uses the [WorldImpact] which is always cached.
// TODO(johnniwinther): Align these use cases better; maybe only
@@ -2049,6 +2055,7 @@ class _CompilerResolution implements Resolution {
@override
void uncacheWorldImpact(Element element) {
+ if (retainCaches) return;
if (compiler.serialization.isDeserialized(element)) return;
assert(invariant(element, _worldImpactCache[element] != null,
message: "WorldImpact not computed for $element."));
@@ -2058,6 +2065,7 @@ class _CompilerResolution implements Resolution {
@override
void emptyCache() {
+ if (retainCaches) return;
for (Element element in _worldImpactCache.keys) {
_worldImpactCache[element] = const WorldImpact();
}
« no previous file with comments | « pkg/compiler/lib/src/common/resolution.dart ('k') | pkg/compiler/lib/src/elements/modelx.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698