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

Side by Side Diff: lib/compiler/implementation/ssa/optimize.dart

Issue 10100001: Refactoring if block-information. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 computeChangesFlags(graph); 464 computeChangesFlags(graph);
465 moveLoopInvariantCode(graph); 465 moveLoopInvariantCode(graph);
466 visitBasicBlock(graph.entry, new ValueSet()); 466 visitBasicBlock(graph.entry, new ValueSet());
467 } 467 }
468 468
469 void moveLoopInvariantCode(HGraph graph) { 469 void moveLoopInvariantCode(HGraph graph) {
470 for (int i = graph.blocks.length - 1; i >= 0; i--) { 470 for (int i = graph.blocks.length - 1; i >= 0; i--) {
471 HBasicBlock block = graph.blocks[i]; 471 HBasicBlock block = graph.blocks[i];
472 if (block.isLoopHeader()) { 472 if (block.isLoopHeader()) {
473 int changesFlags = loopChangesFlags[block.id]; 473 int changesFlags = loopChangesFlags[block.id];
474 HBasicBlock last = block.loopInformation.getLastBackEdge(); 474 HLoopInformation info = block.blockInformation;
475 HBasicBlock last = info.getLastBackEdge();
475 for (int j = block.id; j <= last.id; j++) { 476 for (int j = block.id; j <= last.id; j++) {
476 moveLoopInvariantCodeFromBlock(graph.blocks[j], block, changesFlags); 477 moveLoopInvariantCodeFromBlock(graph.blocks[j], block, changesFlags);
477 } 478 }
478 } 479 }
479 } 480 }
480 } 481 }
481 482
482 void moveLoopInvariantCodeFromBlock(HBasicBlock block, 483 void moveLoopInvariantCodeFromBlock(HBasicBlock block,
483 HBasicBlock loopHeader, 484 HBasicBlock loopHeader,
484 int changesFlags) { 485 int changesFlags) {
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 } 705 }
705 } 706 }
706 if (!canBeMoved) continue; 707 if (!canBeMoved) continue;
707 708
708 // This is safe because we are running after GVN. 709 // This is safe because we are running after GVN.
709 // TODO(ngeoffray): ensure GVN has been run. 710 // TODO(ngeoffray): ensure GVN has been run.
710 set_.add(current); 711 set_.add(current);
711 } 712 }
712 } 713 }
713 } 714 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698