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

Unified Diff: src/objects.cc

Issue 2622833002: WIP [esnext] implement async iteration proposal (Closed)
Patch Set: fix async tests 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 23bcd150a801325191373928bf7076cce97ec28c..0db8d8e00feb2b6d4a2f95e4f2980abe78f634b3 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -2761,6 +2761,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: {
@@ -8645,7 +8653,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.
@@ -12638,6 +12647,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:
@@ -12711,7 +12722,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