OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of js_backend; | 5 part of js_backend; |
6 | 6 |
7 /// [ConstantCompilerTask] for compilation of constants for the JavaScript | 7 /// [ConstantCompilerTask] for compilation of constants for the JavaScript |
8 /// backend. | 8 /// backend. |
9 /// | 9 /// |
10 /// Since this task needs to distinguish between frontend and backend constants | 10 /// Since this task needs to distinguish between frontend and backend constants |
11 /// the actual compilation of the constants is forwarded to a | 11 /// the actual compilation of the constants is forwarded to a |
12 /// [DartConstantCompiler] for the frontend interpretation of the constants and | 12 /// [DartConstantCompiler] for the frontend interpretation of the constants and |
13 /// to a [JavaScriptConstantCompiler] for the backend interpretation. | 13 /// to a [JavaScriptConstantCompiler] for the backend interpretation. |
14 class JavaScriptConstantTask extends ConstantCompilerTask { | 14 class JavaScriptConstantTask extends ConstantCompilerTask { |
15 DartConstantCompiler dartConstantCompiler; | 15 DartConstantCompiler dartConstantCompiler; |
16 JavaScriptConstantCompiler jsConstantCompiler; | 16 JavaScriptConstantCompiler jsConstantCompiler; |
17 | 17 |
18 JavaScriptConstantTask(Compiler compiler) | 18 JavaScriptConstantTask(Compiler compiler) |
19 : this.dartConstantCompiler = new DartConstantCompiler(compiler), | 19 : this.dartConstantCompiler = new DartConstantCompiler(compiler), |
20 this.jsConstantCompiler = new JavaScriptConstantCompiler(compiler), | 20 this.jsConstantCompiler = new JavaScriptConstantCompiler(compiler), |
21 super(compiler); | 21 super(compiler.measurer); |
22 | 22 |
23 String get name => 'ConstantHandler'; | 23 String get name => 'ConstantHandler'; |
24 | 24 |
25 @override | 25 @override |
26 ConstantSystem get constantSystem => dartConstantCompiler.constantSystem; | 26 ConstantSystem get constantSystem => dartConstantCompiler.constantSystem; |
27 | 27 |
28 @override | 28 @override |
29 bool hasConstantValue(ConstantExpression expression) { | 29 bool hasConstantValue(ConstantExpression expression) { |
30 return dartConstantCompiler.hasConstantValue(expression); | 30 return dartConstantCompiler.hasConstantValue(expression); |
31 } | 31 } |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 // TODO(ahe): This doesn't belong here. Rename this class and generalize. | 308 // TODO(ahe): This doesn't belong here. Rename this class and generalize. |
309 var closureClassMap = constants | 309 var closureClassMap = constants |
310 .compiler.closureToClassMapper.closureMappingCache | 310 .compiler.closureToClassMapper.closureMappingCache |
311 .remove(node); | 311 .remove(node); |
312 if (closureClassMap != null) { | 312 if (closureClassMap != null) { |
313 closureClassMap | 313 closureClassMap |
314 .removeMyselfFrom(constants.compiler.enqueuer.codegen.universe); | 314 .removeMyselfFrom(constants.compiler.enqueuer.codegen.universe); |
315 } | 315 } |
316 } | 316 } |
317 } | 317 } |
OLD | NEW |