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 |
(...skipping 18 matching lines...) Expand all Loading... |
29 ConstantValue getConstantValue(ConstantExpression expression) { | 29 ConstantValue getConstantValue(ConstantExpression expression) { |
30 return dartConstantCompiler.getConstantValue(expression); | 30 return dartConstantCompiler.getConstantValue(expression); |
31 } | 31 } |
32 | 32 |
33 @override | 33 @override |
34 ConstantValue getConstantValueForVariable(VariableElement element) { | 34 ConstantValue getConstantValueForVariable(VariableElement element) { |
35 return dartConstantCompiler.getConstantValueForVariable(element); | 35 return dartConstantCompiler.getConstantValueForVariable(element); |
36 } | 36 } |
37 | 37 |
38 @override | 38 @override |
39 ConstantExpression getConstantForVariable(VariableElement element) { | |
40 return dartConstantCompiler.getConstantForVariable(element); | |
41 } | |
42 | |
43 @override | |
44 ConstantExpression compileConstant(VariableElement element) { | 39 ConstantExpression compileConstant(VariableElement element) { |
45 return measure(() { | 40 return measure(() { |
46 // TODO(het): Only report errors from one of the constant compilers | 41 // TODO(het): Only report errors from one of the constant compilers |
47 ConstantExpression result = dartConstantCompiler.compileConstant(element); | 42 ConstantExpression result = dartConstantCompiler.compileConstant(element); |
48 jsConstantCompiler.compileConstant(element); | 43 jsConstantCompiler.compileConstant(element); |
49 return result; | 44 return result; |
50 }); | 45 }); |
51 } | 46 } |
52 | 47 |
53 @override | 48 @override |
54 void evaluate(ConstantExpression constant) { | 49 void evaluate(ConstantExpression constant) { |
55 return measure(() { | 50 return measure(() { |
56 dartConstantCompiler.evaluate(constant); | 51 dartConstantCompiler.evaluate(constant); |
57 jsConstantCompiler.evaluate(constant); | 52 jsConstantCompiler.evaluate(constant); |
58 }); | 53 }); |
59 } | 54 } |
60 | 55 |
61 void compileVariable(VariableElement element) { | 56 @override |
62 measure(() { | 57 ConstantExpression compileVariable(VariableElement element) { |
63 jsConstantCompiler.compileVariable(element); | 58 return measure(() { |
| 59 return jsConstantCompiler.compileVariable(element); |
64 }); | 60 }); |
65 } | 61 } |
66 | 62 |
67 ConstantExpression compileNode(Node node, TreeElements elements, | 63 ConstantExpression compileNode(Node node, TreeElements elements, |
68 {bool enforceConst: true}) { | 64 {bool enforceConst: true}) { |
69 return measure(() { | 65 return measure(() { |
70 ConstantExpression result = dartConstantCompiler | 66 ConstantExpression result = dartConstantCompiler |
71 .compileNode(node, elements, enforceConst: enforceConst); | 67 .compileNode(node, elements, enforceConst: enforceConst); |
72 jsConstantCompiler.compileNode(node, elements, | 68 jsConstantCompiler.compileNode(node, elements, |
73 enforceConst: enforceConst); | 69 enforceConst: enforceConst); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 // TODO(ahe): This doesn't belong here. Rename this class and generalize. | 280 // TODO(ahe): This doesn't belong here. Rename this class and generalize. |
285 var closureClassMap = constants | 281 var closureClassMap = constants |
286 .compiler.closureToClassMapper.closureMappingCache | 282 .compiler.closureToClassMapper.closureMappingCache |
287 .remove(node); | 283 .remove(node); |
288 if (closureClassMap != null) { | 284 if (closureClassMap != null) { |
289 closureClassMap | 285 closureClassMap |
290 .removeMyselfFrom(constants.compiler.enqueuer.codegen.universe); | 286 .removeMyselfFrom(constants.compiler.enqueuer.codegen.universe); |
291 } | 287 } |
292 } | 288 } |
293 } | 289 } |
OLD | NEW |