| 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 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 return false; | 1013 return false; |
| 1014 } | 1014 } |
| 1015 HInstruction next = current.next; | 1015 HInstruction next = current.next; |
| 1016 if (next == null) { | 1016 if (next == null) { |
| 1017 // We do not merge blocks in our SSA graph, so if this block just jumps | 1017 // We do not merge blocks in our SSA graph, so if this block just jumps |
| 1018 // to a single successor, visit the successor, avoiding back-edges. | 1018 // to a single successor, visit the successor, avoiding back-edges. |
| 1019 HBasicBlock successor; | 1019 HBasicBlock successor; |
| 1020 if (current is HGoto) { | 1020 if (current is HGoto) { |
| 1021 successor = current.block.successors.single; | 1021 successor = current.block.successors.single; |
| 1022 } else if (current is HIf) { | 1022 } else if (current is HIf) { |
| 1023 // TODO(paulberry): This variable works around dartbug.com/22732 |
| 1024 HIf currentHIf = current; |
| 1023 // We also leave HIf nodes in place when one branch is dead. | 1025 // We also leave HIf nodes in place when one branch is dead. |
| 1024 HInstruction condition = current.inputs.first; | 1026 HInstruction condition = current.inputs.first; |
| 1025 if (condition is HConstant) { | 1027 if (condition is HConstant) { |
| 1026 bool isTrue = condition.constant.isTrue; | 1028 bool isTrue = condition.constant.isTrue; |
| 1027 successor = isTrue ? current.thenBlock : current.elseBlock; | 1029 successor = isTrue ? currentHIf.thenBlock : currentHIf.elseBlock; |
| 1028 assert(!analyzer.isDeadBlock(successor)); | 1030 assert(!analyzer.isDeadBlock(successor)); |
| 1029 } | 1031 } |
| 1030 } | 1032 } |
| 1031 if (successor != null && successor.id > current.block.id) { | 1033 if (successor != null && successor.id > current.block.id) { |
| 1032 next = successor.first; | 1034 next = successor.first; |
| 1033 } | 1035 } |
| 1034 } | 1036 } |
| 1035 current = next; | 1037 current = next; |
| 1036 } while (current != null); | 1038 } while (current != null); |
| 1037 return false; | 1039 return false; |
| (...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2202 | 2204 |
| 2203 keyedValues.forEach((receiver, values) { | 2205 keyedValues.forEach((receiver, values) { |
| 2204 result.keyedValues[receiver] = | 2206 result.keyedValues[receiver] = |
| 2205 new Map<HInstruction, HInstruction>.from(values); | 2207 new Map<HInstruction, HInstruction>.from(values); |
| 2206 }); | 2208 }); |
| 2207 | 2209 |
| 2208 result.nonEscapingReceivers.addAll(nonEscapingReceivers); | 2210 result.nonEscapingReceivers.addAll(nonEscapingReceivers); |
| 2209 return result; | 2211 return result; |
| 2210 } | 2212 } |
| 2211 } | 2213 } |
| OLD | NEW |