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 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 kind == FunctionKind::kBaseConstructor || | 1118 kind == FunctionKind::kBaseConstructor || |
1119 kind == FunctionKind::kDerivedConstructor || | 1119 kind == FunctionKind::kDerivedConstructor || |
1120 kind == FunctionKind::kAsyncFunction || | 1120 kind == FunctionKind::kAsyncFunction || |
1121 kind == FunctionKind::kAsyncArrowFunction || | 1121 kind == FunctionKind::kAsyncArrowFunction || |
1122 kind == FunctionKind::kAsyncConciseMethod; | 1122 kind == FunctionKind::kAsyncConciseMethod; |
1123 } | 1123 } |
1124 | 1124 |
1125 | 1125 |
1126 inline bool IsArrowFunction(FunctionKind kind) { | 1126 inline bool IsArrowFunction(FunctionKind kind) { |
1127 DCHECK(IsValidFunctionKind(kind)); | 1127 DCHECK(IsValidFunctionKind(kind)); |
1128 return kind & FunctionKind::kArrowFunction; | 1128 return (kind & FunctionKind::kArrowFunction) != 0; |
1129 } | 1129 } |
1130 | 1130 |
1131 | 1131 |
1132 inline bool IsGeneratorFunction(FunctionKind kind) { | 1132 inline bool IsGeneratorFunction(FunctionKind kind) { |
1133 DCHECK(IsValidFunctionKind(kind)); | 1133 DCHECK(IsValidFunctionKind(kind)); |
1134 return kind & FunctionKind::kGeneratorFunction; | 1134 return (kind & FunctionKind::kGeneratorFunction) != 0; |
1135 } | 1135 } |
1136 | 1136 |
1137 inline bool IsModule(FunctionKind kind) { | 1137 inline bool IsModule(FunctionKind kind) { |
1138 DCHECK(IsValidFunctionKind(kind)); | 1138 DCHECK(IsValidFunctionKind(kind)); |
1139 return kind & FunctionKind::kModule; | 1139 return (kind & FunctionKind::kModule) != 0; |
1140 } | 1140 } |
1141 | 1141 |
1142 inline bool IsAsyncFunction(FunctionKind kind) { | 1142 inline bool IsAsyncFunction(FunctionKind kind) { |
1143 DCHECK(IsValidFunctionKind(kind)); | 1143 DCHECK(IsValidFunctionKind(kind)); |
1144 return kind & FunctionKind::kAsyncFunction; | 1144 return (kind & FunctionKind::kAsyncFunction) != 0; |
1145 } | 1145 } |
1146 | 1146 |
1147 inline bool IsResumableFunction(FunctionKind kind) { | 1147 inline bool IsResumableFunction(FunctionKind kind) { |
1148 return IsGeneratorFunction(kind) || IsAsyncFunction(kind) || IsModule(kind); | 1148 return IsGeneratorFunction(kind) || IsAsyncFunction(kind) || IsModule(kind); |
1149 } | 1149 } |
1150 | 1150 |
1151 inline bool IsConciseMethod(FunctionKind kind) { | 1151 inline bool IsConciseMethod(FunctionKind kind) { |
1152 DCHECK(IsValidFunctionKind(kind)); | 1152 DCHECK(IsValidFunctionKind(kind)); |
1153 return kind & FunctionKind::kConciseMethod; | 1153 return (kind & FunctionKind::kConciseMethod) != 0; |
1154 } | 1154 } |
1155 | 1155 |
1156 inline bool IsGetterFunction(FunctionKind kind) { | 1156 inline bool IsGetterFunction(FunctionKind kind) { |
1157 DCHECK(IsValidFunctionKind(kind)); | 1157 DCHECK(IsValidFunctionKind(kind)); |
1158 return kind & FunctionKind::kGetterFunction; | 1158 return (kind & FunctionKind::kGetterFunction) != 0; |
1159 } | 1159 } |
1160 | 1160 |
1161 inline bool IsSetterFunction(FunctionKind kind) { | 1161 inline bool IsSetterFunction(FunctionKind kind) { |
1162 DCHECK(IsValidFunctionKind(kind)); | 1162 DCHECK(IsValidFunctionKind(kind)); |
1163 return kind & FunctionKind::kSetterFunction; | 1163 return (kind & FunctionKind::kSetterFunction) != 0; |
1164 } | 1164 } |
1165 | 1165 |
1166 inline bool IsAccessorFunction(FunctionKind kind) { | 1166 inline bool IsAccessorFunction(FunctionKind kind) { |
1167 DCHECK(IsValidFunctionKind(kind)); | 1167 DCHECK(IsValidFunctionKind(kind)); |
1168 return kind & FunctionKind::kAccessorFunction; | 1168 return (kind & FunctionKind::kAccessorFunction) != 0; |
1169 } | 1169 } |
1170 | 1170 |
1171 | 1171 |
1172 inline bool IsDefaultConstructor(FunctionKind kind) { | 1172 inline bool IsDefaultConstructor(FunctionKind kind) { |
1173 DCHECK(IsValidFunctionKind(kind)); | 1173 DCHECK(IsValidFunctionKind(kind)); |
1174 return kind & FunctionKind::kDefaultConstructor; | 1174 return (kind & FunctionKind::kDefaultConstructor) != 0; |
1175 } | 1175 } |
1176 | 1176 |
1177 | 1177 |
1178 inline bool IsBaseConstructor(FunctionKind kind) { | 1178 inline bool IsBaseConstructor(FunctionKind kind) { |
1179 DCHECK(IsValidFunctionKind(kind)); | 1179 DCHECK(IsValidFunctionKind(kind)); |
1180 return kind & FunctionKind::kBaseConstructor; | 1180 return (kind & FunctionKind::kBaseConstructor) != 0; |
1181 } | 1181 } |
1182 | 1182 |
1183 inline bool IsDerivedConstructor(FunctionKind kind) { | 1183 inline bool IsDerivedConstructor(FunctionKind kind) { |
1184 DCHECK(IsValidFunctionKind(kind)); | 1184 DCHECK(IsValidFunctionKind(kind)); |
1185 return kind & FunctionKind::kDerivedConstructor; | 1185 return (kind & FunctionKind::kDerivedConstructor) != 0; |
1186 } | 1186 } |
1187 | 1187 |
1188 | 1188 |
1189 inline bool IsClassConstructor(FunctionKind kind) { | 1189 inline bool IsClassConstructor(FunctionKind kind) { |
1190 DCHECK(IsValidFunctionKind(kind)); | 1190 DCHECK(IsValidFunctionKind(kind)); |
1191 return kind & FunctionKind::kClassConstructor; | 1191 return (kind & FunctionKind::kClassConstructor) != 0; |
1192 } | 1192 } |
1193 | 1193 |
1194 | 1194 |
1195 inline bool IsConstructable(FunctionKind kind, LanguageMode mode) { | 1195 inline bool IsConstructable(FunctionKind kind, LanguageMode mode) { |
1196 if (IsAccessorFunction(kind)) return false; | 1196 if (IsAccessorFunction(kind)) return false; |
1197 if (IsConciseMethod(kind)) return false; | 1197 if (IsConciseMethod(kind)) return false; |
1198 if (IsArrowFunction(kind)) return false; | 1198 if (IsArrowFunction(kind)) return false; |
1199 if (IsGeneratorFunction(kind)) return false; | 1199 if (IsGeneratorFunction(kind)) return false; |
1200 if (IsAsyncFunction(kind)) return false; | 1200 if (IsAsyncFunction(kind)) return false; |
1201 return true; | 1201 return true; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1337 } // namespace internal | 1337 } // namespace internal |
1338 } // namespace v8 | 1338 } // namespace v8 |
1339 | 1339 |
1340 // Used by js-builtin-reducer to identify whether ReduceArrayIterator() is | 1340 // Used by js-builtin-reducer to identify whether ReduceArrayIterator() is |
1341 // reducing a JSArray method, or a JSTypedArray method. | 1341 // reducing a JSArray method, or a JSTypedArray method. |
1342 enum class ArrayIteratorKind { kArray, kTypedArray }; | 1342 enum class ArrayIteratorKind { kArray, kTypedArray }; |
1343 | 1343 |
1344 namespace i = v8::internal; | 1344 namespace i = v8::internal; |
1345 | 1345 |
1346 #endif // V8_GLOBALS_H_ | 1346 #endif // V8_GLOBALS_H_ |
OLD | NEW |