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

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

Issue 11042002: Fix buggy computations in value ranges, spotted by floitsch@. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/value_range_analyzer.dart
===================================================================
--- lib/compiler/implementation/ssa/value_range_analyzer.dart (revision 13086)
+++ lib/compiler/implementation/ssa/value_range_analyzer.dart (working copy)
@@ -286,11 +286,20 @@
}
Range operator -(Range other) {
- return new Range.normalize(lower - other.lower, upper - other.upper);
+ return new Range.normalize(lower - other.upper, upper - other.lower);
}
Range operator &(Range other) {
- return new Range.normalize(lower & other.lower, upper & other.upper);
+ // Only operate on simple operations, ie when one of the range is
floitsch 2012/10/02 09:32:28 There is no need to make this restriction. if this
+ // constant.
+ if (lower == upper) {
+ if (isPositive()) return new Range(const IntValue(0), upper);
+ else if (isNegative()) return new Range(lower, const IntValue(0));
floitsch 2012/10/02 09:32:28 This is wrong: -1 & 5 -> 5
+ else return const Range.unbound();
+ } else if (other.lower == other.upper) {
+ return other & this;
+ }
+ return const Range.unbound();
}
bool operator ==(other) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698