| Index: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
|
| index 64d62e5ddb59080d42670c5b33adced238e82dfa..18395c182672783cf01350cbd0fd7fef3c1df733 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
|
| @@ -52,7 +52,6 @@ class FunctionInlineCache {
|
| }
|
| }
|
|
|
| -
|
| class JavaScriptBackend extends Backend {
|
| SsaBuilderTask builder;
|
| SsaOptimizerTask optimizer;
|
| @@ -288,19 +287,30 @@ class JavaScriptBackend extends Backend {
|
| /// constructors for custom elements.
|
| CustomElementsAnalysis customElementsAnalysis;
|
|
|
| + JavaScriptConstantTask constantCompilerTask;
|
| +
|
| JavaScriptBackend(Compiler compiler, bool generateSourceMap)
|
| : namer = determineNamer(compiler),
|
| oneShotInterceptors = new Map<String, Selector>(),
|
| interceptedElements = new Map<String, Set<Element>>(),
|
| rti = new RuntimeTypes(compiler),
|
| specializedGetInterceptors = new Map<String, Set<ClassElement>>(),
|
| - super(compiler, JAVA_SCRIPT_CONSTANT_SYSTEM) {
|
| + super(compiler) {
|
| emitter = new CodeEmitterTask(compiler, namer, generateSourceMap);
|
| builder = new SsaBuilderTask(this);
|
| optimizer = new SsaOptimizerTask(this);
|
| generator = new SsaCodeGeneratorTask(this);
|
| typeVariableHandler = new TypeVariableHandler(this);
|
| customElementsAnalysis = new CustomElementsAnalysis(this);
|
| + constantCompilerTask = new JavaScriptConstantTask(compiler);
|
| + }
|
| +
|
| + ConstantSystem get constantSystem => constants.constantSystem;
|
| +
|
| + /// Returns constant environment for the JavaScript interpretation of the
|
| + /// constants.
|
| + JavaScriptConstantCompiler get constants {
|
| + return constantCompilerTask.jsConstantCompiler;
|
| }
|
|
|
| static Namer determineNamer(Compiler compiler) {
|
| @@ -1142,12 +1152,10 @@ class JavaScriptBackend extends Backend {
|
| return;
|
| }
|
| if (kind.category == ElementCategory.VARIABLE) {
|
| - Constant initialValue =
|
| - compiler.constantHandler.getConstantForVariable(element);
|
| + Constant initialValue = constants.getConstantForVariable(element);
|
| if (initialValue != null) {
|
| registerCompileTimeConstant(initialValue, work.resolutionTree);
|
| - compiler.constantHandler.addCompileTimeConstantForEmission(
|
| - initialValue);
|
| + constants.addCompileTimeConstantForEmission(initialValue);
|
| // We don't need to generate code for static or top-level
|
| // variables. For instance variables, we may need to generate
|
| // the checked setter.
|
| @@ -1607,8 +1615,8 @@ class JavaScriptBackend extends Backend {
|
| if (mustRetainMetadata && isNeededForReflection(element)) {
|
| for (MetadataAnnotation metadata in element.metadata) {
|
| metadata.ensureResolved(compiler);
|
| - compiler.constantHandler.addCompileTimeConstantForEmission(
|
| - metadata.value);
|
| + Constant constant = constants.getConstantForMetadata(metadata);
|
| + constants.addCompileTimeConstantForEmission(constant);
|
| }
|
| return true;
|
| }
|
| @@ -1886,4 +1894,3 @@ class Dependency {
|
|
|
| const Dependency(this.constant, this.user);
|
| }
|
| -
|
|
|