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 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
944 static TypeFeedbackId None() { return TypeFeedbackId(kNoneId); } | 944 static TypeFeedbackId None() { return TypeFeedbackId(kNoneId); } |
945 bool IsNone() const { return id_ == kNoneId; } | 945 bool IsNone() const { return id_ == kNoneId; } |
946 | 946 |
947 private: | 947 private: |
948 static const int kNoneId = -1; | 948 static const int kNoneId = -1; |
949 | 949 |
950 int id_; | 950 int id_; |
951 }; | 951 }; |
952 | 952 |
953 | 953 |
954 class FeedbackVectorSlot { | 954 template <int dummy_parameter> |
| 955 class VectorSlot { |
955 public: | 956 public: |
956 explicit FeedbackVectorSlot(int id) : id_(id) {} | 957 explicit VectorSlot(int id) : id_(id) {} |
957 int ToInt() const { return id_; } | 958 int ToInt() const { return id_; } |
958 | 959 |
959 static FeedbackVectorSlot Invalid() { | 960 static VectorSlot Invalid() { return VectorSlot(kInvalidSlot); } |
960 return FeedbackVectorSlot(kInvalidSlot); | |
961 } | |
962 bool IsInvalid() const { return id_ == kInvalidSlot; } | 961 bool IsInvalid() const { return id_ == kInvalidSlot; } |
963 | 962 |
964 FeedbackVectorSlot next() const { | 963 VectorSlot next() const { |
965 DCHECK(id_ != kInvalidSlot); | 964 DCHECK(id_ != kInvalidSlot); |
966 return FeedbackVectorSlot(id_ + 1); | 965 return VectorSlot(id_ + 1); |
967 } | 966 } |
968 | 967 |
| 968 bool operator==(const VectorSlot& other) const { return id_ == other.id_; } |
| 969 |
969 private: | 970 private: |
970 static const int kInvalidSlot = -1; | 971 static const int kInvalidSlot = -1; |
971 | 972 |
972 int id_; | 973 int id_; |
973 }; | 974 }; |
974 | 975 |
975 | 976 |
| 977 typedef VectorSlot<0> FeedbackVectorSlot; |
| 978 typedef VectorSlot<1> FeedbackVectorICSlot; |
| 979 |
| 980 |
976 class BailoutId { | 981 class BailoutId { |
977 public: | 982 public: |
978 explicit BailoutId(int id) : id_(id) { } | 983 explicit BailoutId(int id) : id_(id) { } |
979 int ToInt() const { return id_; } | 984 int ToInt() const { return id_; } |
980 | 985 |
981 static BailoutId None() { return BailoutId(kNoneId); } | 986 static BailoutId None() { return BailoutId(kNoneId); } |
982 static BailoutId FunctionEntry() { return BailoutId(kFunctionEntryId); } | 987 static BailoutId FunctionEntry() { return BailoutId(kFunctionEntryId); } |
983 static BailoutId Declarations() { return BailoutId(kDeclarationsId); } | 988 static BailoutId Declarations() { return BailoutId(kDeclarationsId); } |
984 static BailoutId FirstUsable() { return BailoutId(kFirstUsableId); } | 989 static BailoutId FirstUsable() { return BailoutId(kFirstUsableId); } |
985 static BailoutId StubEntry() { return BailoutId(kStubEntryId); } | 990 static BailoutId StubEntry() { return BailoutId(kStubEntryId); } |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1484 // Takes the address of the limit variable in order to find out where | 1489 // Takes the address of the limit variable in order to find out where |
1485 // the top of stack is right now. | 1490 // the top of stack is right now. |
1486 uintptr_t limit = reinterpret_cast<uintptr_t>(&limit); | 1491 uintptr_t limit = reinterpret_cast<uintptr_t>(&limit); |
1487 return limit; | 1492 return limit; |
1488 } | 1493 } |
1489 | 1494 |
1490 } // namespace internal | 1495 } // namespace internal |
1491 } // namespace v8 | 1496 } // namespace v8 |
1492 | 1497 |
1493 #endif // V8_UTILS_H_ | 1498 #endif // V8_UTILS_H_ |
OLD | NEW |