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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 assert(range != null); | 627 assert(range != null); |
628 ranges[instruction] = range; | 628 ranges[instruction] = range; |
629 } | 629 } |
630 } | 630 } |
631 | 631 |
632 block.forEachPhi(visit); | 632 block.forEachPhi(visit); |
633 block.forEachInstruction(visit); | 633 block.forEachInstruction(visit); |
634 } | 634 } |
635 | 635 |
636 Range visitInstruction(HInstruction instruction) { | 636 Range visitInstruction(HInstruction instruction) { |
637 if (instruction.isUInt32(compiler)) { | 637 if (instruction.isPositiveInteger(compiler)) { |
638 return info.newNormalizedRange( | 638 return info.newNormalizedRange( |
639 info.intZero, info.newPositiveValue(instruction)); | 639 info.intZero, info.newPositiveValue(instruction)); |
640 } else if (instruction.isInteger(compiler)) { | 640 } else if (instruction.isInteger(compiler)) { |
641 InstructionValue value = info.newInstructionValue(instruction); | 641 InstructionValue value = info.newInstructionValue(instruction); |
642 return info.newNormalizedRange(value, value); | 642 return info.newNormalizedRange(value, value); |
643 } else { | 643 } else { |
644 return info.newUnboundRange(); | 644 return info.newUnboundRange(); |
645 } | 645 } |
646 } | 646 } |
647 | 647 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 if (left.isInteger(compiler)) { | 817 if (left.isInteger(compiler)) { |
818 return tryComputeRange(left); | 818 return tryComputeRange(left); |
819 } else if (right.isInteger(compiler)) { | 819 } else if (right.isInteger(compiler)) { |
820 return tryComputeRange(right); | 820 return tryComputeRange(right); |
821 } | 821 } |
822 return info.newUnboundRange(); | 822 return info.newUnboundRange(); |
823 } | 823 } |
824 | 824 |
825 Range visitCheck(HCheck instruction) { | 825 Range visitCheck(HCheck instruction) { |
826 if (ranges[instruction.checkedInput] == null) { | 826 if (ranges[instruction.checkedInput] == null) { |
827 return info.newUnboundRange(); | 827 return visitInstruction(instruction); |
828 } | 828 } |
829 return ranges[instruction.checkedInput]; | 829 return ranges[instruction.checkedInput]; |
830 } | 830 } |
831 | 831 |
832 HInstruction createRangeConversion(HInstruction cursor, | 832 HInstruction createRangeConversion(HInstruction cursor, |
833 HInstruction instruction) { | 833 HInstruction instruction) { |
834 JavaScriptBackend backend = compiler.backend; | 834 JavaScriptBackend backend = compiler.backend; |
835 HRangeConversion newInstruction = | 835 HRangeConversion newInstruction = |
836 new HRangeConversion(instruction, backend.intType); | 836 new HRangeConversion(instruction, backend.intType); |
837 conversions.add(newInstruction); | 837 conversions.add(newInstruction); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 } | 1007 } |
1008 | 1008 |
1009 Range handleBinaryOperation(HBinaryArithmetic instruction) { | 1009 Range handleBinaryOperation(HBinaryArithmetic instruction) { |
1010 Range leftRange = visit(instruction.left); | 1010 Range leftRange = visit(instruction.left); |
1011 Range rightRange = visit(instruction.right); | 1011 Range rightRange = visit(instruction.right); |
1012 if (leftRange == null || rightRange == null) return null; | 1012 if (leftRange == null || rightRange == null) return null; |
1013 BinaryOperation operation = instruction.operation(info.constantSystem); | 1013 BinaryOperation operation = instruction.operation(info.constantSystem); |
1014 return operation.apply(leftRange, rightRange); | 1014 return operation.apply(leftRange, rightRange); |
1015 } | 1015 } |
1016 } | 1016 } |
OLD | NEW |