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

Unified Diff: pkg/compiler/lib/src/tree_ir/tree_ir_tracer.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/tree_ir_tracer.dart
diff --git a/pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart b/pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart
index d82377a63ba7c085ed9625a37717f2606d235b97..86a24b63116c21a657acfeda6af24f5997fa98de 100644
--- a/pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart
+++ b/pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart
@@ -127,7 +127,7 @@ class BlockCollector extends StatementVisitor {
visitStatement(node.body);
}
- visitWhileCondition(WhileCondition node) {
+ visitFor(For node) {
Block whileBlock = new Block();
_addGotoStatement(whileBlock);
@@ -297,11 +297,13 @@ class TreeTracer extends TracerUtil with StatementVisitor {
printStatement(null, "while true do");
}
- visitWhileCondition(WhileCondition node) {
+ visitFor(For node) {
String bodyTarget = collector.substatements[node.body].name;
String nextTarget = collector.substatements[node.next].name;
+ String updates = node.updates.map(expr).join(', ');
printStatement(null, "while ${expr(node.condition)}");
printStatement(null, "do $bodyTarget");
+ printStatement(null, "updates ($updates)");
printStatement(null, "then $nextTarget" );
}
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart ('k') | tests/compiler/dart2js/js_backend_cps_ir_closures_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698