Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2394)

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/ssa/value_range_analyzer.dart

Issue 371253002: Version 1.5.7 (Closed) Base URL: http://dart.googlecode.com/svn/branches/1.5/
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: dart/sdk/lib/_internal/compiler/implementation/ssa/value_range_analyzer.dart
===================================================================
--- dart/sdk/lib/_internal/compiler/implementation/ssa/value_range_analyzer.dart (revision 38051)
+++ dart/sdk/lib/_internal/compiler/implementation/ssa/value_range_analyzer.dart (working copy)
@@ -774,7 +774,7 @@
relational.block.rewrite(
relational, graph.addConstantBool(true, compiler));
relational.block.remove(relational);
- } else if (reverseOperation(operation).apply(leftRange, rightRange)) {
+ } else if (negateOperation(operation).apply(leftRange, rightRange)) {
relational.block.rewrite(
relational, graph.addConstantBool(false, compiler));
relational.block.remove(relational);
@@ -885,7 +885,7 @@
return newInstruction;
}
- static BinaryOperation reverseOperation(BinaryOperation operation) {
+ static BinaryOperation negateOperation(BinaryOperation operation) {
if (operation == const LessOperation()) {
return const GreaterEqualOperation();
} else if (operation == const LessEqualOperation()) {
@@ -899,6 +899,20 @@
}
}
+ static BinaryOperation flipOperation(BinaryOperation operation) {
+ 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 @@
Range rightRange = ranges[right];
Range leftRange = ranges[left];
Operation operation = condition.operation(constantSystem);
- Operation reverse = reverseOperation(operation);
+ Operation mirrorOp = flipOperation(operation);
// Only update the true branch if this block is the only
// predecessor.
if (branch.trueBranch.predecessors.length == 1) {
@@ -946,7 +960,7 @@
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 @@
// predecessor.
if (branch.falseBranch.predecessors.length == 1) {
assert(branch.falseBranch.predecessors[0] == branch.block);
+ Operation reverse = negateOperation(operation);
+ Operation reversedMirror = flipOperation(reverse);
// Update the false branch to use narrower ranges for [left] and
// [right].
Range range = computeConstrainedRange(reverse, leftRange, rightRange);
@@ -967,7 +983,7 @@
ranges[instruction] = range;
}
- range = computeConstrainedRange(operation, rightRange, leftRange);
+ range = computeConstrainedRange(reversedMirror, rightRange, leftRange);
if (rightRange != range) {
HInstruction instruction =
createRangeConversion(branch.falseBranch.first, right);

Powered by Google App Engine
This is Rietveld 408576698