Chromium Code Reviews| Index: pkg/compiler/lib/src/compiler.dart |
| diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart |
| index b49fdd03916ef1767819f098c47747ede473f614..e6db2bf5c9c8e1a9566932922b59543a2ef582c4 100644 |
| --- a/pkg/compiler/lib/src/compiler.dart |
| +++ b/pkg/compiler/lib/src/compiler.dart |
| @@ -1957,6 +1957,8 @@ class _CompilerDiagnosticReporter extends DiagnosticReporter { |
| // TODO(johnniwinther): Move [ResolverTask] here. |
| class _CompilerResolution implements Resolution { |
| final Compiler compiler; |
| + final Map<Element, ResolutionImpact> _resolutionImpactCache = |
| + <Element, ResolutionImpact>{}; |
| final Map<Element, WorldImpact> _worldImpactCache = <Element, WorldImpact>{}; |
| _CompilerResolution(this.compiler); |
| @@ -2001,6 +2003,14 @@ class _CompilerResolution implements Resolution { |
| } |
| @override |
| + ResolutionImpact getResolutionImpact(Element element) { |
| + ResolutionImpact resolutionImpact = _resolutionImpactCache[element]; |
| + assert(invariant(element, resolutionImpact != null, |
| + message: "ResolutionImpact not available for $element.")); |
| + return resolutionImpact; |
| + } |
| + |
| + @override |
| WorldImpact getWorldImpact(Element element) { |
| WorldImpact worldImpact = _worldImpactCache[element]; |
| assert(invariant(element, worldImpact != null, |
| @@ -2016,6 +2026,9 @@ class _CompilerResolution implements Resolution { |
| assert(invariant(element, !element.isSynthesized || tree == null)); |
| ResolutionImpact resolutionImpact = |
| compiler.resolver.resolve(element); |
| + if (compiler.serialization.supportSerialization) { |
|
Siggi Cherem (dart-lang)
2016/03/30 20:29:39
why do we only cache when serialization is enabled
Johnni Winther
2016/03/31 07:50:41
We always the the WorldImpact, which is the one us
|
| + _resolutionImpactCache[element] = resolutionImpact; |
| + } |
| if (tree != null && !compiler.options.analyzeSignaturesOnly) { |
| // TODO(het): don't do this if suppressWarnings is on, currently we have |
| // to do it because the typechecker also sets types |
| @@ -2035,6 +2048,7 @@ class _CompilerResolution implements Resolution { |
| assert(invariant(element, _worldImpactCache[element] != null, |
| message: "WorldImpact not computed for $element.")); |
| _worldImpactCache[element] = const WorldImpact(); |
| + _resolutionImpactCache.remove(element); |
| } |
| @override |
| @@ -2042,6 +2056,7 @@ class _CompilerResolution implements Resolution { |
| for (Element element in _worldImpactCache.keys) { |
| _worldImpactCache[element] = const WorldImpact(); |
| } |
| + _resolutionImpactCache.clear(); |
| } |
| @override |