Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/ssa/value_range_analyzer.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/ssa/value_range_analyzer.dart b/sdk/lib/_internal/compiler/implementation/ssa/value_range_analyzer.dart |
| index f58002930542c2b2d5ecb7d53e5696386a7f60cf..dc3f53ed12440bf1d3c90f986a5320d58c09d172 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/ssa/value_range_analyzer.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/ssa/value_range_analyzer.dart |
| @@ -899,6 +899,20 @@ class SsaValueRangeAnalyzer extends HBaseVisitor implements OptimizationPhase { |
| } |
| } |
| + static BinaryOperation mirrorOperation(BinaryOperation operation) { |
|
Kevin Millikin (Google)
2014/07/07 14:23:31
'flipOperation'? Since mirrors is a thing in Dart
floitsch
2014/07/07 16:02:49
Done.
|
| + if (operation == const LessOperation()) { |
| + return const GreaterOperation(); |
| + } else if (operation == const LessEqualOperation()) { |
| + return const GreaterEqualOperation(); |
| + } else if (operation == const GreaterOperation()) { |
| + return const LessOperation(); |
| + } else if (operation == const GreaterEqualOperation()) { |
| + return const LessEqualOperation(); |
| + } else { |
| + return null; |
| + } |
| + } |
| + |
| Range computeConstrainedRange(BinaryOperation operation, |
| Range leftRange, |
| Range rightRange) { |
| @@ -932,7 +946,7 @@ class SsaValueRangeAnalyzer extends HBaseVisitor implements OptimizationPhase { |
| Range rightRange = ranges[right]; |
| Range leftRange = ranges[left]; |
| Operation operation = condition.operation(constantSystem); |
| - Operation reverse = reverseOperation(operation); |
| + Operation mirrorOp = mirrorOperation(operation); |
| // Only update the true branch if this block is the only |
| // predecessor. |
| if (branch.trueBranch.predecessors.length == 1) { |
| @@ -946,7 +960,7 @@ class SsaValueRangeAnalyzer extends HBaseVisitor implements OptimizationPhase { |
| ranges[instruction] = range; |
| } |
| - range = computeConstrainedRange(reverse, rightRange, leftRange); |
| + range = computeConstrainedRange(mirrorOp, rightRange, leftRange); |
| if (rightRange != range) { |
| HInstruction instruction = |
| createRangeConversion(branch.trueBranch.first, right); |
| @@ -958,6 +972,8 @@ class SsaValueRangeAnalyzer extends HBaseVisitor implements OptimizationPhase { |
| // predecessor. |
| if (branch.falseBranch.predecessors.length == 1) { |
| assert(branch.falseBranch.predecessors[0] == branch.block); |
| + Operation reverse = reverseOperation(operation); |
| + Operation reversedMirror = mirrorOperation(reverse); |
| // Update the false branch to use narrower ranges for [left] and |
| // [right]. |
| Range range = computeConstrainedRange(reverse, leftRange, rightRange); |
| @@ -967,7 +983,7 @@ class SsaValueRangeAnalyzer extends HBaseVisitor implements OptimizationPhase { |
| ranges[instruction] = range; |
| } |
| - range = computeConstrainedRange(operation, rightRange, leftRange); |
| + range = computeConstrainedRange(reversedMirror, rightRange, leftRange); |
| if (rightRange != range) { |
| HInstruction instruction = |
| createRangeConversion(branch.falseBranch.first, right); |