OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ | 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ |
6 #define VM_INTERMEDIATE_LANGUAGE_H_ | 6 #define VM_INTERMEDIATE_LANGUAGE_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
(...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1690 public: | 1690 public: |
1691 Range(RangeBoundary min, RangeBoundary max) : min_(min), max_(max) { } | 1691 Range(RangeBoundary min, RangeBoundary max) : min_(min), max_(max) { } |
1692 | 1692 |
1693 static Range* Unknown() { | 1693 static Range* Unknown() { |
1694 return new Range(RangeBoundary::MinSmi(), RangeBoundary::MaxSmi()); | 1694 return new Range(RangeBoundary::MinSmi(), RangeBoundary::MaxSmi()); |
1695 } | 1695 } |
1696 | 1696 |
1697 void PrintTo(BufferFormatter* f) const; | 1697 void PrintTo(BufferFormatter* f) const; |
1698 static const char* ToCString(Range* range); | 1698 static const char* ToCString(Range* range); |
1699 | 1699 |
1700 const RangeBoundary& min() { return min_; } | 1700 const RangeBoundary& min() const { return min_; } |
1701 const RangeBoundary& max() { return max_; } | 1701 const RangeBoundary& max() const { return max_; } |
1702 | 1702 |
1703 bool Equals(Range* other) { | 1703 bool Equals(Range* other) { |
1704 return min_.Equals(other->min_) && max_.Equals(other->max_); | 1704 return min_.Equals(other->min_) && max_.Equals(other->max_); |
1705 } | 1705 } |
1706 | 1706 |
1707 static RangeBoundary ConstantMin(Range* range) { | 1707 static RangeBoundary ConstantMin(Range* range) { |
1708 if (range == NULL) return RangeBoundary::MinSmi(); | 1708 if (range == NULL) return RangeBoundary::MinSmi(); |
1709 return range->min().LowerBound(); | 1709 return range->min().LowerBound(); |
1710 } | 1710 } |
1711 | 1711 |
1712 static RangeBoundary ConstantMax(Range* range) { | 1712 static RangeBoundary ConstantMax(Range* range) { |
1713 if (range == NULL) return RangeBoundary::MaxSmi(); | 1713 if (range == NULL) return RangeBoundary::MaxSmi(); |
1714 return range->max().UpperBound(); | 1714 return range->max().UpperBound(); |
1715 } | 1715 } |
1716 | 1716 |
| 1717 // Inclusive. |
| 1718 bool IsWithin(intptr_t min_int, intptr_t max_int) const; |
| 1719 |
1717 private: | 1720 private: |
1718 RangeBoundary min_; | 1721 RangeBoundary min_; |
1719 RangeBoundary max_; | 1722 RangeBoundary max_; |
1720 }; | 1723 }; |
1721 | 1724 |
1722 | 1725 |
1723 class ConstraintInstr : public TemplateDefinition<2> { | 1726 class ConstraintInstr : public TemplateDefinition<2> { |
1724 public: | 1727 public: |
1725 ConstraintInstr(Value* value, Range* constraint) | 1728 ConstraintInstr(Value* value, Range* constraint) |
1726 : constraint_(constraint) { | 1729 : constraint_(constraint) { |
(...skipping 2434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4161 ForwardInstructionIterator* current_iterator_; | 4164 ForwardInstructionIterator* current_iterator_; |
4162 | 4165 |
4163 private: | 4166 private: |
4164 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4167 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
4165 }; | 4168 }; |
4166 | 4169 |
4167 | 4170 |
4168 } // namespace dart | 4171 } // namespace dart |
4169 | 4172 |
4170 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4173 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |