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 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 FAIL_ON_MINUS_ZERO | 918 FAIL_ON_MINUS_ZERO |
919 }; | 919 }; |
920 | 920 |
921 | 921 |
922 enum Signedness { kSigned, kUnsigned }; | 922 enum Signedness { kSigned, kUnsigned }; |
923 | 923 |
924 | 924 |
925 enum FunctionKind { | 925 enum FunctionKind { |
926 kNormalFunction = 0, | 926 kNormalFunction = 0, |
927 kArrowFunction = 1 << 0, | 927 kArrowFunction = 1 << 0, |
928 kGeneratorFunction = 1 << 1, | 928 kAsyncFunction = 1 << 1, |
929 kConciseMethod = 1 << 2, | 929 kGeneratorFunction = 1 << 2, |
| 930 kConciseMethod = 1 << 3, |
930 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, | 931 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, |
931 kAccessorFunction = 1 << 3, | 932 kAccessorFunction = 1 << 4, |
932 kDefaultConstructor = 1 << 4, | 933 kDefaultConstructor = 1 << 5, |
933 kSubclassConstructor = 1 << 5, | 934 kSubclassConstructor = 1 << 6, |
934 kBaseConstructor = 1 << 6, | 935 kBaseConstructor = 1 << 7, |
935 kInObjectLiteral = 1 << 7, | 936 kInObjectLiteral = 1 << 8, |
936 kDefaultBaseConstructor = kDefaultConstructor | kBaseConstructor, | 937 kDefaultBaseConstructor = kDefaultConstructor | kBaseConstructor, |
937 kDefaultSubclassConstructor = kDefaultConstructor | kSubclassConstructor, | 938 kDefaultSubclassConstructor = kDefaultConstructor | kSubclassConstructor, |
938 kConciseMethodInObjectLiteral = kConciseMethod | kInObjectLiteral, | 939 kConciseMethodInObjectLiteral = kConciseMethod | kInObjectLiteral, |
939 kConciseGeneratorMethodInObjectLiteral = | 940 kConciseGeneratorMethodInObjectLiteral = |
940 kConciseGeneratorMethod | kInObjectLiteral, | 941 kConciseGeneratorMethod | kInObjectLiteral, |
941 kAccessorFunctionInObjectLiteral = kAccessorFunction | kInObjectLiteral, | 942 kAccessorFunctionInObjectLiteral = kAccessorFunction | kInObjectLiteral, |
942 }; | 943 }; |
943 | 944 |
944 | 945 |
945 inline bool IsValidFunctionKind(FunctionKind kind) { | 946 inline bool IsValidFunctionKind(FunctionKind kind) { |
946 return kind == FunctionKind::kNormalFunction || | 947 return kind == FunctionKind::kNormalFunction || |
947 kind == FunctionKind::kArrowFunction || | 948 kind == FunctionKind::kArrowFunction || |
| 949 kind == FunctionKind::kAsyncFunction || |
948 kind == FunctionKind::kGeneratorFunction || | 950 kind == FunctionKind::kGeneratorFunction || |
949 kind == FunctionKind::kConciseMethod || | 951 kind == FunctionKind::kConciseMethod || |
950 kind == FunctionKind::kConciseGeneratorMethod || | 952 kind == FunctionKind::kConciseGeneratorMethod || |
951 kind == FunctionKind::kAccessorFunction || | 953 kind == FunctionKind::kAccessorFunction || |
952 kind == FunctionKind::kDefaultBaseConstructor || | 954 kind == FunctionKind::kDefaultBaseConstructor || |
953 kind == FunctionKind::kDefaultSubclassConstructor || | 955 kind == FunctionKind::kDefaultSubclassConstructor || |
954 kind == FunctionKind::kBaseConstructor || | 956 kind == FunctionKind::kBaseConstructor || |
955 kind == FunctionKind::kSubclassConstructor || | 957 kind == FunctionKind::kSubclassConstructor || |
956 kind == FunctionKind::kConciseMethodInObjectLiteral || | 958 kind == FunctionKind::kConciseMethodInObjectLiteral || |
957 kind == FunctionKind::kConciseGeneratorMethodInObjectLiteral || | 959 kind == FunctionKind::kConciseGeneratorMethodInObjectLiteral || |
958 kind == FunctionKind::kAccessorFunctionInObjectLiteral; | 960 kind == FunctionKind::kAccessorFunctionInObjectLiteral; |
959 } | 961 } |
960 | 962 |
961 | 963 |
962 inline bool IsArrowFunction(FunctionKind kind) { | 964 inline bool IsArrowFunction(FunctionKind kind) { |
963 DCHECK(IsValidFunctionKind(kind)); | 965 DCHECK(IsValidFunctionKind(kind)); |
964 return kind & FunctionKind::kArrowFunction; | 966 return kind & FunctionKind::kArrowFunction; |
965 } | 967 } |
966 | 968 |
967 | 969 |
| 970 inline bool IsAsyncFunction(FunctionKind kind) { |
| 971 DCHECK(IsValidFunctionKind(kind)); |
| 972 return kind & FunctionKind::kAsyncFunction; |
| 973 } |
| 974 |
| 975 |
968 inline bool IsGeneratorFunction(FunctionKind kind) { | 976 inline bool IsGeneratorFunction(FunctionKind kind) { |
969 DCHECK(IsValidFunctionKind(kind)); | 977 DCHECK(IsValidFunctionKind(kind)); |
970 return kind & FunctionKind::kGeneratorFunction; | 978 return kind & FunctionKind::kGeneratorFunction; |
971 } | 979 } |
972 | 980 |
973 | 981 |
974 inline bool IsConciseMethod(FunctionKind kind) { | 982 inline bool IsConciseMethod(FunctionKind kind) { |
975 DCHECK(IsValidFunctionKind(kind)); | 983 DCHECK(IsValidFunctionKind(kind)); |
976 return kind & FunctionKind::kConciseMethod; | 984 return kind & FunctionKind::kConciseMethod; |
977 } | 985 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 kind = static_cast<FunctionKind>(kind | FunctionKind::kInObjectLiteral); | 1027 kind = static_cast<FunctionKind>(kind | FunctionKind::kInObjectLiteral); |
1020 DCHECK(IsValidFunctionKind(kind)); | 1028 DCHECK(IsValidFunctionKind(kind)); |
1021 return kind; | 1029 return kind; |
1022 } | 1030 } |
1023 } // namespace internal | 1031 } // namespace internal |
1024 } // namespace v8 | 1032 } // namespace v8 |
1025 | 1033 |
1026 namespace i = v8::internal; | 1034 namespace i = v8::internal; |
1027 | 1035 |
1028 #endif // V8_GLOBALS_H_ | 1036 #endif // V8_GLOBALS_H_ |
OLD | NEW |