Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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) && current.usedBy.isEmpty()) { |
|
ahe
2012/03/05 22:58:35
Not sure about this.
Lasse Reichstein Nielsen
2012/03/06 08:57:14
If it isn't empty, we will hit an assert in remove
ahe
2012/03/06 09:16:50
I don't understand what you're talking about. I do
| |
| 330 block.removePhi(current); | 330 block.removePhi(current); |
| 331 } | 331 } |
| 332 current = next; | 332 current = next; |
| 333 } | 333 } |
| 334 } | 334 } |
| 335 } | 335 } |
| 336 } | 336 } |
| 337 | 337 |
| 338 class SsaRedundantPhiEliminator implements OptimizationPhase { | 338 class SsaRedundantPhiEliminator implements OptimizationPhase { |
| 339 final String name = "SsaRedundantPhiEliminator"; | 339 final String name = "SsaRedundantPhiEliminator"; |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 636 } | 636 } |
| 637 } | 637 } |
| 638 if (!canBeMoved) continue; | 638 if (!canBeMoved) continue; |
| 639 | 639 |
| 640 // This is safe because we are running after GVN. | 640 // This is safe because we are running after GVN. |
| 641 // TODO(ngeoffray): ensure GVN has been run. | 641 // TODO(ngeoffray): ensure GVN has been run. |
| 642 set_.add(current); | 642 set_.add(current); |
| 643 } | 643 } |
| 644 } | 644 } |
| 645 } | 645 } |
| OLD | NEW |