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_GLOBALS_H_ | 5 #ifndef V8_GLOBALS_H_ |
6 #define V8_GLOBALS_H_ | 6 #define V8_GLOBALS_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 | 1193 |
1194 inline bool IsConstructable(FunctionKind kind, LanguageMode mode) { | 1194 inline bool IsConstructable(FunctionKind kind, LanguageMode mode) { |
1195 if (IsAccessorFunction(kind)) return false; | 1195 if (IsAccessorFunction(kind)) return false; |
1196 if (IsConciseMethod(kind)) return false; | 1196 if (IsConciseMethod(kind)) return false; |
1197 if (IsArrowFunction(kind)) return false; | 1197 if (IsArrowFunction(kind)) return false; |
1198 if (IsGeneratorFunction(kind)) return false; | 1198 if (IsGeneratorFunction(kind)) return false; |
1199 if (IsAsyncFunction(kind)) return false; | 1199 if (IsAsyncFunction(kind)) return false; |
1200 return true; | 1200 return true; |
1201 } | 1201 } |
1202 | 1202 |
1203 enum class CallableType : unsigned { kJSFunction, kAny }; | 1203 enum class InterpreterPushArgsMode : unsigned { |
1204 | |
1205 inline size_t hash_value(CallableType type) { return bit_cast<unsigned>(type); } | |
1206 | |
1207 inline std::ostream& operator<<(std::ostream& os, CallableType function_type) { | |
1208 switch (function_type) { | |
1209 case CallableType::kJSFunction: | |
1210 return os << "JSFunction"; | |
1211 case CallableType::kAny: | |
1212 return os << "Any"; | |
1213 } | |
1214 UNREACHABLE(); | |
1215 return os; | |
1216 } | |
1217 | |
1218 enum class PushArgsConstructMode : unsigned { | |
1219 kJSFunction, | 1204 kJSFunction, |
1220 kWithFinalSpread, | 1205 kWithFinalSpread, |
1221 kOther | 1206 kOther |
1222 }; | 1207 }; |
1223 | 1208 |
1224 inline size_t hash_value(PushArgsConstructMode mode) { | 1209 inline size_t hash_value(InterpreterPushArgsMode mode) { |
1225 return bit_cast<unsigned>(mode); | 1210 return bit_cast<unsigned>(mode); |
1226 } | 1211 } |
1227 | 1212 |
1228 inline std::ostream& operator<<(std::ostream& os, PushArgsConstructMode mode) { | 1213 inline std::ostream& operator<<(std::ostream& os, |
| 1214 InterpreterPushArgsMode mode) { |
1229 switch (mode) { | 1215 switch (mode) { |
1230 case PushArgsConstructMode::kJSFunction: | 1216 case InterpreterPushArgsMode::kJSFunction: |
1231 return os << "JSFunction"; | 1217 return os << "JSFunction"; |
1232 case PushArgsConstructMode::kWithFinalSpread: | 1218 case InterpreterPushArgsMode::kWithFinalSpread: |
1233 return os << "WithFinalSpread"; | 1219 return os << "WithFinalSpread"; |
1234 case PushArgsConstructMode::kOther: | 1220 case InterpreterPushArgsMode::kOther: |
1235 return os << "Other"; | 1221 return os << "Other"; |
1236 } | 1222 } |
1237 UNREACHABLE(); | 1223 UNREACHABLE(); |
1238 return os; | 1224 return os; |
1239 } | 1225 } |
1240 | 1226 |
1241 inline uint32_t ObjectHash(Address address) { | 1227 inline uint32_t ObjectHash(Address address) { |
1242 // All objects are at least pointer aligned, so we can remove the trailing | 1228 // All objects are at least pointer aligned, so we can remove the trailing |
1243 // zeros. | 1229 // zeros. |
1244 return static_cast<uint32_t>(bit_cast<uintptr_t>(address) >> | 1230 return static_cast<uint32_t>(bit_cast<uintptr_t>(address) >> |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1352 } // namespace internal | 1338 } // namespace internal |
1353 } // namespace v8 | 1339 } // namespace v8 |
1354 | 1340 |
1355 // Used by js-builtin-reducer to identify whether ReduceArrayIterator() is | 1341 // Used by js-builtin-reducer to identify whether ReduceArrayIterator() is |
1356 // reducing a JSArray method, or a JSTypedArray method. | 1342 // reducing a JSArray method, or a JSTypedArray method. |
1357 enum class ArrayIteratorKind { kArray, kTypedArray }; | 1343 enum class ArrayIteratorKind { kArray, kTypedArray }; |
1358 | 1344 |
1359 namespace i = v8::internal; | 1345 namespace i = v8::internal; |
1360 | 1346 |
1361 #endif // V8_GLOBALS_H_ | 1347 #endif // V8_GLOBALS_H_ |
OLD | NEW |