| Index: pkg/compiler/lib/src/js_backend/backend.dart
|
| diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
|
| index 0fed323ab40d412424e6dbe745c8ab04901a84c5..6898d6ace17dfb5a108f84d1ce990b53e7e52536 100644
|
| --- a/pkg/compiler/lib/src/js_backend/backend.dart
|
| +++ b/pkg/compiler/lib/src/js_backend/backend.dart
|
| @@ -1602,7 +1602,10 @@ class JavaScriptBackend extends Backend {
|
| }
|
|
|
| generatedCode[element] = functionCompiler.compile(work);
|
| - return impactTransformer.transformCodegenImpact(work.registry.worldImpact);
|
| + WorldImpact worldImpact =
|
| + impactTransformer.transformCodegenImpact(work.registry.worldImpact);
|
| + compiler.dumpInfoTask.registerImpact(element, worldImpact);
|
| + return worldImpact;
|
| }
|
|
|
| native.NativeEnqueuer nativeResolutionEnqueuer(Enqueuer world) {
|
| @@ -2611,6 +2614,17 @@ class JavaScriptBackend extends Backend {
|
| if (patchLocation == null) return null;
|
| return platformConfigUri.resolve(patchLocation);
|
| }
|
| +
|
| + @override
|
| + ImpactStrategy createImpactStrategy(
|
| + {bool supportDeferredLoad: true,
|
| + bool supportDumpInfo: true}) {
|
| + return new JavaScriptImpactStrategy(
|
| + resolution,
|
| + compiler.dumpInfoTask,
|
| + supportDeferredLoad: supportDeferredLoad,
|
| + supportDumpInfo: supportDumpInfo);
|
| + }
|
| }
|
|
|
| /// Handling of special annotations for tests.
|
| @@ -3079,3 +3093,46 @@ class Dependency {
|
|
|
| const Dependency(this.constant, this.annotatedElement);
|
| }
|
| +
|
| +class JavaScriptImpactStrategy extends ImpactStrategy {
|
| + final Resolution resolution;
|
| + final DumpInfoTask dumpInfoTask;
|
| + final bool supportDeferredLoad;
|
| + final bool supportDumpInfo;
|
| +
|
| + JavaScriptImpactStrategy(this.resolution,
|
| + this.dumpInfoTask,
|
| + {this.supportDeferredLoad,
|
| + this.supportDumpInfo});
|
| +
|
| + @override
|
| + void visitImpact(Element element,
|
| + WorldImpact impact,
|
| + WorldImpactVisitor visitor,
|
| + ImpactUseCase impactUse) {
|
| + // TODO(johnniwinther): Compute the application strategy once for each use.
|
| + if (impactUse == ResolutionEnqueuer.IMPACT_USE) {
|
| + if (supportDeferredLoad) {
|
| + impact.apply(visitor);
|
| + } else {
|
| + impact.apply(visitor);
|
| + resolution.uncacheWorldImpact(element);
|
| + }
|
| + } else if (impactUse == DeferredLoadTask.IMPACT_USE) {
|
| + impact.apply(visitor);
|
| + // Impacts are uncached globally in [onImpactUsed].
|
| + } else if (impactUse == DumpInfoTask.IMPACT_USE) {
|
| + impact.apply(visitor);
|
| + dumpInfoTask.unregisterImpact(element);
|
| + } else {
|
| + impact.apply(visitor);
|
| + }
|
| + }
|
| +
|
| + @override
|
| + void onImpactUsed(ImpactUseCase impactUse) {
|
| + if (impactUse == DeferredLoadTask.IMPACT_USE) {
|
| + resolution.emptyCache();
|
| + }
|
| + }
|
| +}
|
|
|