| 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 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 return ranges[instruction.checkedInput]; | 778 return ranges[instruction.checkedInput]; |
| 779 } | 779 } |
| 780 | 780 |
| 781 HInstruction createRangeConversion(HInstruction cursor, | 781 HInstruction createRangeConversion(HInstruction cursor, |
| 782 HInstruction instruction) { | 782 HInstruction instruction) { |
| 783 HRangeConversion newInstruction = new HRangeConversion(instruction); | 783 HRangeConversion newInstruction = new HRangeConversion(instruction); |
| 784 conversions.add(newInstruction); | 784 conversions.add(newInstruction); |
| 785 cursor.block.addBefore(cursor, newInstruction); | 785 cursor.block.addBefore(cursor, newInstruction); |
| 786 // Update the users of the instruction dominated by [cursor] to | 786 // Update the users of the instruction dominated by [cursor] to |
| 787 // use the new instruction, that has an narrower range. | 787 // use the new instruction, that has an narrower range. |
| 788 Set<HInstruction> dominatedUsers = instruction.dominatedUsers(cursor); | 788 instruction.replaceAllUsersDominatedBy(cursor, newInstruction); |
| 789 for (HInstruction user in dominatedUsers) { | |
| 790 user.changeUse(instruction, newInstruction); | |
| 791 } | |
| 792 return newInstruction; | 789 return newInstruction; |
| 793 } | 790 } |
| 794 | 791 |
| 795 static BinaryOperation reverseOperation(BinaryOperation operation) { | 792 static BinaryOperation reverseOperation(BinaryOperation operation) { |
| 796 if (operation == const LessOperation()) { | 793 if (operation == const LessOperation()) { |
| 797 return const GreaterEqualOperation(); | 794 return const GreaterEqualOperation(); |
| 798 } else if (operation == const LessEqualOperation()) { | 795 } else if (operation == const LessEqualOperation()) { |
| 799 return const GreaterOperation(); | 796 return const GreaterOperation(); |
| 800 } else if (operation == const GreaterOperation()) { | 797 } else if (operation == const GreaterOperation()) { |
| 801 return const LessEqualOperation(); | 798 return const LessEqualOperation(); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 if (instruction is HPhi && !instruction.block.isLoopHeader()) { | 983 if (instruction is HPhi && !instruction.block.isLoopHeader()) { |
| 987 HInstruction result = unwrap(instruction.inputs[0]); | 984 HInstruction result = unwrap(instruction.inputs[0]); |
| 988 for (int i = 1; i < instruction.inputs.length; i++) { | 985 for (int i = 1; i < instruction.inputs.length; i++) { |
| 989 if (result != unwrap(instruction.inputs[i])) return instruction; | 986 if (result != unwrap(instruction.inputs[i])) return instruction; |
| 990 } | 987 } |
| 991 return result; | 988 return result; |
| 992 } | 989 } |
| 993 return instruction; | 990 return instruction; |
| 994 } | 991 } |
| 995 } | 992 } |
| OLD | NEW |