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 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1684 public: | 1684 public: |
1685 Range(RangeBoundary min, RangeBoundary max) : min_(min), max_(max) { } | 1685 Range(RangeBoundary min, RangeBoundary max) : min_(min), max_(max) { } |
1686 | 1686 |
1687 static Range* Unknown() { | 1687 static Range* Unknown() { |
1688 return new Range(RangeBoundary::MinSmi(), RangeBoundary::MaxSmi()); | 1688 return new Range(RangeBoundary::MinSmi(), RangeBoundary::MaxSmi()); |
1689 } | 1689 } |
1690 | 1690 |
1691 void PrintTo(BufferFormatter* f) const; | 1691 void PrintTo(BufferFormatter* f) const; |
1692 static const char* ToCString(Range* range); | 1692 static const char* ToCString(Range* range); |
1693 | 1693 |
1694 const RangeBoundary& min() { return min_; } | 1694 const RangeBoundary& min() const { return min_; } |
1695 const RangeBoundary& max() { return max_; } | 1695 const RangeBoundary& max() const { return max_; } |
1696 | 1696 |
1697 bool Equals(Range* other) { | 1697 bool Equals(Range* other) { |
1698 return min_.Equals(other->min_) && max_.Equals(other->max_); | 1698 return min_.Equals(other->min_) && max_.Equals(other->max_); |
1699 } | 1699 } |
1700 | 1700 |
1701 static RangeBoundary ConstantMin(Range* range) { | 1701 static RangeBoundary ConstantMin(Range* range) { |
1702 if (range == NULL) return RangeBoundary::MinSmi(); | 1702 if (range == NULL) return RangeBoundary::MinSmi(); |
1703 return range->min().LowerBound(); | 1703 return range->min().LowerBound(); |
1704 } | 1704 } |
1705 | 1705 |
1706 static RangeBoundary ConstantMax(Range* range) { | 1706 static RangeBoundary ConstantMax(Range* range) { |
1707 if (range == NULL) return RangeBoundary::MaxSmi(); | 1707 if (range == NULL) return RangeBoundary::MaxSmi(); |
1708 return range->max().UpperBound(); | 1708 return range->max().UpperBound(); |
1709 } | 1709 } |
1710 | 1710 |
| 1711 // Inclusive. |
| 1712 bool IsWithin(intptr_t min_int, intptr_t max_int) const; |
| 1713 |
1711 private: | 1714 private: |
1712 RangeBoundary min_; | 1715 RangeBoundary min_; |
1713 RangeBoundary max_; | 1716 RangeBoundary max_; |
1714 }; | 1717 }; |
1715 | 1718 |
1716 | 1719 |
1717 class ConstraintInstr : public TemplateDefinition<2> { | 1720 class ConstraintInstr : public TemplateDefinition<2> { |
1718 public: | 1721 public: |
1719 ConstraintInstr(Value* value, Range* constraint) | 1722 ConstraintInstr(Value* value, Range* constraint) |
1720 : constraint_(constraint) { | 1723 : constraint_(constraint) { |
(...skipping 2461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4182 ForwardInstructionIterator* current_iterator_; | 4185 ForwardInstructionIterator* current_iterator_; |
4183 | 4186 |
4184 private: | 4187 private: |
4185 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4188 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
4186 }; | 4189 }; |
4187 | 4190 |
4188 | 4191 |
4189 } // namespace dart | 4192 } // namespace dart |
4190 | 4193 |
4191 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4194 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |