Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index 877b3f7c685750688f890c2c16b0e11a44193bc1..7d28cb348fdff0b21499f1a0450211495c05ac9e 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -1515,7 +1515,9 @@ Handle<JSObject> Factory::NewFunctionPrototype(Handle<JSFunction> function) { |
// can be from a different context. |
Handle<Context> native_context(function->context()->native_context()); |
Handle<Map> new_map; |
- if (IsResumableFunction(function->shared()->kind())) { |
+ if (IsAsyncGeneratorFunction(function->shared()->kind())) { |
+ new_map = handle(native_context->async_generator_object_prototype_map()); |
+ } else if (IsResumableFunction(function->shared()->kind())) { |
// Generator and async function prototypes can share maps since they |
// don't have "constructor" properties. |
new_map = handle(native_context->generator_object_prototype_map()); |
@@ -1892,7 +1894,8 @@ Handle<JSGeneratorObject> Factory::NewJSGeneratorObject( |
DCHECK(IsResumableFunction(function->shared()->kind())); |
JSFunction::EnsureHasInitialMap(function); |
Handle<Map> map(function->initial_map()); |
- DCHECK_EQ(JS_GENERATOR_OBJECT_TYPE, map->instance_type()); |
+ DCHECK(JS_GENERATOR_OBJECT_TYPE == map->instance_type() || |
+ JS_ASYNC_GENERATOR_OBJECT_TYPE == map->instance_type()); |
CALL_HEAP_FUNCTION( |
isolate(), |
isolate()->heap()->AllocateJSObjectFromMap(*map), |
@@ -1957,6 +1960,17 @@ Handle<JSIteratorResult> Factory::NewJSIteratorResult(Handle<Object> value, |
return js_iter_result; |
} |
+Handle<JSAsyncFromSyncIterator> Factory::NewJSAsyncFromSyncIterator( |
+ Handle<HeapObject> sync_iterator) { |
+ Handle<Map> map( |
+ isolate()->native_context()->initial_async_from_sync_iterator_map()); |
+ Handle<JSAsyncFromSyncIterator> iterator = |
+ Handle<JSAsyncFromSyncIterator>::cast(NewJSObjectFromMap(map)); |
+ |
+ iterator->set_sync_iterator(*sync_iterator); |
+ return iterator; |
+} |
+ |
Handle<JSMap> Factory::NewJSMap() { |
Handle<Map> map(isolate()->native_context()->js_map_map()); |
Handle<JSMap> js_map = Handle<JSMap>::cast(NewJSObjectFromMap(map)); |