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

Side by Side Diff: pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart

Issue 1291333002: Revert "dart2js cps: Compile some loops as 'for' loops." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library tree_ir_tracer; 5 library tree_ir_tracer;
6 6
7 import 'dart:async' show EventSink; 7 import 'dart:async' show EventSink;
8 import '../tracer.dart'; 8 import '../tracer.dart';
9 import 'tree_ir_nodes.dart'; 9 import 'tree_ir_nodes.dart';
10 10
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 Block continueTarget = new Block(); 120 Block continueTarget = new Block();
121 _addGotoStatement(continueTarget); 121 _addGotoStatement(continueTarget);
122 122
123 continueTargets[node.label] = continueTarget; 123 continueTargets[node.label] = continueTarget;
124 blocks.last.addEdgeTo(continueTarget); 124 blocks.last.addEdgeTo(continueTarget);
125 _addBlock(continueTarget); 125 _addBlock(continueTarget);
126 _addStatement(node); 126 _addStatement(node);
127 visitStatement(node.body); 127 visitStatement(node.body);
128 } 128 }
129 129
130 visitFor(For node) { 130 visitWhileCondition(WhileCondition node) {
131 Block whileBlock = new Block(); 131 Block whileBlock = new Block();
132 _addGotoStatement(whileBlock); 132 _addGotoStatement(whileBlock);
133 133
134 _addBlock(whileBlock); 134 _addBlock(whileBlock);
135 _addStatement(node); 135 _addStatement(node);
136 whileBlock.statements.add(node); 136 whileBlock.statements.add(node);
137 blocks.last.addEdgeTo(whileBlock); 137 blocks.last.addEdgeTo(whileBlock);
138 138
139 Block bodyBlock = new Block(); 139 Block bodyBlock = new Block();
140 Block nextBlock = new Block(); 140 Block nextBlock = new Block();
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 String condition = expr(node.condition); 290 String condition = expr(node.condition);
291 String thenTarget = collector.substatements[node.thenStatement].name; 291 String thenTarget = collector.substatements[node.thenStatement].name;
292 String elseTarget = collector.substatements[node.elseStatement].name; 292 String elseTarget = collector.substatements[node.elseStatement].name;
293 printStatement(null, "if $condition then $thenTarget else $elseTarget"); 293 printStatement(null, "if $condition then $thenTarget else $elseTarget");
294 } 294 }
295 295
296 visitWhileTrue(WhileTrue node) { 296 visitWhileTrue(WhileTrue node) {
297 printStatement(null, "while true do"); 297 printStatement(null, "while true do");
298 } 298 }
299 299
300 visitFor(For node) { 300 visitWhileCondition(WhileCondition node) {
301 String bodyTarget = collector.substatements[node.body].name; 301 String bodyTarget = collector.substatements[node.body].name;
302 String nextTarget = collector.substatements[node.next].name; 302 String nextTarget = collector.substatements[node.next].name;
303 String updates = node.updates.map(expr).join(', ');
304 printStatement(null, "while ${expr(node.condition)}"); 303 printStatement(null, "while ${expr(node.condition)}");
305 printStatement(null, "do $bodyTarget"); 304 printStatement(null, "do $bodyTarget");
306 printStatement(null, "updates ($updates)");
307 printStatement(null, "then $nextTarget" ); 305 printStatement(null, "then $nextTarget" );
308 } 306 }
309 307
310 visitTry(Try node) { 308 visitTry(Try node) {
311 String tryTarget = collector.substatements[node.tryBody].name; 309 String tryTarget = collector.substatements[node.tryBody].name;
312 String catchParams = node.catchParameters.map(names.varName).join(','); 310 String catchParams = node.catchParameters.map(names.varName).join(',');
313 String catchTarget = collector.substatements[node.catchBody].name; 311 String catchTarget = collector.substatements[node.catchBody].name;
314 printStatement(null, 'try $tryTarget catch($catchParams) $catchTarget'); 312 printStatement(null, 'try $tryTarget catch($catchParams) $catchTarget');
315 } 313 }
316 314
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 String prefix = v.element == null ? 'v' : '${v.element.name}_'; 587 String prefix = v.element == null ? 'v' : '${v.element.name}_';
590 while (name == null || _usedNames.contains(name)) { 588 while (name == null || _usedNames.contains(name)) {
591 name = "$prefix${_counter++}"; 589 name = "$prefix${_counter++}";
592 } 590 }
593 _names[v] = name; 591 _names[v] = name;
594 _usedNames.add(name); 592 _usedNames.add(name);
595 } 593 }
596 return name; 594 return name;
597 } 595 }
598 } 596 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698