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 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 kNormalFunction = 0, | 937 kNormalFunction = 0, |
938 kArrowFunction = 1 << 0, | 938 kArrowFunction = 1 << 0, |
939 kGeneratorFunction = 1 << 1, | 939 kGeneratorFunction = 1 << 1, |
940 kConciseMethod = 1 << 2, | 940 kConciseMethod = 1 << 2, |
941 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, | 941 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, |
942 kDefaultConstructor = 1 << 3, | 942 kDefaultConstructor = 1 << 3, |
943 kSubclassConstructor = 1 << 4, | 943 kSubclassConstructor = 1 << 4, |
944 kBaseConstructor = 1 << 5, | 944 kBaseConstructor = 1 << 5, |
945 kGetterFunction = 1 << 6, | 945 kGetterFunction = 1 << 6, |
946 kSetterFunction = 1 << 7, | 946 kSetterFunction = 1 << 7, |
| 947 kAsyncFunction = 1 << 8, |
947 kAccessorFunction = kGetterFunction | kSetterFunction, | 948 kAccessorFunction = kGetterFunction | kSetterFunction, |
948 kDefaultBaseConstructor = kDefaultConstructor | kBaseConstructor, | 949 kDefaultBaseConstructor = kDefaultConstructor | kBaseConstructor, |
949 kDefaultSubclassConstructor = kDefaultConstructor | kSubclassConstructor, | 950 kDefaultSubclassConstructor = kDefaultConstructor | kSubclassConstructor, |
950 kClassConstructor = | 951 kClassConstructor = |
951 kBaseConstructor | kSubclassConstructor | kDefaultConstructor, | 952 kBaseConstructor | kSubclassConstructor | kDefaultConstructor, |
| 953 kAsyncArrowFunction = kArrowFunction | kAsyncFunction, |
| 954 kAsyncConciseMethod = kAsyncFunction | kConciseMethod |
952 }; | 955 }; |
953 | 956 |
954 inline bool IsValidFunctionKind(FunctionKind kind) { | 957 inline bool IsValidFunctionKind(FunctionKind kind) { |
955 return kind == FunctionKind::kNormalFunction || | 958 return kind == FunctionKind::kNormalFunction || |
956 kind == FunctionKind::kArrowFunction || | 959 kind == FunctionKind::kArrowFunction || |
957 kind == FunctionKind::kGeneratorFunction || | 960 kind == FunctionKind::kGeneratorFunction || |
958 kind == FunctionKind::kConciseMethod || | 961 kind == FunctionKind::kConciseMethod || |
959 kind == FunctionKind::kConciseGeneratorMethod || | 962 kind == FunctionKind::kConciseGeneratorMethod || |
960 kind == FunctionKind::kGetterFunction || | 963 kind == FunctionKind::kGetterFunction || |
961 kind == FunctionKind::kSetterFunction || | 964 kind == FunctionKind::kSetterFunction || |
962 kind == FunctionKind::kAccessorFunction || | 965 kind == FunctionKind::kAccessorFunction || |
963 kind == FunctionKind::kDefaultBaseConstructor || | 966 kind == FunctionKind::kDefaultBaseConstructor || |
964 kind == FunctionKind::kDefaultSubclassConstructor || | 967 kind == FunctionKind::kDefaultSubclassConstructor || |
965 kind == FunctionKind::kBaseConstructor || | 968 kind == FunctionKind::kBaseConstructor || |
966 kind == FunctionKind::kSubclassConstructor; | 969 kind == FunctionKind::kSubclassConstructor || |
| 970 kind == FunctionKind::kAsyncFunction || |
| 971 kind == FunctionKind::kAsyncArrowFunction || |
| 972 kind == FunctionKind::kAsyncConciseMethod; |
967 } | 973 } |
968 | 974 |
969 | 975 |
970 inline bool IsArrowFunction(FunctionKind kind) { | 976 inline bool IsArrowFunction(FunctionKind kind) { |
971 DCHECK(IsValidFunctionKind(kind)); | 977 DCHECK(IsValidFunctionKind(kind)); |
972 return kind & FunctionKind::kArrowFunction; | 978 return kind & FunctionKind::kArrowFunction; |
973 } | 979 } |
974 | 980 |
975 | 981 |
976 inline bool IsGeneratorFunction(FunctionKind kind) { | 982 inline bool IsGeneratorFunction(FunctionKind kind) { |
977 DCHECK(IsValidFunctionKind(kind)); | 983 DCHECK(IsValidFunctionKind(kind)); |
978 return kind & FunctionKind::kGeneratorFunction; | 984 return kind & FunctionKind::kGeneratorFunction; |
979 } | 985 } |
980 | 986 |
| 987 inline bool IsAsyncFunction(FunctionKind kind) { |
| 988 DCHECK(IsValidFunctionKind(kind)); |
| 989 return kind & FunctionKind::kAsyncFunction; |
| 990 } |
981 | 991 |
982 inline bool IsConciseMethod(FunctionKind kind) { | 992 inline bool IsConciseMethod(FunctionKind kind) { |
983 DCHECK(IsValidFunctionKind(kind)); | 993 DCHECK(IsValidFunctionKind(kind)); |
984 return kind & FunctionKind::kConciseMethod; | 994 return kind & FunctionKind::kConciseMethod; |
985 } | 995 } |
986 | 996 |
987 inline bool IsGetterFunction(FunctionKind kind) { | 997 inline bool IsGetterFunction(FunctionKind kind) { |
988 DCHECK(IsValidFunctionKind(kind)); | 998 DCHECK(IsValidFunctionKind(kind)); |
989 return kind & FunctionKind::kGetterFunction; | 999 return kind & FunctionKind::kGetterFunction; |
990 } | 1000 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 return static_cast<uint32_t>(bit_cast<uintptr_t>(address) >> | 1049 return static_cast<uint32_t>(bit_cast<uintptr_t>(address) >> |
1040 kPointerSizeLog2); | 1050 kPointerSizeLog2); |
1041 } | 1051 } |
1042 | 1052 |
1043 } // namespace internal | 1053 } // namespace internal |
1044 } // namespace v8 | 1054 } // namespace v8 |
1045 | 1055 |
1046 namespace i = v8::internal; | 1056 namespace i = v8::internal; |
1047 | 1057 |
1048 #endif // V8_GLOBALS_H_ | 1058 #endif // V8_GLOBALS_H_ |
OLD | NEW |