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

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

Issue 9500010: Fix break implementation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments. Created 8 years, 9 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Traverse in reverse order to remove phis with no uses before the 298 // Traverse in reverse order to remove phis with no uses before the
299 // phis that they might use. 299 // phis that they might use.
300 // TODO(lrn): Handle cyclic usages. 300 // NOTICE: Doesn't handle circular references, but we don't currently
301 // create any.
301 List<HBasicBlock> blocks = graph.blocks; 302 List<HBasicBlock> blocks = graph.blocks;
302 for (int i = blocks.length - 1; i >= 0; i--) { 303 for (int i = blocks.length - 1; i >= 0; i--) {
303 HBasicBlock block = blocks[i]; 304 HBasicBlock block = blocks[i];
304 HPhi current = block.phis.first; 305 HPhi current = block.phis.first;
305 HPhi next = null; 306 HPhi next = null;
306 while (current != null) { 307 while (current != null) {
307 next = current.next; 308 next = current.next;
308 if (!livePhis.contains(current)) { 309 if (!livePhis.contains(current)) {
309 current.block.removePhi(current); 310 block.removePhi(current);
310 } 311 }
311 current = next; 312 current = next;
312 } 313 }
313 } 314 }
314 } 315 }
315 } 316 }
316 317
317 class SsaRedundantPhiEliminator { 318 class SsaRedundantPhiEliminator {
318 void visitGraph(HGraph graph) { 319 void visitGraph(HGraph graph) {
319 final List<HPhi> worklist = <HPhi>[]; 320 final List<HPhi> worklist = <HPhi>[];
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 } 611 }
611 } 612 }
612 if (!canBeMoved) continue; 613 if (!canBeMoved) continue;
613 614
614 // This is safe because we are running after GVN. 615 // This is safe because we are running after GVN.
615 // TODO(ngeoffray): ensure GVN has been run. 616 // TODO(ngeoffray): ensure GVN has been run.
616 set_.add(current); 617 set_.add(current);
617 } 618 }
618 } 619 }
619 } 620 }
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