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 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 | 1078 |
1079 enum Signedness { kSigned, kUnsigned }; | 1079 enum Signedness { kSigned, kUnsigned }; |
1080 | 1080 |
1081 enum FunctionKind : uint16_t { | 1081 enum FunctionKind : uint16_t { |
1082 kNormalFunction = 0, | 1082 kNormalFunction = 0, |
1083 kArrowFunction = 1 << 0, | 1083 kArrowFunction = 1 << 0, |
1084 kGeneratorFunction = 1 << 1, | 1084 kGeneratorFunction = 1 << 1, |
1085 kConciseMethod = 1 << 2, | 1085 kConciseMethod = 1 << 2, |
1086 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, | 1086 kConciseGeneratorMethod = kGeneratorFunction | kConciseMethod, |
1087 kDefaultConstructor = 1 << 3, | 1087 kDefaultConstructor = 1 << 3, |
1088 kSubclassConstructor = 1 << 4, | 1088 kDerivedConstructor = 1 << 4, |
1089 kBaseConstructor = 1 << 5, | 1089 kBaseConstructor = 1 << 5, |
1090 kGetterFunction = 1 << 6, | 1090 kGetterFunction = 1 << 6, |
1091 kSetterFunction = 1 << 7, | 1091 kSetterFunction = 1 << 7, |
1092 kAsyncFunction = 1 << 8, | 1092 kAsyncFunction = 1 << 8, |
1093 kModule = 1 << 9, | 1093 kModule = 1 << 9, |
1094 kAccessorFunction = kGetterFunction | kSetterFunction, | 1094 kAccessorFunction = kGetterFunction | kSetterFunction, |
1095 kDefaultBaseConstructor = kDefaultConstructor | kBaseConstructor, | 1095 kDefaultBaseConstructor = kDefaultConstructor | kBaseConstructor, |
1096 kDefaultSubclassConstructor = kDefaultConstructor | kSubclassConstructor, | 1096 kDefaultDerivedConstructor = kDefaultConstructor | kDerivedConstructor, |
1097 kClassConstructor = | 1097 kClassConstructor = |
1098 kBaseConstructor | kSubclassConstructor | kDefaultConstructor, | 1098 kBaseConstructor | kDerivedConstructor | kDefaultConstructor, |
1099 kAsyncArrowFunction = kArrowFunction | kAsyncFunction, | 1099 kAsyncArrowFunction = kArrowFunction | kAsyncFunction, |
1100 kAsyncConciseMethod = kAsyncFunction | kConciseMethod | 1100 kAsyncConciseMethod = kAsyncFunction | kConciseMethod |
1101 }; | 1101 }; |
1102 | 1102 |
1103 inline bool IsValidFunctionKind(FunctionKind kind) { | 1103 inline bool IsValidFunctionKind(FunctionKind kind) { |
1104 return kind == FunctionKind::kNormalFunction || | 1104 return kind == FunctionKind::kNormalFunction || |
1105 kind == FunctionKind::kArrowFunction || | 1105 kind == FunctionKind::kArrowFunction || |
1106 kind == FunctionKind::kGeneratorFunction || | 1106 kind == FunctionKind::kGeneratorFunction || |
1107 kind == FunctionKind::kModule || | 1107 kind == FunctionKind::kModule || |
1108 kind == FunctionKind::kConciseMethod || | 1108 kind == FunctionKind::kConciseMethod || |
1109 kind == FunctionKind::kConciseGeneratorMethod || | 1109 kind == FunctionKind::kConciseGeneratorMethod || |
1110 kind == FunctionKind::kGetterFunction || | 1110 kind == FunctionKind::kGetterFunction || |
1111 kind == FunctionKind::kSetterFunction || | 1111 kind == FunctionKind::kSetterFunction || |
1112 kind == FunctionKind::kAccessorFunction || | 1112 kind == FunctionKind::kAccessorFunction || |
1113 kind == FunctionKind::kDefaultBaseConstructor || | 1113 kind == FunctionKind::kDefaultBaseConstructor || |
1114 kind == FunctionKind::kDefaultSubclassConstructor || | 1114 kind == FunctionKind::kDefaultDerivedConstructor || |
1115 kind == FunctionKind::kBaseConstructor || | 1115 kind == FunctionKind::kBaseConstructor || |
1116 kind == FunctionKind::kSubclassConstructor || | 1116 kind == FunctionKind::kDerivedConstructor || |
1117 kind == FunctionKind::kAsyncFunction || | 1117 kind == FunctionKind::kAsyncFunction || |
1118 kind == FunctionKind::kAsyncArrowFunction || | 1118 kind == FunctionKind::kAsyncArrowFunction || |
1119 kind == FunctionKind::kAsyncConciseMethod; | 1119 kind == FunctionKind::kAsyncConciseMethod; |
1120 } | 1120 } |
1121 | 1121 |
1122 | 1122 |
1123 inline bool IsArrowFunction(FunctionKind kind) { | 1123 inline bool IsArrowFunction(FunctionKind kind) { |
1124 DCHECK(IsValidFunctionKind(kind)); | 1124 DCHECK(IsValidFunctionKind(kind)); |
1125 return kind & FunctionKind::kArrowFunction; | 1125 return kind & FunctionKind::kArrowFunction; |
1126 } | 1126 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 DCHECK(IsValidFunctionKind(kind)); | 1170 DCHECK(IsValidFunctionKind(kind)); |
1171 return kind & FunctionKind::kDefaultConstructor; | 1171 return kind & FunctionKind::kDefaultConstructor; |
1172 } | 1172 } |
1173 | 1173 |
1174 | 1174 |
1175 inline bool IsBaseConstructor(FunctionKind kind) { | 1175 inline bool IsBaseConstructor(FunctionKind kind) { |
1176 DCHECK(IsValidFunctionKind(kind)); | 1176 DCHECK(IsValidFunctionKind(kind)); |
1177 return kind & FunctionKind::kBaseConstructor; | 1177 return kind & FunctionKind::kBaseConstructor; |
1178 } | 1178 } |
1179 | 1179 |
1180 | 1180 inline bool IsDerivedConstructor(FunctionKind kind) { |
1181 inline bool IsSubclassConstructor(FunctionKind kind) { | |
1182 DCHECK(IsValidFunctionKind(kind)); | 1181 DCHECK(IsValidFunctionKind(kind)); |
1183 return kind & FunctionKind::kSubclassConstructor; | 1182 return kind & FunctionKind::kDerivedConstructor; |
1184 } | 1183 } |
1185 | 1184 |
1186 | 1185 |
1187 inline bool IsClassConstructor(FunctionKind kind) { | 1186 inline bool IsClassConstructor(FunctionKind kind) { |
1188 DCHECK(IsValidFunctionKind(kind)); | 1187 DCHECK(IsValidFunctionKind(kind)); |
1189 return kind & FunctionKind::kClassConstructor; | 1188 return kind & FunctionKind::kClassConstructor; |
1190 } | 1189 } |
1191 | 1190 |
1192 | 1191 |
1193 inline bool IsConstructable(FunctionKind kind, LanguageMode mode) { | 1192 inline bool IsConstructable(FunctionKind kind, LanguageMode mode) { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 } // namespace internal | 1325 } // namespace internal |
1327 } // namespace v8 | 1326 } // namespace v8 |
1328 | 1327 |
1329 // Used by js-builtin-reducer to identify whether ReduceArrayIterator() is | 1328 // Used by js-builtin-reducer to identify whether ReduceArrayIterator() is |
1330 // reducing a JSArray method, or a JSTypedArray method. | 1329 // reducing a JSArray method, or a JSTypedArray method. |
1331 enum class ArrayIteratorKind { kArray, kTypedArray }; | 1330 enum class ArrayIteratorKind { kArray, kTypedArray }; |
1332 | 1331 |
1333 namespace i = v8::internal; | 1332 namespace i = v8::internal; |
1334 | 1333 |
1335 #endif // V8_GLOBALS_H_ | 1334 #endif // V8_GLOBALS_H_ |
OLD | NEW |