Commit 56b337f7 authored by Caitlin Potter's avatar Caitlin Potter Committed by Commit Bot

[async-iteration] delete AsyncGeneratorYield builtin

The AsyncGeneratorYield builtin just invoked the
AsyncGeneratorResolve() stub anyways, so this removes the middle-man.

Really minor refactoring, but clears out a bit of snapshot size and
another context index.

BUG=v8:5855
R=rmcilroy@chromium.org, bmeurer@chromium.org

Change-Id: I3385a5c5412e8d58493601874c2ad6b60e613012
Reviewed-on: https://chromium-review.googlesource.com/471913
Commit-Queue: Caitlin Potter <caitp@igalia.com>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44820}
parent 56e07b4a
......@@ -1410,12 +1410,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
InstallWithIntrinsicDefaultProto(isolate, await_uncaught,
Context::ASYNC_GENERATOR_AWAIT_UNCAUGHT);
Handle<JSFunction> yield =
SimpleCreateFunction(isolate, factory->empty_string(),
Builtins::kAsyncGeneratorYield, 2, false);
InstallWithIntrinsicDefaultProto(isolate, yield,
Context::ASYNC_GENERATOR_YIELD);
Handle<Code> code =
isolate->builtins()->AsyncGeneratorAwaitResolveClosure();
Handle<SharedFunctionInfo> info =
......
......@@ -360,24 +360,6 @@ TF_BUILTIN(AsyncGeneratorPrototypeThrow, AsyncGeneratorBuiltinsAssembler) {
"[AsyncGenerator].prototype.throw");
}
TF_BUILTIN(AsyncGeneratorYield, AsyncGeneratorBuiltinsAssembler) {
Node* const generator = Parameter(Descriptor::kReceiver);
Node* const value = Parameter(Descriptor::kValue);
Node* const context = Parameter(Descriptor::kContext);
CSA_ASSERT_JS_ARGC_EQ(this, 1);
CSA_SLOW_ASSERT(this,
HasInstanceType(generator, JS_ASYNC_GENERATOR_OBJECT_TYPE));
CSA_ASSERT(this, IsGeneratorNotSuspendedForAwait(generator));
CallBuiltin(Builtins::kAsyncGeneratorResolve, context, generator, value,
FalseConstant());
// Yield must have been reached via ResumeNext(), so don't recursively call
// it.
Return(UndefinedConstant());
}
TF_BUILTIN(AsyncGeneratorAwaitResolveClosure, AsyncGeneratorBuiltinsAssembler) {
Node* value = Parameter(Descriptor::kValue);
Node* context = Parameter(Descriptor::kContext);
......@@ -493,6 +475,10 @@ TF_BUILTIN(AsyncGeneratorResolve, AsyncGeneratorBuiltinsAssembler) {
Node* const done = Parameter(Descriptor::kDone);
Node* const context = Parameter(Descriptor::kContext);
CSA_SLOW_ASSERT(this,
HasInstanceType(generator, JS_ASYNC_GENERATOR_OBJECT_TYPE));
CSA_ASSERT(this, IsGeneratorNotSuspendedForAwait(generator));
Node* const next = TakeFirstAsyncGeneratorRequestFromQueue(generator);
Node* const promise = LoadPromiseFromAsyncGeneratorRequest(next);
......
......@@ -980,11 +980,6 @@ namespace internal {
TFJ(AsyncGeneratorAwaitResolveClosure, 1, kValue) \
TFJ(AsyncGeneratorAwaitRejectClosure, 1, kValue) \
\
/* GeneratorYield (proposal-async-iteration/#sec-generatoryield) with */ \
/* resume behaviour specific to Async Generators. Internal / not exposed */ \
/* to JS code. */ \
TFJ(AsyncGeneratorYield, 1, kValue) \
\
/* Async-from-Sync Iterator */ \
\
/* %AsyncFromSyncIteratorPrototype% */ \
......
......@@ -86,9 +86,7 @@ enum ContextLookupFlags {
V(PROMISE_HANDLE_INDEX, JSFunction, promise_handle) \
V(PROMISE_HANDLE_REJECT_INDEX, JSFunction, promise_handle_reject) \
V(ASYNC_GENERATOR_AWAIT_CAUGHT, JSFunction, async_generator_await_caught) \
V(ASYNC_GENERATOR_AWAIT_UNCAUGHT, JSFunction, \
async_generator_await_uncaught) \
V(ASYNC_GENERATOR_YIELD, JSFunction, async_generator_yield)
V(ASYNC_GENERATOR_AWAIT_UNCAUGHT, JSFunction, async_generator_await_uncaught)
#define NATIVE_CONTEXT_IMPORTED_FIELDS(V) \
V(ARRAY_CONCAT_INDEX, JSFunction, array_concat) \
......
......@@ -2394,14 +2394,16 @@ void BytecodeGenerator::VisitSuspend(Suspend* expr) {
if (expr->IsNonInitialAsyncGeneratorYield()) {
// AsyncGenerator yields (with the exception of the initial yield) delegate
// to AsyncGeneratorResolve(), implemented via the runtime call below.
RegisterList args = register_allocator()->NewRegisterList(2);
RegisterList args = register_allocator()->NewRegisterList(3);
// AsyncGeneratorYield:
// perform AsyncGeneratorResolve(<generator>, <value>, false).
builder()
->MoveRegister(generator, args[0])
.MoveRegister(value, args[1])
.CallJSRuntime(Context::ASYNC_GENERATOR_YIELD, args);
.LoadFalse()
.StoreAccumulatorInRegister(args[2])
.CallRuntime(Runtime::kInlineAsyncGeneratorResolve, args);
} else {
builder()->LoadAccumulatorWithRegister(value);
}
......
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