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 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 | 1091 |
1092 inline bool IsConstructable(FunctionKind kind, LanguageMode mode) { | 1092 inline bool IsConstructable(FunctionKind kind, LanguageMode mode) { |
1093 if (IsAccessorFunction(kind)) return false; | 1093 if (IsAccessorFunction(kind)) return false; |
1094 if (IsConciseMethod(kind)) return false; | 1094 if (IsConciseMethod(kind)) return false; |
1095 if (IsArrowFunction(kind)) return false; | 1095 if (IsArrowFunction(kind)) return false; |
1096 if (IsGeneratorFunction(kind)) return false; | 1096 if (IsGeneratorFunction(kind)) return false; |
1097 if (IsAsyncFunction(kind)) return false; | 1097 if (IsAsyncFunction(kind)) return false; |
1098 return true; | 1098 return true; |
1099 } | 1099 } |
1100 | 1100 |
| 1101 enum class CallableType : unsigned { kJSFunction, kAny }; |
| 1102 |
| 1103 inline size_t hash_value(CallableType type) { return bit_cast<unsigned>(type); } |
| 1104 |
| 1105 inline std::ostream& operator<<(std::ostream& os, CallableType function_type) { |
| 1106 switch (function_type) { |
| 1107 case CallableType::kJSFunction: |
| 1108 return os << "JSFunction"; |
| 1109 case CallableType::kAny: |
| 1110 return os << "Any"; |
| 1111 } |
| 1112 UNREACHABLE(); |
| 1113 return os; |
| 1114 } |
1101 | 1115 |
1102 inline uint32_t ObjectHash(Address address) { | 1116 inline uint32_t ObjectHash(Address address) { |
1103 // All objects are at least pointer aligned, so we can remove the trailing | 1117 // All objects are at least pointer aligned, so we can remove the trailing |
1104 // zeros. | 1118 // zeros. |
1105 return static_cast<uint32_t>(bit_cast<uintptr_t>(address) >> | 1119 return static_cast<uint32_t>(bit_cast<uintptr_t>(address) >> |
1106 kPointerSizeLog2); | 1120 kPointerSizeLog2); |
1107 } | 1121 } |
1108 | 1122 |
1109 } // namespace internal | 1123 } // namespace internal |
1110 } // namespace v8 | 1124 } // namespace v8 |
1111 | 1125 |
1112 namespace i = v8::internal; | 1126 namespace i = v8::internal; |
1113 | 1127 |
1114 #endif // V8_GLOBALS_H_ | 1128 #endif // V8_GLOBALS_H_ |
OLD | NEW |