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

Side by Side Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 1464773002: Remove WorldImpact from caches when no longer needed. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of js_backend; 5 part of js_backend;
6 6
7 const VERBOSE_OPTIMIZER_HINTS = false; 7 const VERBOSE_OPTIMIZER_HINTS = false;
8 8
9 class JavaScriptItemCompilationContext extends ItemCompilationContext { 9 class JavaScriptItemCompilationContext extends ItemCompilationContext {
10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>();
(...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 // go through the builder (below) to generate the lazy initializer for 1595 // go through the builder (below) to generate the lazy initializer for
1596 // the static variable. 1596 // the static variable.
1597 // We also need to register the use of the cyclic-error helper. 1597 // We also need to register the use of the cyclic-error helper.
1598 compiler.enqueuer.codegen.registerStaticUse( 1598 compiler.enqueuer.codegen.registerStaticUse(
1599 new StaticUse.staticInvoke( 1599 new StaticUse.staticInvoke(
1600 helpers.cyclicThrowHelper, CallStructure.ONE_ARG)); 1600 helpers.cyclicThrowHelper, CallStructure.ONE_ARG));
1601 } 1601 }
1602 } 1602 }
1603 1603
1604 generatedCode[element] = functionCompiler.compile(work); 1604 generatedCode[element] = functionCompiler.compile(work);
1605 return impactTransformer.transformCodegenImpact(work.registry.worldImpact); 1605 WorldImpact worldImpact =
1606 impactTransformer.transformCodegenImpact(work.registry.worldImpact);
1607 compiler.dumpInfoTask.registerImpact(element, worldImpact);
1608 return worldImpact;
1606 } 1609 }
1607 1610
1608 native.NativeEnqueuer nativeResolutionEnqueuer(Enqueuer world) { 1611 native.NativeEnqueuer nativeResolutionEnqueuer(Enqueuer world) {
1609 return new native.NativeResolutionEnqueuer(world, compiler); 1612 return new native.NativeResolutionEnqueuer(world, compiler);
1610 } 1613 }
1611 1614
1612 native.NativeEnqueuer nativeCodegenEnqueuer(Enqueuer world) { 1615 native.NativeEnqueuer nativeCodegenEnqueuer(Enqueuer world) {
1613 return new native.NativeCodegenEnqueuer(world, compiler, emitter); 1616 return new native.NativeCodegenEnqueuer(world, compiler, emitter);
1614 } 1617 }
1615 1618
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
2604 "typed_data": "_internal/js_runtime/lib/typed_data_patch.dart", 2607 "typed_data": "_internal/js_runtime/lib/typed_data_patch.dart",
2605 "_internal": "_internal/js_runtime/lib/internal_patch.dart" 2608 "_internal": "_internal/js_runtime/lib/internal_patch.dart"
2606 }; 2609 };
2607 2610
2608 @override 2611 @override
2609 Uri resolvePatchUri(String libraryName, Uri platformConfigUri) { 2612 Uri resolvePatchUri(String libraryName, Uri platformConfigUri) {
2610 String patchLocation = _patchLocations[libraryName]; 2613 String patchLocation = _patchLocations[libraryName];
2611 if (patchLocation == null) return null; 2614 if (patchLocation == null) return null;
2612 return platformConfigUri.resolve(patchLocation); 2615 return platformConfigUri.resolve(patchLocation);
2613 } 2616 }
2617
2618 @override
2619 ImpactStrategy createImpactStrategy(
2620 {bool supportDeferredLoad: true,
2621 bool supportDumpInfo: true}) {
2622 return new JavaScriptImpactStrategy(
2623 resolution,
2624 compiler.dumpInfoTask,
2625 supportDeferredLoad: supportDeferredLoad,
2626 supportDumpInfo: supportDumpInfo);
2627 }
2614 } 2628 }
2615 2629
2616 /// Handling of special annotations for tests. 2630 /// Handling of special annotations for tests.
2617 class Annotations { 2631 class Annotations {
2618 static final Uri PACKAGE_EXPECT = 2632 static final Uri PACKAGE_EXPECT =
2619 new Uri(scheme: 'package', path: 'expect/expect.dart'); 2633 new Uri(scheme: 'package', path: 'expect/expect.dart');
2620 2634
2621 final Compiler compiler; 2635 final Compiler compiler;
2622 2636
2623 ClassElement expectNoInlineClass; 2637 ClassElement expectNoInlineClass;
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
3072 } 3086 }
3073 } 3087 }
3074 3088
3075 /// Records that [constant] is used by the element behind [registry]. 3089 /// Records that [constant] is used by the element behind [registry].
3076 class Dependency { 3090 class Dependency {
3077 final ConstantValue constant; 3091 final ConstantValue constant;
3078 final Element annotatedElement; 3092 final Element annotatedElement;
3079 3093
3080 const Dependency(this.constant, this.annotatedElement); 3094 const Dependency(this.constant, this.annotatedElement);
3081 } 3095 }
3096
3097 class JavaScriptImpactStrategy extends ImpactStrategy {
3098 final Resolution resolution;
3099 final DumpInfoTask dumpInfoTask;
3100 final bool supportDeferredLoad;
3101 final bool supportDumpInfo;
3102
3103 JavaScriptImpactStrategy(this.resolution,
3104 this.dumpInfoTask,
3105 {this.supportDeferredLoad,
3106 this.supportDumpInfo});
3107
3108 @override
3109 void visitImpact(Element element,
3110 WorldImpact impact,
3111 WorldImpactVisitor visitor,
3112 ImpactUse impactUse) {
3113 if (impactUse == ResolutionEnqueuer.IMPACT_USE) {
sigurdm 2015/11/20 12:13:19 It would be nice if we could do this switching onl
Johnni Winther 2015/11/20 13:49:36 Added a TODO.
3114 if (supportDeferredLoad) {
3115 impact.apply(visitor);
3116 } else {
3117 impact.apply(visitor);
3118 resolution.uncacheWorldImpact(element);
3119 }
3120 } else if (impactUse == DeferredLoadTask.IMPACT_USE) {
3121 impact.apply(visitor);
3122 resolution.uncacheWorldImpact(element);
3123 } else if (impactUse == DumpInfoTask.IMPACT_USE) {
3124 impact.apply(visitor);
3125 dumpInfoTask.unregisterImpact(element);
3126 } else {
3127 impact.apply(visitor);
3128 }
3129 }
3130 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698