| 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 '../common/codegen.dart' show CodegenWorkItem; | |
| 6 import '../compiler.dart' show Compiler; | 5 import '../compiler.dart' show Compiler; |
| 7 import '../constant_system_dart.dart'; | 6 import '../constant_system_dart.dart'; |
| 8 import '../constants/constant_system.dart'; | 7 import '../constants/constant_system.dart'; |
| 9 import '../constants/values.dart'; | 8 import '../constants/values.dart'; |
| 10 import '../js_backend/js_backend.dart'; | 9 import '../js_backend/js_backend.dart'; |
| 11 import 'nodes.dart'; | 10 import 'nodes.dart'; |
| 12 import 'optimize.dart'; | 11 import 'optimize.dart'; |
| 13 | 12 |
| 14 class ValueRangeInfo { | 13 class ValueRangeInfo { |
| 15 final ConstantSystem constantSystem; | 14 final ConstantSystem constantSystem; |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 * Value ranges for integer instructions. This map gets populated by | 598 * Value ranges for integer instructions. This map gets populated by |
| 600 * the dominator tree visit. | 599 * the dominator tree visit. |
| 601 */ | 600 */ |
| 602 final Map<HInstruction, Range> ranges = new Map<HInstruction, Range>(); | 601 final Map<HInstruction, Range> ranges = new Map<HInstruction, Range>(); |
| 603 | 602 |
| 604 final Compiler compiler; | 603 final Compiler compiler; |
| 605 final ConstantSystem constantSystem; | 604 final ConstantSystem constantSystem; |
| 606 final ValueRangeInfo info; | 605 final ValueRangeInfo info; |
| 607 final SsaOptimizerTask optimizer; | 606 final SsaOptimizerTask optimizer; |
| 608 | 607 |
| 609 CodegenWorkItem work; | |
| 610 HGraph graph; | 608 HGraph graph; |
| 611 | 609 |
| 612 SsaValueRangeAnalyzer( | 610 SsaValueRangeAnalyzer(this.compiler, constantSystem, this.optimizer) |
| 613 this.compiler, constantSystem, this.optimizer, this.work) | |
| 614 : info = new ValueRangeInfo(constantSystem), | 611 : info = new ValueRangeInfo(constantSystem), |
| 615 this.constantSystem = constantSystem; | 612 this.constantSystem = 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 |
| 622 // only necessary for this phase. | 619 // only necessary for this phase. |
| 623 removeRangeConversion(); | 620 removeRangeConversion(); |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 } | 1079 } |
| 1083 | 1080 |
| 1084 Range handleBinaryOperation(HBinaryArithmetic instruction) { | 1081 Range handleBinaryOperation(HBinaryArithmetic instruction) { |
| 1085 Range leftRange = visit(instruction.left); | 1082 Range leftRange = visit(instruction.left); |
| 1086 Range rightRange = visit(instruction.right); | 1083 Range rightRange = visit(instruction.right); |
| 1087 if (leftRange == null || rightRange == null) return null; | 1084 if (leftRange == null || rightRange == null) return null; |
| 1088 BinaryOperation operation = instruction.operation(info.constantSystem); | 1085 BinaryOperation operation = instruction.operation(info.constantSystem); |
| 1089 return operation.apply(leftRange, rightRange); | 1086 return operation.apply(leftRange, rightRange); |
| 1090 } | 1087 } |
| 1091 } | 1088 } |
| OLD | NEW |