| 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 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 return range; | 663 return range; |
| 664 } | 664 } |
| 665 | 665 |
| 666 Range range = ranges[phi.inputs[0]]; | 666 Range range = ranges[phi.inputs[0]]; |
| 667 for (int i = 1; i < phi.inputs.length; i++) { | 667 for (int i = 1; i < phi.inputs.length; i++) { |
| 668 range = range.union(ranges[phi.inputs[i]]); | 668 range = range.union(ranges[phi.inputs[i]]); |
| 669 } | 669 } |
| 670 return range; | 670 return range; |
| 671 } | 671 } |
| 672 | 672 |
| 673 Range visitConstant(HConstant constant) { | 673 Range visitConstant(HConstant hConstant) { |
| 674 if (!constant.isInteger(compiler)) return info.newUnboundRange(); | 674 if (!hConstant.isInteger(compiler)) return info.newUnboundRange(); |
| 675 NumConstant constantNum = constant.constant; | 675 Constant constant = hConstant.constant; |
| 676 NumConstant constantNum; |
| 677 if (constant is DeferredConstant) { |
| 678 constantNum = constant.referenced; |
| 679 } else { |
| 680 constantNum = constant; |
| 681 } |
| 676 if (constantNum.isMinusZero) constantNum = new IntConstant(0); | 682 if (constantNum.isMinusZero) constantNum = new IntConstant(0); |
| 677 Value value = info.newIntValue(constantNum.value); | 683 Value value = info.newIntValue(constantNum.value); |
| 678 return info.newNormalizedRange(value, value); | 684 return info.newNormalizedRange(value, value); |
| 679 } | 685 } |
| 680 | 686 |
| 681 Range visitFieldGet(HFieldGet fieldGet) { | 687 Range visitFieldGet(HFieldGet fieldGet) { |
| 682 if (!fieldGet.isInteger(compiler)) return info.newUnboundRange(); | 688 if (!fieldGet.isInteger(compiler)) return info.newUnboundRange(); |
| 683 if (!fieldGet.receiver.isIndexablePrimitive(compiler)) { | 689 if (!fieldGet.receiver.isIndexablePrimitive(compiler)) { |
| 684 return visitInstruction(fieldGet); | 690 return visitInstruction(fieldGet); |
| 685 } | 691 } |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 } | 1050 } |
| 1045 | 1051 |
| 1046 Range handleBinaryOperation(HBinaryArithmetic instruction) { | 1052 Range handleBinaryOperation(HBinaryArithmetic instruction) { |
| 1047 Range leftRange = visit(instruction.left); | 1053 Range leftRange = visit(instruction.left); |
| 1048 Range rightRange = visit(instruction.right); | 1054 Range rightRange = visit(instruction.right); |
| 1049 if (leftRange == null || rightRange == null) return null; | 1055 if (leftRange == null || rightRange == null) return null; |
| 1050 BinaryOperation operation = instruction.operation(info.constantSystem); | 1056 BinaryOperation operation = instruction.operation(info.constantSystem); |
| 1051 return operation.apply(leftRange, rightRange); | 1057 return operation.apply(leftRange, rightRange); |
| 1052 } | 1058 } |
| 1053 } | 1059 } |
| OLD | NEW |