| 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 PushArgsMode : unsigned { kJSFunction, kWithFinalSpread, kOther }; |
| 1204 | 1204 |
| 1205 inline size_t hash_value(CallableType type) { return bit_cast<unsigned>(type); } | 1205 inline size_t hash_value(PushArgsMode mode) { return bit_cast<unsigned>(mode); } |
| 1206 | 1206 |
| 1207 inline std::ostream& operator<<(std::ostream& os, CallableType function_type) { | 1207 inline std::ostream& operator<<(std::ostream& os, PushArgsMode mode) { |
| 1208 switch (function_type) { | 1208 switch (mode) { |
| 1209 case CallableType::kJSFunction: | 1209 case PushArgsMode::kJSFunction: |
| 1210 return os << "JSFunction"; | 1210 return os << "JSFunction"; |
| 1211 case CallableType::kAny: | 1211 case PushArgsMode::kWithFinalSpread: |
| 1212 return os << "Any"; | |
| 1213 } | |
| 1214 UNREACHABLE(); | |
| 1215 return os; | |
| 1216 } | |
| 1217 | |
| 1218 enum class PushArgsConstructMode : unsigned { | |
| 1219 kJSFunction, | |
| 1220 kWithFinalSpread, | |
| 1221 kOther | |
| 1222 }; | |
| 1223 | |
| 1224 inline size_t hash_value(PushArgsConstructMode mode) { | |
| 1225 return bit_cast<unsigned>(mode); | |
| 1226 } | |
| 1227 | |
| 1228 inline std::ostream& operator<<(std::ostream& os, PushArgsConstructMode mode) { | |
| 1229 switch (mode) { | |
| 1230 case PushArgsConstructMode::kJSFunction: | |
| 1231 return os << "JSFunction"; | |
| 1232 case PushArgsConstructMode::kWithFinalSpread: | |
| 1233 return os << "WithFinalSpread"; | 1212 return os << "WithFinalSpread"; |
| 1234 case PushArgsConstructMode::kOther: | 1213 case PushArgsMode::kOther: |
| 1235 return os << "Other"; | 1214 return os << "Other"; |
| 1236 } | 1215 } |
| 1237 UNREACHABLE(); | 1216 UNREACHABLE(); |
| 1238 return os; | 1217 return os; |
| 1239 } | 1218 } |
| 1240 | 1219 |
| 1241 inline uint32_t ObjectHash(Address address) { | 1220 inline uint32_t ObjectHash(Address address) { |
| 1242 // All objects are at least pointer aligned, so we can remove the trailing | 1221 // All objects are at least pointer aligned, so we can remove the trailing |
| 1243 // zeros. | 1222 // zeros. |
| 1244 return static_cast<uint32_t>(bit_cast<uintptr_t>(address) >> | 1223 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 | 1331 } // namespace internal |
| 1353 } // namespace v8 | 1332 } // namespace v8 |
| 1354 | 1333 |
| 1355 // Used by js-builtin-reducer to identify whether ReduceArrayIterator() is | 1334 // Used by js-builtin-reducer to identify whether ReduceArrayIterator() is |
| 1356 // reducing a JSArray method, or a JSTypedArray method. | 1335 // reducing a JSArray method, or a JSTypedArray method. |
| 1357 enum class ArrayIteratorKind { kArray, kTypedArray }; | 1336 enum class ArrayIteratorKind { kArray, kTypedArray }; |
| 1358 | 1337 |
| 1359 namespace i = v8::internal; | 1338 namespace i = v8::internal; |
| 1360 | 1339 |
| 1361 #endif // V8_GLOBALS_H_ | 1340 #endif // V8_GLOBALS_H_ |
| OLD | NEW |