Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/globals.h

Issue 2622833002: WIP [esnext] implement async iteration proposal (Closed)
Patch Set: simplify AsyncIteratorValueUnwrap Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/flag-definitions.h ('k') | src/heap-symbols.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 kDefaultDerivedConstructor = kDefaultConstructor | kDerivedConstructor, 1096 kDefaultDerivedConstructor = kDefaultConstructor | kDerivedConstructor,
1097 kClassConstructor = 1097 kClassConstructor =
1098 kBaseConstructor | kDerivedConstructor | kDefaultConstructor, 1098 kBaseConstructor | kDerivedConstructor | kDefaultConstructor,
1099 kAsyncArrowFunction = kArrowFunction | kAsyncFunction, 1099 kAsyncArrowFunction = kArrowFunction | kAsyncFunction,
1100 kAsyncConciseMethod = kAsyncFunction | kConciseMethod 1100 kAsyncConciseMethod = kAsyncFunction | kConciseMethod,
1101
1102 // https://tc39.github.io/proposal-async-iteration/
1103 kAsyncConciseGeneratorMethod = kAsyncFunction | kConciseGeneratorMethod,
1104 kAsyncGeneratorFunction = kAsyncFunction | kGeneratorFunction,
1101 }; 1105 };
1102 1106
1103 inline bool IsValidFunctionKind(FunctionKind kind) { 1107 inline bool IsValidFunctionKind(FunctionKind kind) {
1104 return kind == FunctionKind::kNormalFunction || 1108 return kind == FunctionKind::kNormalFunction ||
1105 kind == FunctionKind::kArrowFunction || 1109 kind == FunctionKind::kArrowFunction ||
1106 kind == FunctionKind::kGeneratorFunction || 1110 kind == FunctionKind::kGeneratorFunction ||
1107 kind == FunctionKind::kModule || 1111 kind == FunctionKind::kModule ||
1108 kind == FunctionKind::kConciseMethod || 1112 kind == FunctionKind::kConciseMethod ||
1109 kind == FunctionKind::kConciseGeneratorMethod || 1113 kind == FunctionKind::kConciseGeneratorMethod ||
1110 kind == FunctionKind::kGetterFunction || 1114 kind == FunctionKind::kGetterFunction ||
1111 kind == FunctionKind::kSetterFunction || 1115 kind == FunctionKind::kSetterFunction ||
1112 kind == FunctionKind::kAccessorFunction || 1116 kind == FunctionKind::kAccessorFunction ||
1113 kind == FunctionKind::kDefaultBaseConstructor || 1117 kind == FunctionKind::kDefaultBaseConstructor ||
1114 kind == FunctionKind::kDefaultDerivedConstructor || 1118 kind == FunctionKind::kDefaultDerivedConstructor ||
1115 kind == FunctionKind::kBaseConstructor || 1119 kind == FunctionKind::kBaseConstructor ||
1116 kind == FunctionKind::kDerivedConstructor || 1120 kind == FunctionKind::kDerivedConstructor ||
1117 kind == FunctionKind::kAsyncFunction || 1121 kind == FunctionKind::kAsyncFunction ||
1118 kind == FunctionKind::kAsyncArrowFunction || 1122 kind == FunctionKind::kAsyncArrowFunction ||
1119 kind == FunctionKind::kAsyncConciseMethod; 1123 kind == FunctionKind::kAsyncConciseMethod ||
1124 kind == FunctionKind::kAsyncConciseGeneratorMethod ||
1125 kind == FunctionKind::kAsyncGeneratorFunction;
1120 } 1126 }
1121 1127
1122 1128
1123 inline bool IsArrowFunction(FunctionKind kind) { 1129 inline bool IsArrowFunction(FunctionKind kind) {
1124 DCHECK(IsValidFunctionKind(kind)); 1130 DCHECK(IsValidFunctionKind(kind));
1125 return kind & FunctionKind::kArrowFunction; 1131 return kind & FunctionKind::kArrowFunction;
1126 } 1132 }
1127 1133
1128 1134
1129 inline bool IsGeneratorFunction(FunctionKind kind) { 1135 inline bool IsGeneratorFunction(FunctionKind kind) {
1130 DCHECK(IsValidFunctionKind(kind)); 1136 DCHECK(IsValidFunctionKind(kind));
1131 return kind & FunctionKind::kGeneratorFunction; 1137 return kind & FunctionKind::kGeneratorFunction;
1132 } 1138 }
1133 1139
1134 inline bool IsModule(FunctionKind kind) { 1140 inline bool IsModule(FunctionKind kind) {
1135 DCHECK(IsValidFunctionKind(kind)); 1141 DCHECK(IsValidFunctionKind(kind));
1136 return kind & FunctionKind::kModule; 1142 return kind & FunctionKind::kModule;
1137 } 1143 }
1138 1144
1139 inline bool IsAsyncFunction(FunctionKind kind) { 1145 inline bool IsAsyncFunction(FunctionKind kind) {
1140 DCHECK(IsValidFunctionKind(kind)); 1146 DCHECK(IsValidFunctionKind(kind));
1141 return kind & FunctionKind::kAsyncFunction; 1147 return kind & FunctionKind::kAsyncFunction;
1142 } 1148 }
1143 1149
1150 inline bool IsAsyncGeneratorFunction(FunctionKind kind) {
1151 DCHECK(IsValidFunctionKind(kind));
1152 const FunctionKind kMask = FunctionKind::kAsyncGeneratorFunction;
1153 return (kind & kMask) == kMask;
1154 }
1155
1144 inline bool IsResumableFunction(FunctionKind kind) { 1156 inline bool IsResumableFunction(FunctionKind kind) {
1145 return IsGeneratorFunction(kind) || IsAsyncFunction(kind) || IsModule(kind); 1157 return IsGeneratorFunction(kind) || IsAsyncFunction(kind) || IsModule(kind);
1146 } 1158 }
1147 1159
1148 inline bool IsConciseMethod(FunctionKind kind) { 1160 inline bool IsConciseMethod(FunctionKind kind) {
1149 DCHECK(IsValidFunctionKind(kind)); 1161 DCHECK(IsValidFunctionKind(kind));
1150 return kind & FunctionKind::kConciseMethod; 1162 return kind & FunctionKind::kConciseMethod;
1151 } 1163 }
1152 1164
1153 inline bool IsGetterFunction(FunctionKind kind) { 1165 inline bool IsGetterFunction(FunctionKind kind) {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1325 } // namespace internal 1337 } // namespace internal
1326 } // namespace v8 1338 } // namespace v8
1327 1339
1328 // Used by js-builtin-reducer to identify whether ReduceArrayIterator() is 1340 // Used by js-builtin-reducer to identify whether ReduceArrayIterator() is
1329 // reducing a JSArray method, or a JSTypedArray method. 1341 // reducing a JSArray method, or a JSTypedArray method.
1330 enum class ArrayIteratorKind { kArray, kTypedArray }; 1342 enum class ArrayIteratorKind { kArray, kTypedArray };
1331 1343
1332 namespace i = v8::internal; 1344 namespace i = v8::internal;
1333 1345
1334 #endif // V8_GLOBALS_H_ 1346 #endif // V8_GLOBALS_H_
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/heap-symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698