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 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1034 | 1034 |
1035 static TypeFeedbackId None() { return TypeFeedbackId(kNoneId); } | 1035 static TypeFeedbackId None() { return TypeFeedbackId(kNoneId); } |
1036 bool IsNone() const { return id_ == kNoneId; } | 1036 bool IsNone() const { return id_ == kNoneId; } |
1037 | 1037 |
1038 private: | 1038 private: |
1039 static const int kNoneId = -1; | 1039 static const int kNoneId = -1; |
1040 | 1040 |
1041 int id_; | 1041 int id_; |
1042 }; | 1042 }; |
1043 | 1043 |
| 1044 inline bool operator<(TypeFeedbackId lhs, TypeFeedbackId rhs) { |
| 1045 return lhs.ToInt() < rhs.ToInt(); |
| 1046 } |
| 1047 inline bool operator>(TypeFeedbackId lhs, TypeFeedbackId rhs) { |
| 1048 return lhs.ToInt() > rhs.ToInt(); |
| 1049 } |
| 1050 |
1044 | 1051 |
1045 class FeedbackVectorSlot { | 1052 class FeedbackVectorSlot { |
1046 public: | 1053 public: |
1047 FeedbackVectorSlot() : id_(kInvalidSlot) {} | 1054 FeedbackVectorSlot() : id_(kInvalidSlot) {} |
1048 explicit FeedbackVectorSlot(int id) : id_(id) {} | 1055 explicit FeedbackVectorSlot(int id) : id_(id) {} |
1049 | 1056 |
1050 int ToInt() const { return id_; } | 1057 int ToInt() const { return id_; } |
1051 | 1058 |
1052 static FeedbackVectorSlot Invalid() { return FeedbackVectorSlot(); } | 1059 static FeedbackVectorSlot Invalid() { return FeedbackVectorSlot(); } |
1053 bool IsInvalid() const { return id_ == kInvalidSlot; } | 1060 bool IsInvalid() const { return id_ == kInvalidSlot; } |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1766 uint8_t* ptr = reinterpret_cast<uint8_t*>(p); | 1773 uint8_t* ptr = reinterpret_cast<uint8_t*>(p); |
1767 *ptr = c.b[0]; | 1774 *ptr = c.b[0]; |
1768 *(ptr + 1) = c.b[1]; | 1775 *(ptr + 1) = c.b[1]; |
1769 #endif // V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 | 1776 #endif // V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
1770 } | 1777 } |
1771 | 1778 |
1772 } // namespace internal | 1779 } // namespace internal |
1773 } // namespace v8 | 1780 } // namespace v8 |
1774 | 1781 |
1775 #endif // V8_UTILS_H_ | 1782 #endif // V8_UTILS_H_ |
OLD | NEW |