| 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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 : info = new ValueRangeInfo(constantSystem), | 603 : info = new ValueRangeInfo(constantSystem), |
| 604 this.constantSystem = constantSystem; | 604 this.constantSystem = constantSystem; |
| 605 | 605 |
| 606 void visitGraph(HGraph graph) { | 606 void visitGraph(HGraph graph) { |
| 607 this.graph = graph; | 607 this.graph = graph; |
| 608 visitDominatorTree(graph); | 608 visitDominatorTree(graph); |
| 609 // We remove the range conversions after visiting the graph so | 609 // We remove the range conversions after visiting the graph so |
| 610 // that the graph does not get polluted with these instructions | 610 // that the graph does not get polluted with these instructions |
| 611 // only necessary for this phase. | 611 // only necessary for this phase. |
| 612 removeRangeConversion(); | 612 removeRangeConversion(); |
| 613 JavaScriptBackend backend = compiler.backend; |
| 614 // TODO(herhut): Find a cleaner way to pass around ranges. |
| 615 backend.optimizer.ranges = ranges; |
| 613 } | 616 } |
| 614 | 617 |
| 615 void removeRangeConversion() { | 618 void removeRangeConversion() { |
| 616 conversions.forEach((HRangeConversion instruction) { | 619 conversions.forEach((HRangeConversion instruction) { |
| 617 instruction.block.rewrite(instruction, instruction.inputs[0]);; | 620 instruction.block.rewrite(instruction, instruction.inputs[0]);; |
| 618 instruction.block.remove(instruction); | 621 instruction.block.remove(instruction); |
| 619 }); | 622 }); |
| 620 } | 623 } |
| 621 | 624 |
| 622 void visitBasicBlock(HBasicBlock block) { | 625 void visitBasicBlock(HBasicBlock block) { |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1008 } | 1011 } |
| 1009 | 1012 |
| 1010 Range handleBinaryOperation(HBinaryArithmetic instruction) { | 1013 Range handleBinaryOperation(HBinaryArithmetic instruction) { |
| 1011 Range leftRange = visit(instruction.left); | 1014 Range leftRange = visit(instruction.left); |
| 1012 Range rightRange = visit(instruction.right); | 1015 Range rightRange = visit(instruction.right); |
| 1013 if (leftRange == null || rightRange == null) return null; | 1016 if (leftRange == null || rightRange == null) return null; |
| 1014 BinaryOperation operation = instruction.operation(info.constantSystem); | 1017 BinaryOperation operation = instruction.operation(info.constantSystem); |
| 1015 return operation.apply(leftRange, rightRange); | 1018 return operation.apply(leftRange, rightRange); |
| 1016 } | 1019 } |
| 1017 } | 1020 } |
| OLD | NEW |