Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 23bcd150a801325191373928bf7076cce97ec28c..e296d39f981473ab8ca2dd35664b75c10a5a9ca0 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; |
} |
@@ -19286,7 +19299,16 @@ int JSGeneratorObject::source_position() const { |
CHECK(is_suspended()); |
DCHECK(function()->shared()->HasBytecodeArray()); |
DCHECK(!function()->shared()->HasBaselineCode()); |
- int code_offset = Smi::cast(input_or_debug_pos())->value(); |
+ |
+ int code_offset; |
+ const JSAsyncGeneratorObject* async = |
+ IsJSAsyncGeneratorObject() ? JSAsyncGeneratorObject::cast(this) : nullptr; |
+ if (async != nullptr && async->awaited_promise()->IsJSPromise()) { |
+ code_offset = Smi::cast(async->await_input())->value(); |
+ } else { |
+ code_offset = Smi::cast(input_or_debug_pos())->value(); |
+ } |
+ |
// The stored bytecode offset is relative to a different base than what |
// is used in the source position table, hence the subtraction. |
code_offset -= BytecodeArray::kHeaderSize - kHeapObjectTag; |