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

Unified Diff: pkg/compiler/lib/src/deferred_load.dart

Issue 1955403002: Skip spurious constants in deferred computation. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/deferred_load.dart
diff --git a/pkg/compiler/lib/src/deferred_load.dart b/pkg/compiler/lib/src/deferred_load.dart
index 6141447892f5802c8efe4f4af2bbd0affa5ab5a7..695f33e6b022e8f58baf91fe4689c1a7e00f7540 100644
--- a/pkg/compiler/lib/src/deferred_load.dart
+++ b/pkg/compiler/lib/src/deferred_load.dart
@@ -336,16 +336,25 @@ class DeferredLoadTask extends CompilerTask {
TreeElements treeElements = analyzableElement.resolvedAst.elements;
assert(treeElements != null);
+ // TODO(johnniwinther): Add only expressions that are actually needed.
+ // Currently some potential expressions are visited that should never
+ // be added, and some implicit constant expression that should be
Siggi Cherem (dart-lang) 2016/05/09 20:03:04 rephrase? (I'm not sure I understood the last phra
Johnni Winther 2016/05/10 09:26:16 Done.
+ // allowed. See dartbug.com/26406 for context.
treeElements
.forEachConstantNode((Node node, ConstantExpression expression) {
// Explicitly depend on the backend constants.
- ConstantValue value;
- value = backend.constants.getConstantValue(expression);
- // TODO(johnniwinther): ensure `value` is not null or use directly the
- // expression to calculate dependencies. See dartbug.com/26406 for
- // context.
- if (value != null) {
+ if (backend.constants.hasConstantValue(expression)) {
+ ConstantValue value =
+ backend.constants.getConstantValue(expression);
+ assert(invariant(node, value != null,
+ message: "Constant expression without value: "
+ "${expression.toStructuredText()}."));
constants.add(value);
+ } else {
+ assert(invariant(node,
+ expression.isImplicit || expression.isPotential,
+ message: "Unexpected unevaluated constant expression: "
+ "${expression.toStructuredText()}."));
}
});
}

Powered by Google App Engine
This is Rietveld 408576698