| 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 '../constant_system_dart.dart'; | 5 import '../constant_system_dart.dart'; |
| 6 import '../constants/constant_system.dart'; | 6 import '../constants/constant_system.dart'; |
| 7 import '../constants/values.dart'; | 7 import '../constants/values.dart'; |
| 8 import '../js_backend/backend_helpers.dart'; | |
| 9 import '../world.dart' show ClosedWorld; | 8 import '../world.dart' show ClosedWorld; |
| 10 import 'nodes.dart'; | 9 import 'nodes.dart'; |
| 11 import 'optimize.dart'; | 10 import 'optimize.dart'; |
| 12 | 11 |
| 13 class ValueRangeInfo { | 12 class ValueRangeInfo { |
| 14 final ConstantSystem constantSystem; | 13 final ConstantSystem constantSystem; |
| 15 | 14 |
| 16 IntValue intZero; | 15 IntValue intZero; |
| 17 IntValue intOne; | 16 IntValue intOne; |
| 18 | 17 |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 * save them here in order to remove them once the phase is done. | 592 * save them here in order to remove them once the phase is done. |
| 594 */ | 593 */ |
| 595 final List<HRangeConversion> conversions = <HRangeConversion>[]; | 594 final List<HRangeConversion> conversions = <HRangeConversion>[]; |
| 596 | 595 |
| 597 /** | 596 /** |
| 598 * Value ranges for integer instructions. This map gets populated by | 597 * Value ranges for integer instructions. This map gets populated by |
| 599 * the dominator tree visit. | 598 * the dominator tree visit. |
| 600 */ | 599 */ |
| 601 final Map<HInstruction, Range> ranges = new Map<HInstruction, Range>(); | 600 final Map<HInstruction, Range> ranges = new Map<HInstruction, Range>(); |
| 602 | 601 |
| 603 final BackendHelpers backendHelpers; | |
| 604 final ClosedWorld closedWorld; | 602 final ClosedWorld closedWorld; |
| 605 final ValueRangeInfo info; | 603 final ValueRangeInfo info; |
| 606 final SsaOptimizerTask optimizer; | 604 final SsaOptimizerTask optimizer; |
| 607 | 605 |
| 608 HGraph graph; | 606 HGraph graph; |
| 609 | 607 |
| 610 SsaValueRangeAnalyzer( | 608 SsaValueRangeAnalyzer(ClosedWorld closedWorld, this.optimizer) |
| 611 this.backendHelpers, ClosedWorld closedWorld, this.optimizer) | |
| 612 : info = new ValueRangeInfo(closedWorld.constantSystem), | 609 : info = new ValueRangeInfo(closedWorld.constantSystem), |
| 613 this.closedWorld = closedWorld; | 610 this.closedWorld = closedWorld; |
| 614 | 611 |
| 615 ConstantSystem get constantSystem => closedWorld.constantSystem; | 612 ConstantSystem get constantSystem => closedWorld.constantSystem; |
| 616 | 613 |
| 617 void visitGraph(HGraph graph) { | 614 void visitGraph(HGraph graph) { |
| 618 this.graph = graph; | 615 this.graph = graph; |
| 619 visitDominatorTree(graph); | 616 visitDominatorTree(graph); |
| 620 // We remove the range conversions after visiting the graph so | 617 // We remove the range conversions after visiting the graph so |
| 621 // that the graph does not get polluted with these instructions | 618 // that the graph does not get polluted with these instructions |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 } | 1101 } |
| 1105 | 1102 |
| 1106 Range handleBinaryOperation(HBinaryArithmetic instruction) { | 1103 Range handleBinaryOperation(HBinaryArithmetic instruction) { |
| 1107 Range leftRange = visit(instruction.left); | 1104 Range leftRange = visit(instruction.left); |
| 1108 Range rightRange = visit(instruction.right); | 1105 Range rightRange = visit(instruction.right); |
| 1109 if (leftRange == null || rightRange == null) return null; | 1106 if (leftRange == null || rightRange == null) return null; |
| 1110 BinaryOperation operation = instruction.operation(info.constantSystem); | 1107 BinaryOperation operation = instruction.operation(info.constantSystem); |
| 1111 return operation.apply(leftRange, rightRange); | 1108 return operation.apply(leftRange, rightRange); |
| 1112 } | 1109 } |
| 1113 } | 1110 } |
| OLD | NEW |