| 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 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 int id_; | 1067 int id_; |
| 1068 }; | 1068 }; |
| 1069 | 1069 |
| 1070 | 1070 |
| 1071 class BailoutId { | 1071 class BailoutId { |
| 1072 public: | 1072 public: |
| 1073 explicit BailoutId(int id) : id_(id) { } | 1073 explicit BailoutId(int id) : id_(id) { } |
| 1074 int ToInt() const { return id_; } | 1074 int ToInt() const { return id_; } |
| 1075 | 1075 |
| 1076 static BailoutId None() { return BailoutId(kNoneId); } | 1076 static BailoutId None() { return BailoutId(kNoneId); } |
| 1077 static BailoutId Prologue() { return BailoutId(kPrologueId); } | 1077 static BailoutId ScriptContext() { return BailoutId(kScriptContextId); } |
| 1078 static BailoutId FunctionContext() { return BailoutId(kFunctionContextId); } |
| 1078 static BailoutId FunctionEntry() { return BailoutId(kFunctionEntryId); } | 1079 static BailoutId FunctionEntry() { return BailoutId(kFunctionEntryId); } |
| 1079 static BailoutId Declarations() { return BailoutId(kDeclarationsId); } | 1080 static BailoutId Declarations() { return BailoutId(kDeclarationsId); } |
| 1080 static BailoutId FirstUsable() { return BailoutId(kFirstUsableId); } | 1081 static BailoutId FirstUsable() { return BailoutId(kFirstUsableId); } |
| 1081 static BailoutId StubEntry() { return BailoutId(kStubEntryId); } | 1082 static BailoutId StubEntry() { return BailoutId(kStubEntryId); } |
| 1082 | 1083 |
| 1083 bool IsNone() const { return id_ == kNoneId; } | 1084 bool IsNone() const { return id_ == kNoneId; } |
| 1084 bool operator==(const BailoutId& other) const { return id_ == other.id_; } | 1085 bool operator==(const BailoutId& other) const { return id_ == other.id_; } |
| 1085 bool operator!=(const BailoutId& other) const { return id_ != other.id_; } | 1086 bool operator!=(const BailoutId& other) const { return id_ != other.id_; } |
| 1086 friend size_t hash_value(BailoutId); | 1087 friend size_t hash_value(BailoutId); |
| 1087 friend std::ostream& operator<<(std::ostream&, BailoutId); | 1088 friend std::ostream& operator<<(std::ostream&, BailoutId); |
| 1088 | 1089 |
| 1089 private: | 1090 private: |
| 1090 static const int kNoneId = -1; | 1091 static const int kNoneId = -1; |
| 1091 | 1092 |
| 1092 // Using 0 could disguise errors. | 1093 // Using 0 could disguise errors. |
| 1093 static const int kPrologueId = 1; | 1094 static const int kScriptContextId = 1; |
| 1094 static const int kFunctionEntryId = 2; | 1095 static const int kFunctionContextId = 2; |
| 1096 static const int kFunctionEntryId = 3; |
| 1095 | 1097 |
| 1096 // This AST id identifies the point after the declarations have been visited. | 1098 // This AST id identifies the point after the declarations have been visited. |
| 1097 // We need it to capture the environment effects of declarations that emit | 1099 // We need it to capture the environment effects of declarations that emit |
| 1098 // code (function declarations). | 1100 // code (function declarations). |
| 1099 static const int kDeclarationsId = 3; | 1101 static const int kDeclarationsId = 4; |
| 1100 | 1102 |
| 1101 // Every FunctionState starts with this id. | 1103 // Every FunctionState starts with this id. |
| 1102 static const int kFirstUsableId = 4; | 1104 static const int kFirstUsableId = 5; |
| 1103 | 1105 |
| 1104 // Every compiled stub starts with this id. | 1106 // Every compiled stub starts with this id. |
| 1105 static const int kStubEntryId = 5; | 1107 static const int kStubEntryId = 6; |
| 1106 | 1108 |
| 1107 int id_; | 1109 int id_; |
| 1108 }; | 1110 }; |
| 1109 | 1111 |
| 1110 | 1112 |
| 1111 // ---------------------------------------------------------------------------- | 1113 // ---------------------------------------------------------------------------- |
| 1112 // I/O support. | 1114 // I/O support. |
| 1113 | 1115 |
| 1114 #if __GNUC__ >= 4 | 1116 #if __GNUC__ >= 4 |
| 1115 // On gcc we can ask the compiler to check the types of %d-style format | 1117 // On gcc we can ask the compiler to check the types of %d-style format |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1729 uint32_t* ptr = reinterpret_cast<uint32_t*>(p); | 1731 uint32_t* ptr = reinterpret_cast<uint32_t*>(p); |
| 1730 *ptr = c.u[0]; | 1732 *ptr = c.u[0]; |
| 1731 *(ptr + 1) = c.u[1]; | 1733 *(ptr + 1) = c.u[1]; |
| 1732 #endif // V8_TARGET_ARCH_MIPS | 1734 #endif // V8_TARGET_ARCH_MIPS |
| 1733 } | 1735 } |
| 1734 | 1736 |
| 1735 } // namespace internal | 1737 } // namespace internal |
| 1736 } // namespace v8 | 1738 } // namespace v8 |
| 1737 | 1739 |
| 1738 #endif // V8_UTILS_H_ | 1740 #endif // V8_UTILS_H_ |
| OLD | NEW |