| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 SsaCodeGeneratorTask extends CompilerTask { | 5 class SsaCodeGeneratorTask extends CompilerTask { |
| 6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler); | 6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler); |
| 7 String get name() => 'SSA code generator'; | 7 String get name() => 'SSA code generator'; |
| 8 | 8 |
| 9 | 9 |
| 10 String generateMethod(WorkItem work, HGraph graph) { | 10 String generateMethod(WorkItem work, HGraph graph) { |
| (...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 | 842 |
| 843 visitLoopBranch(HLoopBranch node) { | 843 visitLoopBranch(HLoopBranch node) { |
| 844 HBasicBlock branchBlock = currentBlock; | 844 HBasicBlock branchBlock = currentBlock; |
| 845 handleLoopCondition(node); | 845 handleLoopCondition(node); |
| 846 List<HBasicBlock> dominated = currentBlock.dominatedBlocks; | 846 List<HBasicBlock> dominated = currentBlock.dominatedBlocks; |
| 847 // For a do while loop, the body has already been visited. | 847 // For a do while loop, the body has already been visited. |
| 848 if (!node.isDoWhile()) { | 848 if (!node.isDoWhile()) { |
| 849 visitBasicBlock(dominated[0]); | 849 visitBasicBlock(dominated[0]); |
| 850 } | 850 } |
| 851 endLoop(node.block); | 851 endLoop(node.block); |
| 852 |
| 853 // If the branch does not dominate the code after the loop, the |
| 854 // dominator will visit it. |
| 855 if (branchBlock.successors[1].dominator !== branchBlock) return; |
| 856 |
| 852 visitBasicBlock(branchBlock.successors[1]); | 857 visitBasicBlock(branchBlock.successors[1]); |
| 853 // With labeled breaks we can have more dominated blocks. | 858 // With labeled breaks we can have more dominated blocks. |
| 854 if (dominated.length >= 3) { | 859 if (dominated.length >= 3) { |
| 855 for (int i = 2; i < dominated.length; i++) { | 860 for (int i = 2; i < dominated.length; i++) { |
| 856 visitBasicBlock(dominated[i]); | 861 visitBasicBlock(dominated[i]); |
| 857 } | 862 } |
| 858 } | 863 } |
| 859 } | 864 } |
| 860 | 865 |
| 861 visitNot(HNot node) { | 866 visitNot(HNot node) { |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1556 startBailoutSwitch(); | 1561 startBailoutSwitch(); |
| 1557 } | 1562 } |
| 1558 } | 1563 } |
| 1559 | 1564 |
| 1560 void endElse(HIf node) { | 1565 void endElse(HIf node) { |
| 1561 if (node.elseBlock.hasGuards()) { | 1566 if (node.elseBlock.hasGuards()) { |
| 1562 endBailoutSwitch(); | 1567 endBailoutSwitch(); |
| 1563 } | 1568 } |
| 1564 } | 1569 } |
| 1565 } | 1570 } |
| OLD | NEW |