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 { |
| 955 public: |
| 956 explicit FeedbackVectorSlot(int id) : id_(id) {} |
| 957 int ToInt() const { return id_; } |
| 958 |
| 959 static FeedbackVectorSlot Invalid() { |
| 960 return FeedbackVectorSlot(kInvalidSlot); |
| 961 } |
| 962 bool IsInvalid() const { return id_ == kInvalidSlot; } |
| 963 |
| 964 FeedbackVectorSlot next() const { |
| 965 DCHECK(id_ != kInvalidSlot); |
| 966 return FeedbackVectorSlot(id_ + 1); |
| 967 } |
| 968 |
| 969 private: |
| 970 static const int kInvalidSlot = -1; |
| 971 |
| 972 int id_; |
| 973 }; |
| 974 |
| 975 |
954 class BailoutId { | 976 class BailoutId { |
955 public: | 977 public: |
956 explicit BailoutId(int id) : id_(id) { } | 978 explicit BailoutId(int id) : id_(id) { } |
957 int ToInt() const { return id_; } | 979 int ToInt() const { return id_; } |
958 | 980 |
959 static BailoutId None() { return BailoutId(kNoneId); } | 981 static BailoutId None() { return BailoutId(kNoneId); } |
960 static BailoutId FunctionEntry() { return BailoutId(kFunctionEntryId); } | 982 static BailoutId FunctionEntry() { return BailoutId(kFunctionEntryId); } |
961 static BailoutId Declarations() { return BailoutId(kDeclarationsId); } | 983 static BailoutId Declarations() { return BailoutId(kDeclarationsId); } |
962 static BailoutId FirstUsable() { return BailoutId(kFirstUsableId); } | 984 static BailoutId FirstUsable() { return BailoutId(kFirstUsableId); } |
963 static BailoutId StubEntry() { return BailoutId(kStubEntryId); } | 985 static BailoutId StubEntry() { return BailoutId(kStubEntryId); } |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1462 // Takes the address of the limit variable in order to find out where | 1484 // Takes the address of the limit variable in order to find out where |
1463 // the top of stack is right now. | 1485 // the top of stack is right now. |
1464 uintptr_t limit = reinterpret_cast<uintptr_t>(&limit); | 1486 uintptr_t limit = reinterpret_cast<uintptr_t>(&limit); |
1465 return limit; | 1487 return limit; |
1466 } | 1488 } |
1467 | 1489 |
1468 } // namespace internal | 1490 } // namespace internal |
1469 } // namespace v8 | 1491 } // namespace v8 |
1470 | 1492 |
1471 #endif // V8_UTILS_H_ | 1493 #endif // V8_UTILS_H_ |
OLD | NEW |