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 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 kBaseConstructor = 1 << 5, | 963 kBaseConstructor = 1 << 5, |
964 kGetterFunction = 1 << 6, | 964 kGetterFunction = 1 << 6, |
965 kSetterFunction = 1 << 7, | 965 kSetterFunction = 1 << 7, |
966 kAsyncFunction = 1 << 8, | 966 kAsyncFunction = 1 << 8, |
967 kAccessorFunction = kGetterFunction | kSetterFunction, | 967 kAccessorFunction = kGetterFunction | kSetterFunction, |
968 kDefaultBaseConstructor = kDefaultConstructor | kBaseConstructor, | 968 kDefaultBaseConstructor = kDefaultConstructor | kBaseConstructor, |
969 kDefaultSubclassConstructor = kDefaultConstructor | kSubclassConstructor, | 969 kDefaultSubclassConstructor = kDefaultConstructor | kSubclassConstructor, |
970 kClassConstructor = | 970 kClassConstructor = |
971 kBaseConstructor | kSubclassConstructor | kDefaultConstructor, | 971 kBaseConstructor | kSubclassConstructor | kDefaultConstructor, |
972 kAsyncArrowFunction = kArrowFunction | kAsyncFunction, | 972 kAsyncArrowFunction = kArrowFunction | kAsyncFunction, |
973 kAsyncConciseMethod = kAsyncFunction | kConciseMethod | 973 kAsyncConciseMethod = kAsyncFunction | kConciseMethod, |
| 974 kArrowGeneratorFunction = kGeneratorFunction | kArrowFunction |
974 }; | 975 }; |
975 | 976 |
976 inline bool IsValidFunctionKind(FunctionKind kind) { | 977 inline bool IsValidFunctionKind(FunctionKind kind) { |
977 return kind == FunctionKind::kNormalFunction || | 978 return kind == FunctionKind::kNormalFunction || |
978 kind == FunctionKind::kArrowFunction || | 979 kind == FunctionKind::kArrowFunction || |
979 kind == FunctionKind::kGeneratorFunction || | 980 kind == FunctionKind::kGeneratorFunction || |
980 kind == FunctionKind::kConciseMethod || | 981 kind == FunctionKind::kConciseMethod || |
981 kind == FunctionKind::kConciseGeneratorMethod || | 982 kind == FunctionKind::kConciseGeneratorMethod || |
982 kind == FunctionKind::kGetterFunction || | 983 kind == FunctionKind::kGetterFunction || |
983 kind == FunctionKind::kSetterFunction || | 984 kind == FunctionKind::kSetterFunction || |
984 kind == FunctionKind::kAccessorFunction || | 985 kind == FunctionKind::kAccessorFunction || |
985 kind == FunctionKind::kDefaultBaseConstructor || | 986 kind == FunctionKind::kDefaultBaseConstructor || |
986 kind == FunctionKind::kDefaultSubclassConstructor || | 987 kind == FunctionKind::kDefaultSubclassConstructor || |
987 kind == FunctionKind::kBaseConstructor || | 988 kind == FunctionKind::kBaseConstructor || |
988 kind == FunctionKind::kSubclassConstructor || | 989 kind == FunctionKind::kSubclassConstructor || |
989 kind == FunctionKind::kAsyncFunction || | 990 kind == FunctionKind::kAsyncFunction || |
990 kind == FunctionKind::kAsyncArrowFunction || | 991 kind == FunctionKind::kAsyncArrowFunction || |
991 kind == FunctionKind::kAsyncConciseMethod; | 992 kind == FunctionKind::kAsyncConciseMethod || |
| 993 kind == FunctionKind::kArrowGeneratorFunction; |
992 } | 994 } |
993 | 995 |
994 | 996 |
995 inline bool IsArrowFunction(FunctionKind kind) { | 997 inline bool IsArrowFunction(FunctionKind kind) { |
996 DCHECK(IsValidFunctionKind(kind)); | 998 DCHECK(IsValidFunctionKind(kind)); |
997 return kind & FunctionKind::kArrowFunction; | 999 return kind & FunctionKind::kArrowFunction; |
998 } | 1000 } |
999 | 1001 |
1000 | 1002 |
1001 inline bool IsGeneratorFunction(FunctionKind kind) { | 1003 inline bool IsGeneratorFunction(FunctionKind kind) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 DCHECK(IsValidFunctionKind(kind)); | 1053 DCHECK(IsValidFunctionKind(kind)); |
1052 return kind & FunctionKind::kClassConstructor; | 1054 return kind & FunctionKind::kClassConstructor; |
1053 } | 1055 } |
1054 | 1056 |
1055 | 1057 |
1056 inline bool IsConstructable(FunctionKind kind, LanguageMode mode) { | 1058 inline bool IsConstructable(FunctionKind kind, LanguageMode mode) { |
1057 if (IsAccessorFunction(kind)) return false; | 1059 if (IsAccessorFunction(kind)) return false; |
1058 if (IsConciseMethod(kind)) return false; | 1060 if (IsConciseMethod(kind)) return false; |
1059 if (IsArrowFunction(kind)) return false; | 1061 if (IsArrowFunction(kind)) return false; |
1060 if (IsGeneratorFunction(kind)) return false; | 1062 if (IsGeneratorFunction(kind)) return false; |
| 1063 if (IsAsyncFunction(kind)) return false; |
1061 return true; | 1064 return true; |
1062 } | 1065 } |
1063 | 1066 |
1064 | 1067 |
1065 inline uint32_t ObjectHash(Address address) { | 1068 inline uint32_t ObjectHash(Address address) { |
1066 // All objects are at least pointer aligned, so we can remove the trailing | 1069 // All objects are at least pointer aligned, so we can remove the trailing |
1067 // zeros. | 1070 // zeros. |
1068 return static_cast<uint32_t>(bit_cast<uintptr_t>(address) >> | 1071 return static_cast<uint32_t>(bit_cast<uintptr_t>(address) >> |
1069 kPointerSizeLog2); | 1072 kPointerSizeLog2); |
1070 } | 1073 } |
1071 | 1074 |
| 1075 enum class AsyncFunctionResumeMode { |
| 1076 Normal, |
| 1077 Throw, |
| 1078 }; |
| 1079 |
1072 } // namespace internal | 1080 } // namespace internal |
1073 } // namespace v8 | 1081 } // namespace v8 |
1074 | 1082 |
1075 namespace i = v8::internal; | 1083 namespace i = v8::internal; |
1076 | 1084 |
1077 #endif // V8_GLOBALS_H_ | 1085 #endif // V8_GLOBALS_H_ |
OLD | NEW |