OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 const VERBOSE_OPTIMIZER_HINTS = false; | 7 const VERBOSE_OPTIMIZER_HINTS = false; |
8 | 8 |
9 class JavaScriptItemCompilationContext extends ItemCompilationContext { | 9 class JavaScriptItemCompilationContext extends ItemCompilationContext { |
10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); | 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); |
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1456 var kind = element.kind; | 1456 var kind = element.kind; |
1457 if (kind == ElementKind.TYPEDEF) { | 1457 if (kind == ElementKind.TYPEDEF) { |
1458 return const WorldImpact(); | 1458 return const WorldImpact(); |
1459 } | 1459 } |
1460 if (element.isConstructor && | 1460 if (element.isConstructor && |
1461 element.enclosingClass == helpers.jsNullClass) { | 1461 element.enclosingClass == helpers.jsNullClass) { |
1462 // Work around a problem compiling JSNull's constructor. | 1462 // Work around a problem compiling JSNull's constructor. |
1463 return const CodegenImpact(); | 1463 return const CodegenImpact(); |
1464 } | 1464 } |
1465 if (kind.category == ElementCategory.VARIABLE) { | 1465 if (kind.category == ElementCategory.VARIABLE) { |
| 1466 VariableElement variableElement = element; |
1466 ConstantValue initialValue = | 1467 ConstantValue initialValue = |
1467 constants.getConstantValueForVariable(element); | 1468 constants.getConstantValue(variableElement.constant); |
1468 if (initialValue != null) { | 1469 if (initialValue != null) { |
1469 registerCompileTimeConstant(initialValue, work.registry); | 1470 registerCompileTimeConstant(initialValue, work.registry); |
1470 addCompileTimeConstantForEmission(initialValue); | 1471 addCompileTimeConstantForEmission(initialValue); |
1471 // We don't need to generate code for static or top-level | 1472 // We don't need to generate code for static or top-level |
1472 // variables. For instance variables, we may need to generate | 1473 // variables. For instance variables, we may need to generate |
1473 // the checked setter. | 1474 // the checked setter. |
1474 if (Elements.isStaticOrTopLevel(element)) { | 1475 if (Elements.isStaticOrTopLevel(element)) { |
1475 return impactTransformer | 1476 return impactTransformer |
1476 .transformCodegenImpact(work.registry.worldImpact); | 1477 .transformCodegenImpact(work.registry.worldImpact); |
1477 } | 1478 } |
(...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3008 | 3009 |
3009 @override | 3010 @override |
3010 void onImpactUsed(ImpactUseCase impactUse) { | 3011 void onImpactUsed(ImpactUseCase impactUse) { |
3011 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) { | 3012 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) { |
3012 // TODO(johnniwinther): Allow emptying when serialization has been | 3013 // TODO(johnniwinther): Allow emptying when serialization has been |
3013 // performed. | 3014 // performed. |
3014 resolution.emptyCache(); | 3015 resolution.emptyCache(); |
3015 } | 3016 } |
3016 } | 3017 } |
3017 } | 3018 } |
OLD | NEW |