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

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

Issue 9599026: Generate code for some switch statements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add a few 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
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 interface OptimizationPhase { 5 interface OptimizationPhase {
6 String get name(); 6 String get name();
7 void visitGraph(HGraph graph); 7 void visitGraph(HGraph graph);
8 } 8 }
9 9
10 class SsaOptimizerTask extends CompilerTask { 10 class SsaOptimizerTask extends CompilerTask {
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 // phis that they might use. 319 // phis that they might use.
320 // NOTICE: Doesn't handle circular references, but we don't currently 320 // NOTICE: Doesn't handle circular references, but we don't currently
321 // create any. 321 // create any.
322 List<HBasicBlock> blocks = graph.blocks; 322 List<HBasicBlock> blocks = graph.blocks;
323 for (int i = blocks.length - 1; i >= 0; i--) { 323 for (int i = blocks.length - 1; i >= 0; i--) {
324 HBasicBlock block = blocks[i]; 324 HBasicBlock block = blocks[i];
325 HPhi current = block.phis.first; 325 HPhi current = block.phis.first;
326 HPhi next = null; 326 HPhi next = null;
327 while (current != null) { 327 while (current != null) {
328 next = current.next; 328 next = current.next;
329 if (!livePhis.contains(current)) { 329 if (!livePhis.contains(current)
330 // TODO(ahe): Not sure the following is correct.
ngeoffray 2012/03/06 11:49:48 Why did you need to add this? Was it on one test c
ahe 2012/03/06 12:24:35 Just one test case, I think.
ngeoffray 2012/03/06 12:32:55 Worth fixing? I'd rather keep the bug and try to f
ahe 2012/03/06 13:10:51 I wanted to get rid of the assertion error. This i
ngeoffray 2012/03/07 08:55:31 But you're fixing a symptom, not the bug. I think
331 && current.usedBy.isEmpty()) {
330 block.removePhi(current); 332 block.removePhi(current);
331 } 333 }
332 current = next; 334 current = next;
333 } 335 }
334 } 336 }
335 } 337 }
336 } 338 }
337 339
338 class SsaRedundantPhiEliminator implements OptimizationPhase { 340 class SsaRedundantPhiEliminator implements OptimizationPhase {
339 final String name = "SsaRedundantPhiEliminator"; 341 final String name = "SsaRedundantPhiEliminator";
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 } 638 }
637 } 639 }
638 if (!canBeMoved) continue; 640 if (!canBeMoved) continue;
639 641
640 // This is safe because we are running after GVN. 642 // This is safe because we are running after GVN.
641 // TODO(ngeoffray): ensure GVN has been run. 643 // TODO(ngeoffray): ensure GVN has been run.
642 set_.add(current); 644 set_.add(current);
643 } 645 }
644 } 646 }
645 } 647 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698