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

Side by Side Diff: pkg/compiler/lib/src/tree_ir/optimization/variable_merger.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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.optimization.variable_merger; 5 library tree_ir.optimization.variable_merger;
6 6
7 import 'optimization.dart' show Pass; 7 import 'optimization.dart' show Pass;
8 import '../tree_ir_nodes.dart'; 8 import '../tree_ir_nodes.dart';
9 9
10 /// Merges variables based on liveness and source variable information. 10 /// Merges variables based on liveness and source variable information.
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 _jumpTarget[node.target].predecessors.add(_currentBlock); 201 _jumpTarget[node.target].predecessors.add(_currentBlock);
202 } 202 }
203 203
204 visitWhileTrue(WhileTrue node) { 204 visitWhileTrue(WhileTrue node) {
205 Block join = _jumpTarget[node.label] = newBlock(); 205 Block join = _jumpTarget[node.label] = newBlock();
206 join.predecessors.add(_currentBlock); 206 join.predecessors.add(_currentBlock);
207 _currentBlock = join; 207 _currentBlock = join;
208 visitStatement(node.body); // visitContinue will add predecessors to join. 208 visitStatement(node.body); // visitContinue will add predecessors to join.
209 } 209 }
210 210
211 visitFor(For node) { 211 visitWhileCondition(WhileCondition node) {
212 Block entry = _currentBlock; 212 Block join = _jumpTarget[node.label] = newBlock();
213 _currentBlock = _jumpTarget[node.label] = newBlock(); 213 join.predecessors.add(_currentBlock);
214 node.updates.forEach(visitExpression); 214 _currentBlock = join;
215 joinFrom(entry, _currentBlock);
216 visitExpression(node.condition); 215 visitExpression(node.condition);
217 Block afterCondition = _currentBlock; 216 Block afterCondition = _currentBlock;
218 branchFrom(afterCondition); 217 branchFrom(afterCondition);
219 visitStatement(node.body); // visitContinue will add predecessors to join. 218 visitStatement(node.body); // visitContinue will add predecessors to join.
220 branchFrom(afterCondition); 219 branchFrom(afterCondition);
221 visitStatement(node.next); 220 visitStatement(node.next);
222 } 221 }
223 222
224 visitTry(Try node) { 223 visitTry(Try node) {
225 Block outerCatchBlock = _currentBlock.catchBlock; 224 Block outerCatchBlock = _currentBlock.catchBlock;
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 node.expression = visitExpression(node.expression); 535 node.expression = visitExpression(node.expression);
537 node.next = visitStatement(node.next); 536 node.next = visitStatement(node.next);
538 if (node.expression is VariableUse) { 537 if (node.expression is VariableUse) {
539 VariableUse use = node.expression; 538 VariableUse use = node.expression;
540 --use.variable.readCount; 539 --use.variable.readCount;
541 return node.next; 540 return node.next;
542 } 541 }
543 return node; 542 return node;
544 } 543 }
545 } 544 }
OLDNEW
« 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