| 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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 Range visitConstant(HConstant hConstant) { | 676 Range visitConstant(HConstant hConstant) { |
| 677 if (!hConstant.isInteger(compiler)) return info.newUnboundRange(); | 677 if (!hConstant.isInteger(compiler)) return info.newUnboundRange(); |
| 678 ConstantValue constant = hConstant.constant; | 678 ConstantValue constant = hConstant.constant; |
| 679 NumConstantValue constantNum; | 679 NumConstantValue constantNum; |
| 680 if (constant is DeferredConstantValue) { | 680 if (constant is DeferredConstantValue) { |
| 681 constantNum = constant.referenced; | 681 constantNum = constant.referenced; |
| 682 } else { | 682 } else { |
| 683 constantNum = constant; | 683 constantNum = constant; |
| 684 } | 684 } |
| 685 if (constantNum.isMinusZero) constantNum = new IntConstantValue(0); | 685 if (constantNum.isMinusZero) constantNum = new IntConstantValue(0); |
| 686 if (constantNum.isPositiveInfinity || constantNum.isNegativeInfinity) { |
| 687 return info.newUnboundRange(); |
| 688 } |
| 686 Value value = info.newIntValue(constantNum.primitiveValue); | 689 Value value = info.newIntValue(constantNum.primitiveValue); |
| 687 return info.newNormalizedRange(value, value); | 690 return info.newNormalizedRange(value, value); |
| 688 } | 691 } |
| 689 | 692 |
| 690 Range visitFieldGet(HFieldGet fieldGet) { | 693 Range visitFieldGet(HFieldGet fieldGet) { |
| 691 if (!fieldGet.isInteger(compiler)) return info.newUnboundRange(); | 694 if (!fieldGet.isInteger(compiler)) return info.newUnboundRange(); |
| 692 if (!fieldGet.receiver.isIndexablePrimitive(compiler)) { | 695 if (!fieldGet.receiver.isIndexablePrimitive(compiler)) { |
| 693 return visitInstruction(fieldGet); | 696 return visitInstruction(fieldGet); |
| 694 } | 697 } |
| 695 JavaScriptBackend backend = compiler.backend; | 698 JavaScriptBackend backend = compiler.backend; |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 } | 1078 } |
| 1076 | 1079 |
| 1077 Range handleBinaryOperation(HBinaryArithmetic instruction) { | 1080 Range handleBinaryOperation(HBinaryArithmetic instruction) { |
| 1078 Range leftRange = visit(instruction.left); | 1081 Range leftRange = visit(instruction.left); |
| 1079 Range rightRange = visit(instruction.right); | 1082 Range rightRange = visit(instruction.right); |
| 1080 if (leftRange == null || rightRange == null) return null; | 1083 if (leftRange == null || rightRange == null) return null; |
| 1081 BinaryOperation operation = instruction.operation(info.constantSystem); | 1084 BinaryOperation operation = instruction.operation(info.constantSystem); |
| 1082 return operation.apply(leftRange, rightRange); | 1085 return operation.apply(leftRange, rightRange); |
| 1083 } | 1086 } |
| 1084 } | 1087 } |
| OLD | NEW |