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

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

Issue 1287253002: dart2js cps: Compile some loops as 'for' loops. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update test expectations Created 5 years, 4 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/variable_merger.dart
diff --git a/pkg/compiler/lib/src/tree_ir/optimization/variable_merger.dart b/pkg/compiler/lib/src/tree_ir/optimization/variable_merger.dart
index 79f018ba204d3015e358cc52f1275fe3e8c07523..91a5aac7d4c6367ae7fa746122cf67d44940a986 100644
--- a/pkg/compiler/lib/src/tree_ir/optimization/variable_merger.dart
+++ b/pkg/compiler/lib/src/tree_ir/optimization/variable_merger.dart
@@ -208,10 +208,11 @@ class BlockGraphBuilder extends RecursiveVisitor {
visitStatement(node.body); // visitContinue will add predecessors to join.
}
- visitWhileCondition(WhileCondition node) {
- Block join = _jumpTarget[node.label] = newBlock();
- join.predecessors.add(_currentBlock);
- _currentBlock = join;
+ visitFor(For node) {
+ Block entry = _currentBlock;
+ _currentBlock = _jumpTarget[node.label] = newBlock();
+ node.updates.forEach(visitExpression);
+ joinFrom(entry, _currentBlock);
visitExpression(node.condition);
Block afterCondition = _currentBlock;
branchFrom(afterCondition);
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart ('k') | pkg/compiler/lib/src/tree_ir/tree_ir_integrity.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698