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 // TODO(herhut): Find a better way to pass around ranges | |
614 (compiler.backend as JavaScriptBackend).optimizer.ranges = ranges; | |
karlklose
2014/03/12 14:43:45
Do you want the explicit type check here?
Conside
herhut
2014/03/13 13:27:45
Done.
| |
613 } | 615 } |
614 | 616 |
615 void removeRangeConversion() { | 617 void removeRangeConversion() { |
616 conversions.forEach((HRangeConversion instruction) { | 618 conversions.forEach((HRangeConversion instruction) { |
617 instruction.block.rewrite(instruction, instruction.inputs[0]);; | 619 instruction.block.rewrite(instruction, instruction.inputs[0]);; |
618 instruction.block.remove(instruction); | 620 instruction.block.remove(instruction); |
619 }); | 621 }); |
620 } | 622 } |
621 | 623 |
622 void visitBasicBlock(HBasicBlock block) { | 624 void visitBasicBlock(HBasicBlock block) { |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1008 } | 1010 } |
1009 | 1011 |
1010 Range handleBinaryOperation(HBinaryArithmetic instruction) { | 1012 Range handleBinaryOperation(HBinaryArithmetic instruction) { |
1011 Range leftRange = visit(instruction.left); | 1013 Range leftRange = visit(instruction.left); |
1012 Range rightRange = visit(instruction.right); | 1014 Range rightRange = visit(instruction.right); |
1013 if (leftRange == null || rightRange == null) return null; | 1015 if (leftRange == null || rightRange == null) return null; |
1014 BinaryOperation operation = instruction.operation(info.constantSystem); | 1016 BinaryOperation operation = instruction.operation(info.constantSystem); |
1015 return operation.apply(leftRange, rightRange); | 1017 return operation.apply(leftRange, rightRange); |
1016 } | 1018 } |
1017 } | 1019 } |
OLD | NEW |