Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 1955403002: Skip spurious constants in deferred computation. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 return const WorldImpact(); 1468 return const WorldImpact();
1469 } 1469 }
1470 if (element.isConstructor && 1470 if (element.isConstructor &&
1471 element.enclosingClass == helpers.jsNullClass) { 1471 element.enclosingClass == helpers.jsNullClass) {
1472 // Work around a problem compiling JSNull's constructor. 1472 // Work around a problem compiling JSNull's constructor.
1473 return const CodegenImpact(); 1473 return const CodegenImpact();
1474 } 1474 }
1475 if (kind.category == ElementCategory.VARIABLE) { 1475 if (kind.category == ElementCategory.VARIABLE) {
1476 VariableElement variableElement = element; 1476 VariableElement variableElement = element;
1477 ConstantExpression constant = variableElement.constant; 1477 ConstantExpression constant = variableElement.constant;
1478 // TODO(johnniwinther): ensure `initialValue` is not null. Note that 1478 if (constant != null) {
1479 // calling `evaluate` in getConstantValue may trigger issues for deferred 1479 ConstantValue initialValue = constants.getConstantValue(constant);
1480 // loading (dartbug.com/26406). 1480 assert(invariant(variableElement, initialValue != null,
1481 ConstantValue initialValue = 1481 message: "Constant expression without value: "
1482 constant == null ? null : constants.getConstantValue(constant); 1482 "${constant.toStructuredText()}."));
1483 if (initialValue != null) {
1484 registerCompileTimeConstant(initialValue, work.registry); 1483 registerCompileTimeConstant(initialValue, work.registry);
1485 addCompileTimeConstantForEmission(initialValue); 1484 addCompileTimeConstantForEmission(initialValue);
1486 // We don't need to generate code for static or top-level 1485 // We don't need to generate code for static or top-level
1487 // variables. For instance variables, we may need to generate 1486 // variables. For instance variables, we may need to generate
1488 // the checked setter. 1487 // the checked setter.
1489 if (Elements.isStaticOrTopLevel(element)) { 1488 if (Elements.isStaticOrTopLevel(element)) {
1490 return impactTransformer 1489 return impactTransformer
1491 .transformCodegenImpact(work.registry.worldImpact); 1490 .transformCodegenImpact(work.registry.worldImpact);
1492 } 1491 }
1493 } else { 1492 } else {
(...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after
3047 3046
3048 @override 3047 @override
3049 void onImpactUsed(ImpactUseCase impactUse) { 3048 void onImpactUsed(ImpactUseCase impactUse) {
3050 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) { 3049 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) {
3051 // TODO(johnniwinther): Allow emptying when serialization has been 3050 // TODO(johnniwinther): Allow emptying when serialization has been
3052 // performed. 3051 // performed.
3053 resolution.emptyCache(); 3052 resolution.emptyCache();
3054 } 3053 }
3055 } 3054 }
3056 } 3055 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698