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 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 typedef VectorSlot<0> FeedbackVectorSlot; | 1077 typedef VectorSlot<0> FeedbackVectorSlot; |
1078 typedef VectorSlot<1> FeedbackVectorICSlot; | 1078 typedef VectorSlot<1> FeedbackVectorICSlot; |
1079 | 1079 |
1080 | 1080 |
1081 class BailoutId { | 1081 class BailoutId { |
1082 public: | 1082 public: |
1083 explicit BailoutId(int id) : id_(id) { } | 1083 explicit BailoutId(int id) : id_(id) { } |
1084 int ToInt() const { return id_; } | 1084 int ToInt() const { return id_; } |
1085 | 1085 |
1086 static BailoutId None() { return BailoutId(kNoneId); } | 1086 static BailoutId None() { return BailoutId(kNoneId); } |
| 1087 static BailoutId Prologue() { return BailoutId(kPrologueId); } |
1087 static BailoutId FunctionEntry() { return BailoutId(kFunctionEntryId); } | 1088 static BailoutId FunctionEntry() { return BailoutId(kFunctionEntryId); } |
1088 static BailoutId Declarations() { return BailoutId(kDeclarationsId); } | 1089 static BailoutId Declarations() { return BailoutId(kDeclarationsId); } |
1089 static BailoutId FirstUsable() { return BailoutId(kFirstUsableId); } | 1090 static BailoutId FirstUsable() { return BailoutId(kFirstUsableId); } |
1090 static BailoutId StubEntry() { return BailoutId(kStubEntryId); } | 1091 static BailoutId StubEntry() { return BailoutId(kStubEntryId); } |
1091 | 1092 |
1092 bool IsNone() const { return id_ == kNoneId; } | 1093 bool IsNone() const { return id_ == kNoneId; } |
1093 bool operator==(const BailoutId& other) const { return id_ == other.id_; } | 1094 bool operator==(const BailoutId& other) const { return id_ == other.id_; } |
1094 bool operator!=(const BailoutId& other) const { return id_ != other.id_; } | 1095 bool operator!=(const BailoutId& other) const { return id_ != other.id_; } |
1095 friend size_t hash_value(BailoutId); | 1096 friend size_t hash_value(BailoutId); |
1096 friend std::ostream& operator<<(std::ostream&, BailoutId); | 1097 friend std::ostream& operator<<(std::ostream&, BailoutId); |
1097 | 1098 |
1098 private: | 1099 private: |
1099 static const int kNoneId = -1; | 1100 static const int kNoneId = -1; |
1100 | 1101 |
1101 // Using 0 could disguise errors. | 1102 // Using 0 could disguise errors. |
| 1103 static const int kPrologueId = 1; |
1102 static const int kFunctionEntryId = 2; | 1104 static const int kFunctionEntryId = 2; |
1103 | 1105 |
1104 // This AST id identifies the point after the declarations have been visited. | 1106 // This AST id identifies the point after the declarations have been visited. |
1105 // We need it to capture the environment effects of declarations that emit | 1107 // We need it to capture the environment effects of declarations that emit |
1106 // code (function declarations). | 1108 // code (function declarations). |
1107 static const int kDeclarationsId = 3; | 1109 static const int kDeclarationsId = 3; |
1108 | 1110 |
1109 // Every FunctionState starts with this id. | 1111 // Every FunctionState starts with this id. |
1110 static const int kFirstUsableId = 4; | 1112 static const int kFirstUsableId = 4; |
1111 | 1113 |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1737 uint32_t* ptr = reinterpret_cast<uint32_t*>(p); | 1739 uint32_t* ptr = reinterpret_cast<uint32_t*>(p); |
1738 *ptr = c.u[0]; | 1740 *ptr = c.u[0]; |
1739 *(ptr + 1) = c.u[1]; | 1741 *(ptr + 1) = c.u[1]; |
1740 #endif // V8_TARGET_ARCH_MIPS | 1742 #endif // V8_TARGET_ARCH_MIPS |
1741 } | 1743 } |
1742 | 1744 |
1743 } // namespace internal | 1745 } // namespace internal |
1744 } // namespace v8 | 1746 } // namespace v8 |
1745 | 1747 |
1746 #endif // V8_UTILS_H_ | 1748 #endif // V8_UTILS_H_ |
OLD | NEW |