| 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 | 7 |
| 8 class ValueRangeInfo { | 8 class ValueRangeInfo { |
| 9 final ConstantSystem constantSystem; | 9 final ConstantSystem constantSystem; |
| 10 | 10 |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 } | 608 } |
| 609 | 609 |
| 610 Range visitParameterValue(HParameterValue parameter) { | 610 Range visitParameterValue(HParameterValue parameter) { |
| 611 if (!parameter.isInteger()) return info.newUnboundRange(); | 611 if (!parameter.isInteger()) return info.newUnboundRange(); |
| 612 Value value = info.newInstructionValue(parameter); | 612 Value value = info.newInstructionValue(parameter); |
| 613 return info.newNormalizedRange(value, value); | 613 return info.newNormalizedRange(value, value); |
| 614 } | 614 } |
| 615 | 615 |
| 616 Range visitPhi(HPhi phi) { | 616 Range visitPhi(HPhi phi) { |
| 617 if (!phi.isInteger()) return info.newUnboundRange(); | 617 if (!phi.isInteger()) return info.newUnboundRange(); |
| 618 // Some phases may replace instructions that change the inputs of |
| 619 // this phi. Only the [SsaTypesPropagation] phase will update the |
| 620 // phi type. Play it safe by assuming the [SsaTypesPropagation] |
| 621 // phase is not necessarily run before the [ValueRangeAnalyzer]. |
| 622 if (phi.inputs.any((i) => !i.isInteger())) return info.newUnboundRange(); |
| 618 if (phi.block.isLoopHeader()) { | 623 if (phi.block.isLoopHeader()) { |
| 619 Range range = tryInferLoopPhiRange(phi); | 624 Range range = tryInferLoopPhiRange(phi); |
| 620 if (range == null) return info.newUnboundRange(); | 625 if (range == null) return info.newUnboundRange(); |
| 621 return range; | 626 return range; |
| 622 } | 627 } |
| 623 | 628 |
| 624 Range range = ranges[phi.inputs[0]]; | 629 Range range = ranges[phi.inputs[0]]; |
| 625 for (int i = 1; i < phi.inputs.length; i++) { | 630 for (int i = 1; i < phi.inputs.length; i++) { |
| 626 range = range.union(ranges[phi.inputs[i]]); | 631 range = range.union(ranges[phi.inputs[i]]); |
| 627 } | 632 } |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 if (instruction is HPhi && !instruction.block.isLoopHeader()) { | 1003 if (instruction is HPhi && !instruction.block.isLoopHeader()) { |
| 999 HInstruction result = unwrap(instruction.inputs[0]); | 1004 HInstruction result = unwrap(instruction.inputs[0]); |
| 1000 for (int i = 1; i < instruction.inputs.length; i++) { | 1005 for (int i = 1; i < instruction.inputs.length; i++) { |
| 1001 if (result != unwrap(instruction.inputs[i])) return instruction; | 1006 if (result != unwrap(instruction.inputs[i])) return instruction; |
| 1002 } | 1007 } |
| 1003 return result; | 1008 return result; |
| 1004 } | 1009 } |
| 1005 return instruction; | 1010 return instruction; |
| 1006 } | 1011 } |
| 1007 } | 1012 } |
| OLD | NEW |