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 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1722 public: | 1722 public: |
1723 Range(RangeBoundary min, RangeBoundary max) : min_(min), max_(max) { } | 1723 Range(RangeBoundary min, RangeBoundary max) : min_(min), max_(max) { } |
1724 | 1724 |
1725 static Range* Unknown() { | 1725 static Range* Unknown() { |
1726 return new Range(RangeBoundary::MinSmi(), RangeBoundary::MaxSmi()); | 1726 return new Range(RangeBoundary::MinSmi(), RangeBoundary::MaxSmi()); |
1727 } | 1727 } |
1728 | 1728 |
1729 void PrintTo(BufferFormatter* f) const; | 1729 void PrintTo(BufferFormatter* f) const; |
1730 static const char* ToCString(Range* range); | 1730 static const char* ToCString(Range* range); |
1731 | 1731 |
1732 const RangeBoundary& min() { return min_; } | 1732 const RangeBoundary& min() const { return min_; } |
1733 const RangeBoundary& max() { return max_; } | 1733 const RangeBoundary& max() const { return max_; } |
1734 | 1734 |
1735 bool Equals(Range* other) { | 1735 bool Equals(Range* other) { |
1736 return min_.Equals(other->min_) && max_.Equals(other->max_); | 1736 return min_.Equals(other->min_) && max_.Equals(other->max_); |
1737 } | 1737 } |
1738 | 1738 |
1739 static bool Update(Range** range_slot, | 1739 static bool Update(Range** range_slot, |
1740 const RangeBoundary& min, | 1740 const RangeBoundary& min, |
1741 const RangeBoundary& max) { | 1741 const RangeBoundary& max) { |
1742 if (*range_slot == NULL) { | 1742 if (*range_slot == NULL) { |
1743 *range_slot = new Range(min, max); | 1743 *range_slot = new Range(min, max); |
(...skipping 14 matching lines...) Expand all Loading... |
1758 static RangeBoundary ConstantMin(Range* range) { | 1758 static RangeBoundary ConstantMin(Range* range) { |
1759 if (range == NULL) return RangeBoundary::MinSmi(); | 1759 if (range == NULL) return RangeBoundary::MinSmi(); |
1760 return range->min().LowerBound(); | 1760 return range->min().LowerBound(); |
1761 } | 1761 } |
1762 | 1762 |
1763 static RangeBoundary ConstantMax(Range* range) { | 1763 static RangeBoundary ConstantMax(Range* range) { |
1764 if (range == NULL) return RangeBoundary::MaxSmi(); | 1764 if (range == NULL) return RangeBoundary::MaxSmi(); |
1765 return range->max().UpperBound(); | 1765 return range->max().UpperBound(); |
1766 } | 1766 } |
1767 | 1767 |
| 1768 // Inclusive. |
| 1769 bool IsWithin(intptr_t min_int, intptr_t max_int) const; |
| 1770 |
1768 private: | 1771 private: |
1769 RangeBoundary min_; | 1772 RangeBoundary min_; |
1770 RangeBoundary max_; | 1773 RangeBoundary max_; |
1771 }; | 1774 }; |
1772 | 1775 |
1773 | 1776 |
1774 class ConstraintInstr : public TemplateDefinition<2> { | 1777 class ConstraintInstr : public TemplateDefinition<2> { |
1775 public: | 1778 public: |
1776 ConstraintInstr(Value* value, Range* constraint) | 1779 ConstraintInstr(Value* value, Range* constraint) |
1777 : constraint_(constraint) { | 1780 : constraint_(constraint) { |
(...skipping 2463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4241 ForwardInstructionIterator* current_iterator_; | 4244 ForwardInstructionIterator* current_iterator_; |
4242 | 4245 |
4243 private: | 4246 private: |
4244 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4247 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
4245 }; | 4248 }; |
4246 | 4249 |
4247 | 4250 |
4248 } // namespace dart | 4251 } // namespace dart |
4249 | 4252 |
4250 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4253 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |