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

Side by Side Diff: frog/leg/ssa/optimize.dart

Issue 9421035: Support break and labeled statements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Update expectations. Created 8 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « frog/leg/ssa/nodes.dart ('k') | frog/leg/ssa/tracer.dart » ('j') | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 class SsaOptimizerTask extends CompilerTask { 5 class SsaOptimizerTask extends CompilerTask {
6 SsaOptimizerTask(Compiler compiler) : super(compiler); 6 SsaOptimizerTask(Compiler compiler) : super(compiler);
7 String get name() => 'SSA optimizer'; 7 String get name() => 'SSA optimizer';
8 8
9 void optimize(WorkItem work, HGraph graph) { 9 void optimize(WorkItem work, HGraph graph) {
10 measure(() { 10 measure(() {
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 HPhi phi = worklist.removeLast(); 288 HPhi phi = worklist.removeLast();
289 for (final input in phi.inputs) { 289 for (final input in phi.inputs) {
290 if (input is HPhi && !livePhis.contains(input)) { 290 if (input is HPhi && !livePhis.contains(input)) {
291 worklist.add(input); 291 worklist.add(input);
292 livePhis.add(input); 292 livePhis.add(input);
293 } 293 }
294 } 294 }
295 } 295 }
296 296
297 // Remove phis that are not live. 297 // Remove phis that are not live.
298 for (final block in graph.blocks) { 298 // Traverse in reverse order to remove phis with no uses before the
299 // phis that they might use.
300 // TODO(lrn): Handle cyclic usages.
301 List<HBasicBlock> blocks = graph.blocks;
302 for (int i = blocks.length - 1; i >= 0; i--) {
303 HBasicBlock block = blocks[i];
299 HPhi current = block.phis.first; 304 HPhi current = block.phis.first;
300 HPhi next = null; 305 HPhi next = null;
301 while (current != null) { 306 while (current != null) {
302 next = current.next; 307 next = current.next;
303 if (!livePhis.contains(current)) block.removePhi(current); 308 if (!livePhis.contains(current)) {
309 current.block.removePhi(current);
310 }
304 current = next; 311 current = next;
305 } 312 }
306 } 313 }
307 } 314 }
308 } 315 }
309 316
310 class SsaRedundantPhiEliminator { 317 class SsaRedundantPhiEliminator {
311 void visitGraph(HGraph graph) { 318 void visitGraph(HGraph graph) {
312 final List<HPhi> worklist = <HPhi>[]; 319 final List<HPhi> worklist = <HPhi>[];
313 320
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 } 610 }
604 } 611 }
605 if (!canBeMoved) continue; 612 if (!canBeMoved) continue;
606 613
607 // This is safe because we are running after GVN. 614 // This is safe because we are running after GVN.
608 // TODO(ngeoffray): ensure GVN has been run. 615 // TODO(ngeoffray): ensure GVN has been run.
609 set_.add(current); 616 set_.add(current);
610 } 617 }
611 } 618 }
612 } 619 }
OLDNEW
« no previous file with comments | « frog/leg/ssa/nodes.dart ('k') | frog/leg/ssa/tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698