| 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 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 if (!left.isInteger()) return info.newUnboundRange(); | 707 if (!left.isInteger()) return info.newUnboundRange(); |
| 708 if (!right.isInteger()) return info.newUnboundRange(); | 708 if (!right.isInteger()) return info.newUnboundRange(); |
| 709 BinaryOperation operation = relational.operation(constantSystem); | 709 BinaryOperation operation = relational.operation(constantSystem); |
| 710 Range rightRange = ranges[relational.right]; | 710 Range rightRange = ranges[relational.right]; |
| 711 Range leftRange = ranges[relational.left]; | 711 Range leftRange = ranges[relational.left]; |
| 712 | 712 |
| 713 if (relational is HIdentity) { | 713 if (relational is HIdentity) { |
| 714 handleEqualityCheck(relational); | 714 handleEqualityCheck(relational); |
| 715 } else if (operation.apply(leftRange, rightRange)) { | 715 } else if (operation.apply(leftRange, rightRange)) { |
| 716 relational.block.rewrite( | 716 relational.block.rewrite( |
| 717 relational, graph.addConstantBool(true, constantSystem)); | 717 relational, graph.addConstantBool(true, compiler)); |
| 718 relational.block.remove(relational); | 718 relational.block.remove(relational); |
| 719 } else if (reverseOperation(operation).apply(leftRange, rightRange)) { | 719 } else if (reverseOperation(operation).apply(leftRange, rightRange)) { |
| 720 relational.block.rewrite( | 720 relational.block.rewrite( |
| 721 relational, graph.addConstantBool(false, constantSystem)); | 721 relational, graph.addConstantBool(false, compiler)); |
| 722 relational.block.remove(relational); | 722 relational.block.remove(relational); |
| 723 } | 723 } |
| 724 return info.newUnboundRange(); | 724 return info.newUnboundRange(); |
| 725 } | 725 } |
| 726 | 726 |
| 727 void handleEqualityCheck(HRelational node) { | 727 void handleEqualityCheck(HRelational node) { |
| 728 Range right = ranges[node.right]; | 728 Range right = ranges[node.right]; |
| 729 Range left = ranges[node.left]; | 729 Range left = ranges[node.left]; |
| 730 if (left.isSingleValue && right.isSingleValue && left == right) { | 730 if (left.isSingleValue && right.isSingleValue && left == right) { |
| 731 node.block.rewrite( | 731 node.block.rewrite( |
| 732 node, graph.addConstantBool(true, constantSystem)); | 732 node, graph.addConstantBool(true, compiler)); |
| 733 node.block.remove(node); | 733 node.block.remove(node); |
| 734 } | 734 } |
| 735 } | 735 } |
| 736 | 736 |
| 737 Range handleBinaryOperation(HBinaryArithmetic instruction) { | 737 Range handleBinaryOperation(HBinaryArithmetic instruction) { |
| 738 if (!instruction.isInteger()) return info.newUnboundRange(); | 738 if (!instruction.isInteger()) return info.newUnboundRange(); |
| 739 return instruction.operation(constantSystem).apply( | 739 return instruction.operation(constantSystem).apply( |
| 740 ranges[instruction.left], ranges[instruction.right]); | 740 ranges[instruction.left], ranges[instruction.right]); |
| 741 } | 741 } |
| 742 | 742 |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 if (instruction is HPhi && !instruction.block.isLoopHeader()) { | 986 if (instruction is HPhi && !instruction.block.isLoopHeader()) { |
| 987 HInstruction result = unwrap(instruction.inputs[0]); | 987 HInstruction result = unwrap(instruction.inputs[0]); |
| 988 for (int i = 1; i < instruction.inputs.length; i++) { | 988 for (int i = 1; i < instruction.inputs.length; i++) { |
| 989 if (result != unwrap(instruction.inputs[i])) return instruction; | 989 if (result != unwrap(instruction.inputs[i])) return instruction; |
| 990 } | 990 } |
| 991 return result; | 991 return result; |
| 992 } | 992 } |
| 993 return instruction; | 993 return instruction; |
| 994 } | 994 } |
| 995 } | 995 } |
| OLD | NEW |