| 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 part of ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 class HValidator extends HInstructionVisitor { | 7 class HValidator extends HInstructionVisitor { |
| 8 bool isValid = true; | 8 bool isValid = true; |
| 9 HGraph graph; | 9 HGraph graph; |
| 10 | 10 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 | 74 |
| 75 // Check that the entries in the dominated-list are sorted. | 75 // Check that the entries in the dominated-list are sorted. |
| 76 int lastId = 0; | 76 int lastId = 0; |
| 77 for (HBasicBlock dominated in block.dominatedBlocks) { | 77 for (HBasicBlock dominated in block.dominatedBlocks) { |
| 78 if (!isValid) break; | 78 if (!isValid) break; |
| 79 if (!identical(dominated.dominator, block)) { | 79 if (!identical(dominated.dominator, block)) { |
| 80 markInvalid("dominated block not pointing back"); | 80 markInvalid("dominated block not pointing back"); |
| 81 } | 81 } |
| 82 if (dominated.id == null || dominated.id <= lastId) { | 82 if (dominated.id == null || dominated.id <= lastId) { |
| 83 markInvalid("dominated.id === null or dominated has <= id"); | 83 markInvalid("dominated.id == null or dominated has <= id"); |
| 84 } | 84 } |
| 85 lastId = dominated.id; | 85 lastId = dominated.id; |
| 86 } | 86 } |
| 87 | 87 |
| 88 if (!isValid) return; | 88 if (!isValid) return; |
| 89 block.forEachPhi(visitInstruction); | 89 block.forEachPhi(visitInstruction); |
| 90 | 90 |
| 91 // Check that the blocks of the parameters of a phi are dominating the | 91 // Check that the blocks of the parameters of a phi are dominating the |
| 92 // corresponding predecessor block. Note that a block dominates | 92 // corresponding predecessor block. Note that a block dominates |
| 93 // itself. | 93 // itself. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 markInvalid("Instruction in wrong block"); | 172 markInvalid("Instruction in wrong block"); |
| 173 } | 173 } |
| 174 if (!hasCorrectInputs()) { | 174 if (!hasCorrectInputs()) { |
| 175 markInvalid("Incorrect inputs"); | 175 markInvalid("Incorrect inputs"); |
| 176 } | 176 } |
| 177 if (!hasCorrectUses()) { | 177 if (!hasCorrectUses()) { |
| 178 markInvalid("Incorrect uses"); | 178 markInvalid("Incorrect uses"); |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 } | 181 } |
| OLD | NEW |