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

Unified Diff: pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart

Issue 1084783004: tree-ir: Treat getInterceptor and identical as effectively constant. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update test cases Created 5 years, 8 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/tree_ir/optimization/statement_rewriter.dart
diff --git a/pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart b/pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart
index 543aa31202b5e826d1c765ca7b3408687584cbb3..8d7d544d39cbd017a40ab7d9db8c26a48ec997c8 100644
--- a/pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart
+++ b/pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart
@@ -216,7 +216,7 @@ class StatementRewriter extends Transformer implements Pass {
if (constant != null) {
--node.variable.readCount;
--seenUses[node.variable]; // Do not count the use we just destroyed.
- return constant;
+ return visitExpression(constant);
}
// Try to propagate another expression into this variable use.
@@ -270,6 +270,7 @@ class StatementRewriter extends Transformer implements Pass {
return exp is Constant ||
exp is This ||
exp is ReifyTypeVar ||
+ exp is InvokeStatic && exp.isEffectivelyConstant ||
exp is VariableUse && constantEnvironment.containsKey(exp.variable);
}
@@ -288,7 +289,7 @@ class StatementRewriter extends Transformer implements Pass {
// Moreover, they should not prevent other expressions from propagating.
if (assign.variable.readCount <= 1) {
// A single-use constant should always be propagted to its use site.
- constantEnvironment[assign.variable] = visitExpression(assign.value);
+ constantEnvironment[assign.variable] = assign.value;
--assign.variable.writeCount;
return visitStatement(stmt.next);
} else {
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen/js_tree_builder.dart ('k') | pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698