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

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
« no previous file with comments | « lib/compiler/implementation/ssa/nodes.dart ('k') | tests/utils/utils.status » ('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 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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 computeChangesFlags(graph); 472 computeChangesFlags(graph);
473 moveLoopInvariantCode(graph); 473 moveLoopInvariantCode(graph);
474 visitBasicBlock(graph.entry, new ValueSet()); 474 visitBasicBlock(graph.entry, new ValueSet());
475 } 475 }
476 476
477 void moveLoopInvariantCode(HGraph graph) { 477 void moveLoopInvariantCode(HGraph graph) {
478 for (int i = graph.blocks.length - 1; i >= 0; i--) { 478 for (int i = graph.blocks.length - 1; i >= 0; i--) {
479 HBasicBlock block = graph.blocks[i]; 479 HBasicBlock block = graph.blocks[i];
480 if (block.isLoopHeader()) { 480 if (block.isLoopHeader()) {
481 int changesFlags = loopChangesFlags[block.id]; 481 int changesFlags = loopChangesFlags[block.id];
482 HBasicBlock last = block.loopInformation.getLastBackEdge(); 482 HLoopInformation info = block.blockInformation;
483 HBasicBlock last = info.getLastBackEdge();
483 for (int j = block.id; j <= last.id; j++) { 484 for (int j = block.id; j <= last.id; j++) {
484 moveLoopInvariantCodeFromBlock(graph.blocks[j], block, changesFlags); 485 moveLoopInvariantCodeFromBlock(graph.blocks[j], block, changesFlags);
485 } 486 }
486 } 487 }
487 } 488 }
488 } 489 }
489 490
490 void moveLoopInvariantCodeFromBlock(HBasicBlock block, 491 void moveLoopInvariantCodeFromBlock(HBasicBlock block,
491 HBasicBlock loopHeader, 492 HBasicBlock loopHeader,
492 int changesFlags) { 493 int changesFlags) {
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 } 713 }
713 } 714 }
714 if (!canBeMoved) continue; 715 if (!canBeMoved) continue;
715 716
716 // This is safe because we are running after GVN. 717 // This is safe because we are running after GVN.
717 // TODO(ngeoffray): ensure GVN has been run. 718 // TODO(ngeoffray): ensure GVN has been run.
718 set_.add(current); 719 set_.add(current);
719 } 720 }
720 } 721 }
721 } 722 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/nodes.dart ('k') | tests/utils/utils.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698