| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_UTILS_H_ | 5 #ifndef V8_UTILS_H_ |
| 6 #define V8_UTILS_H_ | 6 #define V8_UTILS_H_ |
| 7 | 7 |
| 8 #include <limits.h> | 8 #include <limits.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 static const int kNoneId = -1; | 1040 static const int kNoneId = -1; |
| 1041 | 1041 |
| 1042 int id_; | 1042 int id_; |
| 1043 }; | 1043 }; |
| 1044 | 1044 |
| 1045 | 1045 |
| 1046 template <int dummy_parameter> | 1046 template <int dummy_parameter> |
| 1047 class VectorSlot { | 1047 class VectorSlot { |
| 1048 public: | 1048 public: |
| 1049 explicit VectorSlot(int id) : id_(id) {} | 1049 explicit VectorSlot(int id) : id_(id) {} |
| 1050 |
| 1050 int ToInt() const { return id_; } | 1051 int ToInt() const { return id_; } |
| 1051 | 1052 |
| 1052 static VectorSlot Invalid() { return VectorSlot(kInvalidSlot); } | 1053 static VectorSlot Invalid() { return VectorSlot(kInvalidSlot); } |
| 1053 bool IsInvalid() const { return id_ == kInvalidSlot; } | 1054 bool IsInvalid() const { return id_ == kInvalidSlot; } |
| 1054 | 1055 |
| 1055 VectorSlot next() const { | 1056 VectorSlot next() const { |
| 1056 DCHECK(id_ != kInvalidSlot); | 1057 DCHECK_NE(kInvalidSlot, id_); |
| 1057 return VectorSlot(id_ + 1); | 1058 return VectorSlot(id_ + 1); |
| 1058 } | 1059 } |
| 1059 | 1060 |
| 1060 bool operator==(const VectorSlot& other) const { return id_ == other.id_; } | 1061 bool operator==(VectorSlot that) const { return this->id_ == that.id_; } |
| 1062 bool operator!=(VectorSlot that) const { return !(*this == that); } |
| 1061 | 1063 |
| 1062 private: | 1064 private: |
| 1063 static const int kInvalidSlot = -1; | 1065 static const int kInvalidSlot = -1; |
| 1064 | 1066 |
| 1065 int id_; | 1067 int id_; |
| 1066 }; | 1068 }; |
| 1067 | 1069 |
| 1068 | 1070 |
| 1071 template <int dummy_parameter> |
| 1072 size_t hash_value(VectorSlot<dummy_parameter> slot) { |
| 1073 return slot.ToInt(); |
| 1074 } |
| 1075 |
| 1076 |
| 1069 typedef VectorSlot<0> FeedbackVectorSlot; | 1077 typedef VectorSlot<0> FeedbackVectorSlot; |
| 1070 typedef VectorSlot<1> FeedbackVectorICSlot; | 1078 typedef VectorSlot<1> FeedbackVectorICSlot; |
| 1071 | 1079 |
| 1072 | 1080 |
| 1073 class BailoutId { | 1081 class BailoutId { |
| 1074 public: | 1082 public: |
| 1075 explicit BailoutId(int id) : id_(id) { } | 1083 explicit BailoutId(int id) : id_(id) { } |
| 1076 int ToInt() const { return id_; } | 1084 int ToInt() const { return id_; } |
| 1077 | 1085 |
| 1078 static BailoutId None() { return BailoutId(kNoneId); } | 1086 static BailoutId None() { return BailoutId(kNoneId); } |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1740 uint32_t* ptr = reinterpret_cast<uint32_t*>(p); | 1748 uint32_t* ptr = reinterpret_cast<uint32_t*>(p); |
| 1741 *ptr = c.u[0]; | 1749 *ptr = c.u[0]; |
| 1742 *(ptr + 1) = c.u[1]; | 1750 *(ptr + 1) = c.u[1]; |
| 1743 #endif // V8_TARGET_ARCH_MIPS | 1751 #endif // V8_TARGET_ARCH_MIPS |
| 1744 } | 1752 } |
| 1745 | 1753 |
| 1746 } // namespace internal | 1754 } // namespace internal |
| 1747 } // namespace v8 | 1755 } // namespace v8 |
| 1748 | 1756 |
| 1749 #endif // V8_UTILS_H_ | 1757 #endif // V8_UTILS_H_ |
| OLD | NEW |