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

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

Issue 1950243002: Do not evaluate on-demand to prevent breaking the deferred loading task (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: also run dartfmt 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 if (constant != null) { 1478 // TODO(johnniwinther): ensure `initialValue` is not null. Note that
1479 ConstantValue initialValue = constants.getConstantValue(constant); 1479 // calling `evaluate` in getConstantValue may trigger issues for deferred
1480 // loading (dartbug.com/26406).
1481 ConstantValue initialValue =
1482 constant == null ? null : constants.getConstantValue(constant);
1483 if (initialValue != null) {
1480 registerCompileTimeConstant(initialValue, work.registry); 1484 registerCompileTimeConstant(initialValue, work.registry);
1481 addCompileTimeConstantForEmission(initialValue); 1485 addCompileTimeConstantForEmission(initialValue);
1482 // We don't need to generate code for static or top-level 1486 // We don't need to generate code for static or top-level
1483 // variables. For instance variables, we may need to generate 1487 // variables. For instance variables, we may need to generate
1484 // the checked setter. 1488 // the checked setter.
1485 if (Elements.isStaticOrTopLevel(element)) { 1489 if (Elements.isStaticOrTopLevel(element)) {
1486 return impactTransformer 1490 return impactTransformer
1487 .transformCodegenImpact(work.registry.worldImpact); 1491 .transformCodegenImpact(work.registry.worldImpact);
1488 } 1492 }
1489 } else { 1493 } else {
(...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after
3043 3047
3044 @override 3048 @override
3045 void onImpactUsed(ImpactUseCase impactUse) { 3049 void onImpactUsed(ImpactUseCase impactUse) {
3046 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) { 3050 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) {
3047 // TODO(johnniwinther): Allow emptying when serialization has been 3051 // TODO(johnniwinther): Allow emptying when serialization has been
3048 // performed. 3052 // performed.
3049 resolution.emptyCache(); 3053 resolution.emptyCache();
3050 } 3054 }
3051 } 3055 }
3052 } 3056 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698