| 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 import '../compiler.dart' show Compiler; | 5 import '../compiler.dart' show Compiler; |
| 6 import '../constant_system_dart.dart'; | 6 import '../constant_system_dart.dart'; |
| 7 import '../constants/constant_system.dart'; | 7 import '../constants/constant_system.dart'; |
| 8 import '../constants/values.dart'; | 8 import '../constants/values.dart'; |
| 9 import '../js_backend/js_backend.dart'; | 9 import '../js_backend/js_backend.dart'; |
| 10 import '../world.dart' show ClosedWorld; | 10 import '../world.dart' show ClosedWorld; |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 */ | 595 */ |
| 596 final List<HRangeConversion> conversions = <HRangeConversion>[]; | 596 final List<HRangeConversion> conversions = <HRangeConversion>[]; |
| 597 | 597 |
| 598 /** | 598 /** |
| 599 * Value ranges for integer instructions. This map gets populated by | 599 * Value ranges for integer instructions. This map gets populated by |
| 600 * the dominator tree visit. | 600 * the dominator tree visit. |
| 601 */ | 601 */ |
| 602 final Map<HInstruction, Range> ranges = new Map<HInstruction, Range>(); | 602 final Map<HInstruction, Range> ranges = new Map<HInstruction, Range>(); |
| 603 | 603 |
| 604 final Compiler compiler; | 604 final Compiler compiler; |
| 605 final ClosedWorld closedWorld; |
| 605 final ConstantSystem constantSystem; | 606 final ConstantSystem constantSystem; |
| 606 final ValueRangeInfo info; | 607 final ValueRangeInfo info; |
| 607 final SsaOptimizerTask optimizer; | 608 final SsaOptimizerTask optimizer; |
| 608 | 609 |
| 609 HGraph graph; | 610 HGraph graph; |
| 610 | 611 |
| 611 SsaValueRangeAnalyzer(this.compiler, constantSystem, this.optimizer) | 612 SsaValueRangeAnalyzer( |
| 613 this.compiler, this.closedWorld, constantSystem, this.optimizer) |
| 612 : info = new ValueRangeInfo(constantSystem), | 614 : info = new ValueRangeInfo(constantSystem), |
| 613 this.constantSystem = constantSystem; | 615 this.constantSystem = constantSystem; |
| 614 | 616 |
| 615 ClosedWorld get closedWorld => compiler.closedWorld; | |
| 616 | |
| 617 void visitGraph(HGraph graph) { | 617 void visitGraph(HGraph graph) { |
| 618 this.graph = graph; | 618 this.graph = graph; |
| 619 visitDominatorTree(graph); | 619 visitDominatorTree(graph); |
| 620 // We remove the range conversions after visiting the graph so | 620 // We remove the range conversions after visiting the graph so |
| 621 // that the graph does not get polluted with these instructions | 621 // that the graph does not get polluted with these instructions |
| 622 // only necessary for this phase. | 622 // only necessary for this phase. |
| 623 removeRangeConversion(); | 623 removeRangeConversion(); |
| 624 // TODO(herhut): Find a cleaner way to pass around ranges. | 624 // TODO(herhut): Find a cleaner way to pass around ranges. |
| 625 optimizer.ranges = ranges; | 625 optimizer.ranges = ranges; |
| 626 } | 626 } |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 } | 1082 } |
| 1083 | 1083 |
| 1084 Range handleBinaryOperation(HBinaryArithmetic instruction) { | 1084 Range handleBinaryOperation(HBinaryArithmetic instruction) { |
| 1085 Range leftRange = visit(instruction.left); | 1085 Range leftRange = visit(instruction.left); |
| 1086 Range rightRange = visit(instruction.right); | 1086 Range rightRange = visit(instruction.right); |
| 1087 if (leftRange == null || rightRange == null) return null; | 1087 if (leftRange == null || rightRange == null) return null; |
| 1088 BinaryOperation operation = instruction.operation(info.constantSystem); | 1088 BinaryOperation operation = instruction.operation(info.constantSystem); |
| 1089 return operation.apply(leftRange, rightRange); | 1089 return operation.apply(leftRange, rightRange); |
| 1090 } | 1090 } |
| 1091 } | 1091 } |
| OLD | NEW |