Index: pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart |
diff --git a/pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart b/pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart |
index 2db7b35038fa194f1e787a673bc619b758693be1..2045c6c6577ba5a93ade038010a88c2d1bbdafe5 100644 |
--- a/pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart |
+++ b/pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart |
@@ -22,6 +22,9 @@ import '../dart_types.dart' show DartType; |
import '../dart_types.dart' show InterfaceType; |
import '../elements/elements.dart' |
show ClassElement, FieldElement, LibraryElement, VariableElement; |
+import '../enqueue.dart'; |
+import '../universe/world_impact.dart' |
+ show WorldImpact, StagedWorldImpactBuilder; |
import 'js_backend.dart' show JavaScriptBackend; |
/// An analysis and optimization to remove unused entries from a `LookupMap`. |
@@ -118,11 +121,18 @@ class LookupMapAnalysis { |
/// entry with that key. |
final _pending = <ConstantValue, List<_LookupMapInfo>>{}; |
+ final StagedWorldImpactBuilder impactBuilder = new StagedWorldImpactBuilder(); |
+ |
/// Whether the backend is currently processing the codegen queue. |
bool _inCodegen = false; |
LookupMapAnalysis(this.backend, this.reporter); |
+ void onQueueEmpty(Enqueuer enqueuer) { |
+ if (enqueuer.isResolutionQueue) return; |
+ enqueuer.applyImpact(null, impactBuilder.flush()); |
+ } |
+ |
/// Whether this analysis and optimization is enabled. |
bool get _isEnabled { |
// `lookupMap==off` kept here to make it easy to test disabling this feature |
@@ -248,17 +258,17 @@ class LookupMapAnalysis { |
} |
/// Callback from the enqueuer, invoked when [type] is instantiated. |
- void registerInstantiatedType(InterfaceType type, Registry registry) { |
+ void registerInstantiatedType(InterfaceType type) { |
if (!_isEnabled || !_inCodegen) return; |
// TODO(sigmund): only add if .runtimeType is ever used |
_addClassUse(type.element); |
// TODO(sigmund): only do this when type-argument expressions are used? |
- _addGenerics(type, registry); |
+ _addGenerics(type); |
} |
/// Records generic type arguments in [type], in case they are retrieved and |
/// returned using a type-argument expression. |
- void _addGenerics(InterfaceType type, Registry registry) { |
+ void _addGenerics(InterfaceType type) { |
if (!type.isGeneric) return; |
for (var arg in type.typeArguments) { |
if (arg is InterfaceType) { |
@@ -266,9 +276,9 @@ class LookupMapAnalysis { |
// Note: this call was needed to generate correct code for |
// type_lookup_map/generic_type_test |
// TODO(sigmund): can we get rid of this? |
- backend.registerInstantiatedConstantType( |
- backend.typeImplementation.rawType, registry); |
- _addGenerics(arg, registry); |
+ backend.computeImpactForInstantiatedConstantType( |
+ backend.typeImplementation.rawType, impactBuilder); |
+ _addGenerics(arg); |
} |
} |
} |
@@ -407,8 +417,8 @@ class _LookupMapInfo { |
assert(!usedEntries.containsKey(key)); |
ConstantValue constant = unusedEntries.remove(key); |
usedEntries[key] = constant; |
- analysis.backend.registerCompileTimeConstant( |
- constant, analysis.backend.compiler.globalDependencies); |
+ analysis.backend.computeImpactForCompileTimeConstant( |
+ constant, analysis.impactBuilder, false); |
} |
/// Restores [original] to contain all of the entries marked as possibly used. |