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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 11275098: Improve RangeBoundary::LowerBound/UpperBound. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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: runtime/vm/intermediate_language.cc
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index 97fd83855e3d9ae4d132ff049099b7813b56850e..df4274a21d2608cb287290cc402ddbab5ad65b06 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -2118,8 +2118,7 @@ RangeBoundary RangeBoundary::FromDefinition(Definition* defn, intptr_t offs) {
RangeBoundary RangeBoundary::LowerBound() const {
if (IsConstant()) return *this;
- if (symbol()->range() == NULL) return MinSmi();
- return Add(symbol()->range()->min().LowerBound(),
+ return Add(Range::ConstantMin(symbol()->range()),
RangeBoundary::FromConstant(offset_),
MinSmi());
}
@@ -2127,14 +2126,23 @@ RangeBoundary RangeBoundary::LowerBound() const {
RangeBoundary RangeBoundary::UpperBound() const {
if (IsConstant()) return *this;
- if (symbol()->range() == NULL) return MaxSmi();
- return Add(symbol()->range()->max().UpperBound(),
+ return Add(Range::ConstantMax(symbol()->range()),
RangeBoundary::FromConstant(offset_),
MaxSmi());
}
+static Definition* UnwrapConstraint(Definition* defn) {
+ while (defn->IsConstraint()) {
+ defn = defn->AsConstraint()->value()->definition();
+ }
+ return defn;
+}
+
+
static bool AreEqualDefinitions(Definition* a, Definition* b) {
+ a = UnwrapConstraint(a);
+ b = UnwrapConstraint(b);
return (a == b) || (!a->AffectedBySideEffect() && a->Equals(b));
}
« 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