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

Unified Diff: pkg/compiler/lib/src/universe/codegen_world_builder.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/universe/codegen_world_builder.dart
diff --git a/pkg/compiler/lib/src/universe/codegen_world_builder.dart b/pkg/compiler/lib/src/universe/codegen_world_builder.dart
index a576979cd1a81e7b9c6b9817ea953c9faf990dcf..745eff7fa25683109e6860568a9130d2b929d0cc 100644
--- a/pkg/compiler/lib/src/universe/codegen_world_builder.dart
+++ b/pkg/compiler/lib/src/universe/codegen_world_builder.dart
@@ -50,6 +50,7 @@ abstract class CodegenWorldBuilder implements WorldBuilder {
class CodegenWorldBuilderImpl implements CodegenWorldBuilder {
final NativeClassData _nativeData;
final ClosedWorld _world;
+ final JavaScriptConstantCompiler _constants;
/// The set of all directly instantiated classes, that is, classes with a
/// generative constructor that has been called directly and not only through
@@ -116,8 +117,10 @@ class CodegenWorldBuilderImpl implements CodegenWorldBuilder {
final SelectorConstraintsStrategy selectorConstraintsStrategy;
- CodegenWorldBuilderImpl(
- this._nativeData, this._world, this.selectorConstraintsStrategy);
+ final Set<ConstantValue> _constantValues = new Set<ConstantValue>();
+
+ CodegenWorldBuilderImpl(this._nativeData, this._world, this._constants,
+ this.selectorConstraintsStrategy);
/// Calls [f] with every instance field, together with its declarer, in an
/// instance of [cls].
@@ -482,4 +485,13 @@ class CodegenWorldBuilderImpl implements CodegenWorldBuilder {
cls = cls.superclass;
}
}
+
+ /// Register the constant [use] with this world builder. Returns `true` if
+ /// the constant use was new to the world.
+ bool registerConstantUse(ConstantUse use) {
+ if (use.kind == ConstantUseKind.DIRECT) {
+ _constants.addCompileTimeConstantForEmission(use.value);
+ }
+ return _constantValues.add(use.value);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698