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 part of ssa; | 5 part of ssa; |
6 | 6 |
7 abstract class OptimizationPhase { | 7 abstract class OptimizationPhase { |
8 String get name; | 8 String get name; |
9 void visitGraph(HGraph graph); | 9 void visitGraph(HGraph graph); |
10 } | 10 } |
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 void moveLoopInvariantCodeFromBlock(HBasicBlock block, | 1166 void moveLoopInvariantCodeFromBlock(HBasicBlock block, |
1167 HBasicBlock loopHeader, | 1167 HBasicBlock loopHeader, |
1168 int changesFlags) { | 1168 int changesFlags) { |
1169 assert(block.parentLoopHeader == loopHeader); | 1169 assert(block.parentLoopHeader == loopHeader); |
1170 HBasicBlock preheader = loopHeader.predecessors[0]; | 1170 HBasicBlock preheader = loopHeader.predecessors[0]; |
1171 int dependsFlags = SideEffects.computeDependsOnFlags(changesFlags); | 1171 int dependsFlags = SideEffects.computeDependsOnFlags(changesFlags); |
1172 HInstruction instruction = block.first; | 1172 HInstruction instruction = block.first; |
1173 while (instruction != null) { | 1173 while (instruction != null) { |
1174 HInstruction next = instruction.next; | 1174 HInstruction next = instruction.next; |
1175 if (instruction.useGvn() | 1175 if (instruction.useGvn() |
1176 && (instruction is !HCheck) | 1176 && !instruction.canThrow() |
1177 && !instruction.sideEffects.dependsOn(dependsFlags)) { | 1177 && !instruction.sideEffects.dependsOn(dependsFlags)) { |
1178 bool loopInvariantInputs = true; | 1178 bool loopInvariantInputs = true; |
1179 List<HInstruction> inputs = instruction.inputs; | 1179 List<HInstruction> inputs = instruction.inputs; |
1180 for (int i = 0, length = inputs.length; i < length; i++) { | 1180 for (int i = 0, length = inputs.length; i < length; i++) { |
1181 if (isInputDefinedAfterDominator(inputs[i], preheader)) { | 1181 if (isInputDefinedAfterDominator(inputs[i], preheader)) { |
1182 loopInvariantInputs = false; | 1182 loopInvariantInputs = false; |
1183 break; | 1183 break; |
1184 } | 1184 } |
1185 } | 1185 } |
1186 | 1186 |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1706 HBasicBlock block = user.block; | 1706 HBasicBlock block = user.block; |
1707 block.addAfter(user, interceptor); | 1707 block.addAfter(user, interceptor); |
1708 block.rewrite(user, interceptor); | 1708 block.rewrite(user, interceptor); |
1709 block.remove(user); | 1709 block.remove(user); |
1710 | 1710 |
1711 // The interceptor will be removed in the dead code elimination | 1711 // The interceptor will be removed in the dead code elimination |
1712 // phase. Note that removing it here would not work because of how | 1712 // phase. Note that removing it here would not work because of how |
1713 // the [visitBasicBlock] is implemented. | 1713 // the [visitBasicBlock] is implemented. |
1714 } | 1714 } |
1715 } | 1715 } |
OLD | NEW |