| Index: runtime/vm/intermediate_language.h
|
| ===================================================================
|
| --- runtime/vm/intermediate_language.h (revision 37229)
|
| +++ runtime/vm/intermediate_language.h (working copy)
|
| @@ -2504,6 +2504,9 @@
|
| value_(other.value_),
|
| offset_(other.offset_) { }
|
|
|
| + explicit RangeBoundary(intptr_t val)
|
| + : kind_(kConstant), value_(val), offset_(0) { }
|
| +
|
| RangeBoundary& operator=(const RangeBoundary& other) {
|
| kind_ = other.kind_;
|
| value_ = other.value_;
|
| @@ -2512,7 +2515,7 @@
|
| }
|
|
|
| static RangeBoundary FromConstant(intptr_t val) {
|
| - return RangeBoundary(kConstant, val, 0);
|
| + return RangeBoundary(val);
|
| }
|
|
|
| static RangeBoundary NegativeInfinity() {
|
| @@ -2554,6 +2557,12 @@
|
| return *this;
|
| }
|
|
|
| + bool Equals(const RangeBoundary& other) {
|
| + return kind_ == other.kind_
|
| + && value_ == other.value_
|
| + && offset_ == other.offset_;
|
| + }
|
| +
|
| bool IsUnknown() const { return kind_ == kUnknown; }
|
| bool IsConstant() const { return kind_ == kConstant; }
|
| bool IsSymbol() const { return kind_ == kSymbol; }
|
| @@ -2607,6 +2616,23 @@
|
| return RangeBoundary::FromConstant(result);
|
| }
|
|
|
| + static RangeBoundary Shl(const RangeBoundary& value_boundary,
|
| + intptr_t shift_count,
|
| + const RangeBoundary& overflow) {
|
| + ASSERT(value_boundary.IsConstant());
|
| + ASSERT(shift_count >= 0);
|
| + intptr_t limit = 64 - shift_count;
|
| + int64_t value = static_cast<int64_t>(value_boundary.value());
|
| + if ((value == 0) ||
|
| + (shift_count == 0) ||
|
| + ((limit > 0) && (Utils::IsInt(limit, value)))) {
|
| + // Result stays in 64 bit range.
|
| + int64_t result = value << shift_count;
|
| + return Smi::IsValid64(result) ? RangeBoundary(result) : overflow;
|
| + }
|
| + return overflow;
|
| + }
|
| +
|
| private:
|
| RangeBoundary(Kind kind, intptr_t value, intptr_t offset)
|
| : kind_(kind), value_(value), offset_(offset) { }
|
| @@ -2662,6 +2688,11 @@
|
|
|
| bool IsUnsatisfiable() const;
|
|
|
| + static void Shl(Range* left_range,
|
| + Range* right_range,
|
| + RangeBoundary* min,
|
| + RangeBoundary* max);
|
| +
|
| private:
|
| RangeBoundary min_;
|
| RangeBoundary max_;
|
|
|