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

Unified Diff: src/objects.cc

Issue 2622833002: WIP [esnext] implement async iteration proposal (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 947a6e076f4b4deb1269c8a8dc703168b20ccae9..f97ce11b53454502449b71643c2b2124ab796785 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -2760,6 +2760,14 @@ void JSObject::JSObjectShortPrint(StringStream* accumulator) {
accumulator->Add("<JS Generator>");
break;
}
+ case JS_ASYNC_GENERATOR_OBJECT_TYPE: {
+ accumulator->Add("<JS AsyncGenerator>");
+ break;
+ }
+ case JS_ASYNC_FROM_SYNC_ITERATOR_TYPE: {
+ accumulator->Add("<JS AsyncFromSyncIterator>");
+ break;
+ }
// All other JSObjects are rather similar to each other (JSObject,
// JSGlobalProxy, JSGlobalObject, JSUndetectable, JSValue).
default: {
@@ -9266,7 +9274,8 @@ Handle<Map> Map::CopyInitialMap(Handle<Map> map, int instance_size,
DCHECK(*map == JSFunction::cast(constructor)->initial_map() ||
*map == *isolate->strict_function_map() ||
*map == *isolate->generator_function_map() ||
- *map == *isolate->async_function_map());
+ *map == *isolate->async_function_map() ||
+ *map == *isolate->async_generator_function_map());
#endif
// Initial maps must always own their descriptors and it's descriptor array
// does not contain descriptors that do not belong to the map.
@@ -13229,6 +13238,8 @@ bool CanSubclassHaveInobjectProperties(InstanceType instance_type) {
case JS_DATE_TYPE:
case JS_FUNCTION_TYPE:
case JS_GENERATOR_OBJECT_TYPE:
+ case JS_ASYNC_GENERATOR_OBJECT_TYPE:
+ case JS_ASYNC_FROM_SYNC_ITERATOR_TYPE:
case JS_MAP_ITERATOR_TYPE:
case JS_MAP_TYPE:
case JS_MESSAGE_OBJECT_TYPE:
@@ -13302,7 +13313,9 @@ void JSFunction::EnsureHasInitialMap(Handle<JSFunction> function) {
// suggested by the function.
InstanceType instance_type;
if (IsResumableFunction(function->shared()->kind())) {
- instance_type = JS_GENERATOR_OBJECT_TYPE;
+ instance_type = IsAsyncGeneratorFunction(function->shared()->kind())
+ ? JS_ASYNC_GENERATOR_OBJECT_TYPE
+ : JS_GENERATOR_OBJECT_TYPE;
} else {
instance_type = JS_OBJECT_TYPE;
}

Powered by Google App Engine
This is Rietveld 408576698