Commit 9f0bdf04 authored by Caitlin Potter's avatar Caitlin Potter Committed by Commit Bot

[esnext] fix MaterializeCapturedObjectAt for async generator objects

Previously, JS_ASYNC_GENERATOR_OBJECT_TYPE maps led to an UNREACHABLE
macro, but are now restored like ordinary JSGeneratorObjects.

BUG=chromium:772649, v8:5855
R=adamk@chromium.org, yangguo@chromium.org, verwaest@chromium.org

Change-Id: I02e101565625f8a057d0e5b242a5fe0df263df89
Reviewed-on: https://chromium-review.googlesource.com/706780
Commit-Queue: Caitlin Potter <caitp@igalia.com>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48423}
parent 343cbe95
......@@ -3676,6 +3676,7 @@ Handle<Object> TranslatedState::MaterializeCapturedObjectAt(
}
return object;
}
case JS_ASYNC_GENERATOR_OBJECT_TYPE:
case JS_GENERATOR_OBJECT_TYPE: {
Handle<JSGeneratorObject> object = Handle<JSGeneratorObject>::cast(
isolate_->factory()->NewJSObjectFromMap(map, NOT_TENURED));
......@@ -3698,6 +3699,15 @@ Handle<Object> TranslatedState::MaterializeCapturedObjectAt(
object->set_resume_mode(Smi::ToInt(*resume_mode));
object->set_continuation(Smi::ToInt(*continuation_offset));
object->set_register_file(FixedArray::cast(*register_file));
if (object->IsJSAsyncGeneratorObject()) {
auto generator = Handle<JSAsyncGeneratorObject>::cast(object);
Handle<Object> queue = materializer.FieldAt(value_index);
Handle<Object> awaited_promise = materializer.FieldAt(value_index);
generator->set_queue(HeapObject::cast(*queue));
generator->set_awaited_promise(HeapObject::cast(*awaited_promise));
}
int in_object_properties = map->GetInObjectProperties();
for (int i = 0; i < in_object_properties; ++i) {
Handle<Object> value = materializer.FieldAt(value_index);
......@@ -3840,7 +3850,6 @@ Handle<Object> TranslatedState::MaterializeCapturedObjectAt(
case JS_MESSAGE_OBJECT_TYPE:
case JS_DATE_TYPE:
case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
case JS_ASYNC_GENERATOR_OBJECT_TYPE:
case JS_MODULE_NAMESPACE_TYPE:
case JS_ARRAY_BUFFER_TYPE:
case JS_TYPED_ARRAY_TYPE:
......
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --harmony-async-iteration
async function* gen([[notIterable]] = [null]) {}
assertThrows(() => gen(), TypeError);
assertThrows(() => gen(), TypeError);
%OptimizeFunctionOnNextCall(gen);
assertThrows(() => gen(), TypeError);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment