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 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 kNormalFunction = 0, | 956 kNormalFunction = 0, |
957 kArrowFunction = 1 << 0, | 957 kArrowFunction = 1 << 0, |
958 kGeneratorFunction = 1 << 1, | 958 kGeneratorFunction = 1 << 1, |
959 kConciseMethod = 1 << 2, | 959 kConciseMethod = 1 << 2, |
960 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, | 960 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, |
961 kDefaultConstructor = 1 << 3, | 961 kDefaultConstructor = 1 << 3, |
962 kSubclassConstructor = 1 << 4, | 962 kSubclassConstructor = 1 << 4, |
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 kAccessorFunction = kGetterFunction | kSetterFunction, | 967 kAccessorFunction = kGetterFunction | kSetterFunction, |
967 kDefaultBaseConstructor = kDefaultConstructor | kBaseConstructor, | 968 kDefaultBaseConstructor = kDefaultConstructor | kBaseConstructor, |
968 kDefaultSubclassConstructor = kDefaultConstructor | kSubclassConstructor, | 969 kDefaultSubclassConstructor = kDefaultConstructor | kSubclassConstructor, |
969 kClassConstructor = | 970 kClassConstructor = |
970 kBaseConstructor | kSubclassConstructor | kDefaultConstructor, | 971 kBaseConstructor | kSubclassConstructor | kDefaultConstructor, |
| 972 kAsyncArrowFunction = kArrowFunction | kAsyncFunction, |
| 973 kAsyncConciseMethod = kAsyncFunction | kConciseMethod |
971 }; | 974 }; |
972 | 975 |
973 inline bool IsValidFunctionKind(FunctionKind kind) { | 976 inline bool IsValidFunctionKind(FunctionKind kind) { |
974 return kind == FunctionKind::kNormalFunction || | 977 return kind == FunctionKind::kNormalFunction || |
975 kind == FunctionKind::kArrowFunction || | 978 kind == FunctionKind::kArrowFunction || |
976 kind == FunctionKind::kGeneratorFunction || | 979 kind == FunctionKind::kGeneratorFunction || |
977 kind == FunctionKind::kConciseMethod || | 980 kind == FunctionKind::kConciseMethod || |
978 kind == FunctionKind::kConciseGeneratorMethod || | 981 kind == FunctionKind::kConciseGeneratorMethod || |
979 kind == FunctionKind::kGetterFunction || | 982 kind == FunctionKind::kGetterFunction || |
980 kind == FunctionKind::kSetterFunction || | 983 kind == FunctionKind::kSetterFunction || |
981 kind == FunctionKind::kAccessorFunction || | 984 kind == FunctionKind::kAccessorFunction || |
982 kind == FunctionKind::kDefaultBaseConstructor || | 985 kind == FunctionKind::kDefaultBaseConstructor || |
983 kind == FunctionKind::kDefaultSubclassConstructor || | 986 kind == FunctionKind::kDefaultSubclassConstructor || |
984 kind == FunctionKind::kBaseConstructor || | 987 kind == FunctionKind::kBaseConstructor || |
985 kind == FunctionKind::kSubclassConstructor; | 988 kind == FunctionKind::kSubclassConstructor || |
| 989 kind == FunctionKind::kAsyncFunction || |
| 990 kind == FunctionKind::kAsyncArrowFunction || |
| 991 kind == FunctionKind::kAsyncConciseMethod; |
986 } | 992 } |
987 | 993 |
988 | 994 |
989 inline bool IsArrowFunction(FunctionKind kind) { | 995 inline bool IsArrowFunction(FunctionKind kind) { |
990 DCHECK(IsValidFunctionKind(kind)); | 996 DCHECK(IsValidFunctionKind(kind)); |
991 return kind & FunctionKind::kArrowFunction; | 997 return kind & FunctionKind::kArrowFunction; |
992 } | 998 } |
993 | 999 |
994 | 1000 |
995 inline bool IsGeneratorFunction(FunctionKind kind) { | 1001 inline bool IsGeneratorFunction(FunctionKind kind) { |
996 DCHECK(IsValidFunctionKind(kind)); | 1002 DCHECK(IsValidFunctionKind(kind)); |
997 return kind & FunctionKind::kGeneratorFunction; | 1003 return kind & FunctionKind::kGeneratorFunction; |
998 } | 1004 } |
999 | 1005 |
| 1006 inline bool IsAsyncFunction(FunctionKind kind) { |
| 1007 DCHECK(IsValidFunctionKind(kind)); |
| 1008 return kind & FunctionKind::kAsyncFunction; |
| 1009 } |
1000 | 1010 |
1001 inline bool IsConciseMethod(FunctionKind kind) { | 1011 inline bool IsConciseMethod(FunctionKind kind) { |
1002 DCHECK(IsValidFunctionKind(kind)); | 1012 DCHECK(IsValidFunctionKind(kind)); |
1003 return kind & FunctionKind::kConciseMethod; | 1013 return kind & FunctionKind::kConciseMethod; |
1004 } | 1014 } |
1005 | 1015 |
1006 inline bool IsGetterFunction(FunctionKind kind) { | 1016 inline bool IsGetterFunction(FunctionKind kind) { |
1007 DCHECK(IsValidFunctionKind(kind)); | 1017 DCHECK(IsValidFunctionKind(kind)); |
1008 return kind & FunctionKind::kGetterFunction; | 1018 return kind & FunctionKind::kGetterFunction; |
1009 } | 1019 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 return static_cast<uint32_t>(bit_cast<uintptr_t>(address) >> | 1068 return static_cast<uint32_t>(bit_cast<uintptr_t>(address) >> |
1059 kPointerSizeLog2); | 1069 kPointerSizeLog2); |
1060 } | 1070 } |
1061 | 1071 |
1062 } // namespace internal | 1072 } // namespace internal |
1063 } // namespace v8 | 1073 } // namespace v8 |
1064 | 1074 |
1065 namespace i = v8::internal; | 1075 namespace i = v8::internal; |
1066 | 1076 |
1067 #endif // V8_GLOBALS_H_ | 1077 #endif // V8_GLOBALS_H_ |
OLD | NEW |