Chromium Code Reviews| 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..002c06cf15332805d1539353582ff62ded5ddd9e 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,28 @@ 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; |
| + |
| + JavaScriptConstantCompiler get constants { |
|
floitsch
2014/04/07 12:21:42
Add comment that these are now the JS constants.
Johnni Winther
2014/04/08 07:09:56
Done.
|
| + return constantCompilerTask.jsConstantCompiler; |
| } |
| static Namer determineNamer(Compiler compiler) { |
| @@ -1142,12 +1150,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 +1613,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 +1892,3 @@ class Dependency { |
| const Dependency(this.constant, this.user); |
| } |
| - |