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

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

Issue 2742283002: Add ConstantUse to WorldImpact (Closed)
Patch Set: Cleanup. Created 3 years, 9 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
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 108dc9622433e46388c812c4328fca83a7c50c69..bd1b3a422912eb88dd5216efaacb1d3da772fab9 100644
--- a/pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart
+++ b/pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart
@@ -18,15 +18,15 @@ import '../constants/values.dart'
NullConstantValue,
StringConstantValue,
TypeConstantValue;
-import '../elements/elements.dart'
- show ClassElement, FieldElement, LibraryElement, VariableElement;
+import '../elements/elements.dart' show ClassElement, FieldElement;
import '../elements/entities.dart';
import '../elements/resolution_types.dart' show ResolutionInterfaceType;
import '../options.dart';
-import '../universe/use.dart' show StaticUse;
+import '../universe/use.dart' show ConstantUse, StaticUse;
import '../universe/world_impact.dart'
show WorldImpact, StagedWorldImpactBuilder;
-import 'js_backend.dart' show JavaScriptBackend;
+import 'backend.dart' show JavaScriptBackend;
+import 'backend_helpers.dart';
/// Lookup map handling for resolution.
class LookupMapLibraryAccess {
@@ -46,13 +46,14 @@ class LookupMapLibraryAccess {
/// `package:lookup_map/lookup_map.dart`.
LibraryEntity lookupMapLibrary;
- final StagedWorldImpactBuilder impactBuilder = new StagedWorldImpactBuilder();
+ final StagedWorldImpactBuilder _impactBuilder =
+ new StagedWorldImpactBuilder();
LookupMapLibraryAccess(this._reporter, this._elementEnvironment);
/// Compute the [WorldImpact] for the constants registered since last flush.
WorldImpact flush() {
- return impactBuilder.flush();
+ return _impactBuilder.flush();
}
/// Initializes this analysis by providing the resolved library. This is
@@ -67,7 +68,7 @@ class LookupMapLibraryAccess {
_reporter.reportHintMessage(
library, MessageKind.UNRECOGNIZED_VERSION_OF_LOOKUP_MAP);
} else {
- impactBuilder
+ _impactBuilder
.registerStaticUse(new StaticUse.staticGet(lookupMapVersionVariable));
}
}
@@ -129,6 +130,8 @@ class LookupMapAnalysis {
final CommonElements _commonElements;
+ final BackendHelpers _helpers;
+
final BackendClasses _backendClasses;
/// The resolved [ClassElement] associated with `LookupMap`.
@@ -168,18 +171,24 @@ class LookupMapAnalysis {
/// entry with that key.
final _pending = <ConstantValue, List<_LookupMapInfo>>{};
- final StagedWorldImpactBuilder impactBuilderForCodegen =
+ final StagedWorldImpactBuilder _impactBuilder =
Siggi Cherem (dart-lang) 2017/03/14 05:43:59 never mind my comment from the other CL :)
Johnni Winther 2017/03/15 13:15:43 Acknowledged.
new StagedWorldImpactBuilder();
/// Whether the backend is currently processing the codegen queue.
bool _inCodegen = false;
- LookupMapAnalysis(this._backend, this._options, this._reporter,
- this._elementEnvironment, this._commonElements, this._backendClasses);
+ LookupMapAnalysis(
+ this._backend,
+ this._options,
+ this._reporter,
+ this._elementEnvironment,
+ this._commonElements,
+ this._helpers,
+ this._backendClasses);
/// Compute the [WorldImpact] for the constants registered since last flush.
WorldImpact flush() {
- return impactBuilderForCodegen.flush();
+ return _impactBuilder.flush();
}
/// Whether this analysis and optimization is enabled.
@@ -314,9 +323,10 @@ 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.computeImpactForInstantiatedConstantType(
- _backendClasses.typeType, impactBuilderForCodegen,
- forResolution: false);
+ _impactBuilder.registerStaticUse(new StaticUse.staticInvoke(
Siggi Cherem (dart-lang) 2017/03/14 05:43:59 in any way does the move to impacts address the TO
Johnni Winther 2017/03/15 13:15:43 It doesn't :( I'm still investigating.
+ // TODO(johnniwinther): Find the right [CallStructure].
+ _helpers.createRuntimeType,
Siggi Cherem (dart-lang) 2017/03/14 05:43:59 I thought this would actually register typeType as
Johnni Winther 2017/03/15 13:15:43 This is the inlined version of computeImpactForIns
+ null));
_addGenerics(arg);
}
}
@@ -455,9 +465,8 @@ class _LookupMapInfo {
assert(!usedEntries.containsKey(key));
ConstantValue constant = unusedEntries.remove(key);
usedEntries[key] = constant;
- analysis._backend.computeImpactForCompileTimeConstant(
- constant, analysis.impactBuilderForCodegen,
- forResolution: false);
+ analysis._impactBuilder
+ .registerConstantUse(new ConstantUse.lookupMap(constant));
}
/// Restores [original] to contain all of the entries marked as possibly used.

Powered by Google App Engine
This is Rietveld 408576698