Lines Matching full:generator
11 #include "src/objects/js-generator.h"
41 inline Node* LoadGeneratorState(Node* const generator) { in LoadGeneratorState() argument
42 return LoadObjectField(generator, JSGeneratorObject::kContinuationOffset); in LoadGeneratorState()
48 inline TNode<BoolT> IsGeneratorClosed(Node* const generator) { in IsGeneratorClosed() argument
49 return IsGeneratorStateClosed(LoadGeneratorState(generator)); in IsGeneratorClosed()
56 inline TNode<BoolT> IsGeneratorSuspended(Node* const generator) { in IsGeneratorSuspended() argument
57 return IsGeneratorStateSuspended(LoadGeneratorState(generator)); in IsGeneratorSuspended()
70 inline TNode<BoolT> IsGeneratorNotExecuting(Node* const generator) { in IsGeneratorNotExecuting() argument
71 return IsGeneratorStateNotExecuting(LoadGeneratorState(generator)); in IsGeneratorNotExecuting()
74 inline TNode<BoolT> IsGeneratorAwaiting(Node* const generator) { in IsGeneratorAwaiting() argument
76 LoadObjectField(generator, JSAsyncGeneratorObject::kIsAwaitingOffset); in IsGeneratorAwaiting()
80 inline void SetGeneratorAwaiting(Node* const generator) { in SetGeneratorAwaiting() argument
81 CSA_ASSERT(this, Word32BinaryNot(IsGeneratorAwaiting(generator))); in SetGeneratorAwaiting()
83 generator, JSAsyncGeneratorObject::kIsAwaitingOffset, SmiConstant(1)); in SetGeneratorAwaiting()
84 CSA_ASSERT(this, IsGeneratorAwaiting(generator)); in SetGeneratorAwaiting()
87 inline void SetGeneratorNotAwaiting(Node* const generator) { in SetGeneratorNotAwaiting() argument
88 CSA_ASSERT(this, IsGeneratorAwaiting(generator)); in SetGeneratorNotAwaiting()
90 generator, JSAsyncGeneratorObject::kIsAwaitingOffset, SmiConstant(0)); in SetGeneratorNotAwaiting()
91 CSA_ASSERT(this, Word32BinaryNot(IsGeneratorAwaiting(generator))); in SetGeneratorNotAwaiting()
94 inline void CloseGenerator(Node* const generator) { in CloseGenerator() argument
96 generator, JSGeneratorObject::kContinuationOffset, in CloseGenerator()
108 inline Node* LoadFirstAsyncGeneratorRequestFromQueue(Node* const generator) { in LoadFirstAsyncGeneratorRequestFromQueue() argument
109 return LoadObjectField(generator, JSAsyncGeneratorObject::kQueueOffset); in LoadFirstAsyncGeneratorRequestFromQueue()
129 Node* generator, Node* value,
133 Node* TakeFirstAsyncGeneratorRequestFromQueue(Node* generator);
134 Node* TakeFirstAsyncGeneratorRequestFromQueueIfPresent(Node* generator,
136 void AddAsyncGeneratorRequestToQueue(Node* generator, Node* request);
154 CodeStubArguments* args, Node* context, Node* generator, Node* value, in AsyncGeneratorEnqueue() argument
157 // of async generator requests to be executed. If the generator is not in AsyncGeneratorEnqueue()
165 Branch(TaggedIsAsyncGenerator(generator), &enqueue, in AsyncGeneratorEnqueue()
174 AddAsyncGeneratorRequestToQueue(generator, req); in AsyncGeneratorEnqueue()
176 // Let state be generator.[[AsyncGeneratorState]] in AsyncGeneratorEnqueue()
178 // Perform AsyncGeneratorResumeNext(Generator) in AsyncGeneratorEnqueue()
180 TNode<Smi> continuation = CAST(LoadGeneratorState(generator)); in AsyncGeneratorEnqueue()
186 CallBuiltin(Builtins::kAsyncGeneratorResumeNext, context, generator); in AsyncGeneratorEnqueue()
197 StringConstant(method_name), generator); in AsyncGeneratorEnqueue()
228 Node* const generator = in AsyncGeneratorAwaitResumeClosure() local
230 CSA_SLOW_ASSERT(this, TaggedIsAsyncGenerator(generator)); in AsyncGeneratorAwaitResumeClosure()
232 SetGeneratorNotAwaiting(generator); in AsyncGeneratorAwaitResumeClosure()
234 CSA_SLOW_ASSERT(this, IsGeneratorSuspended(generator)); in AsyncGeneratorAwaitResumeClosure()
236 // Remember the {resume_mode} for the {generator}. in AsyncGeneratorAwaitResumeClosure()
237 StoreObjectFieldNoWriteBarrier(generator, in AsyncGeneratorAwaitResumeClosure()
241 CallStub(CodeFactory::ResumeGenerator(isolate()), context, value, generator); in AsyncGeneratorAwaitResumeClosure()
243 TailCallBuiltin(Builtins::kAsyncGeneratorResumeNext, context, generator); in AsyncGeneratorAwaitResumeClosure()
248 Node* generator = Parameter(Descriptor::kGenerator); in AsyncGeneratorAwait() local
252 CSA_SLOW_ASSERT(this, TaggedIsAsyncGenerator(generator)); in AsyncGeneratorAwait()
254 Node* const request = LoadFirstAsyncGeneratorRequestFromQueue(generator); in AsyncGeneratorAwait()
259 generator); in AsyncGeneratorAwait()
268 SetGeneratorAwaiting(generator); in AsyncGeneratorAwait()
269 Await(context, generator, value, outer_promise, AwaitContext::kLength, in AsyncGeneratorAwait()
275 Node* generator, Node* request) { in AddAsyncGeneratorRequestToQueue() argument
280 LoadObjectField(generator, JSAsyncGeneratorObject::kQueueOffset)); in AddAsyncGeneratorRequestToQueue()
285 StoreObjectField(generator, JSAsyncGeneratorObject::kQueueOffset, request); in AddAsyncGeneratorRequestToQueue()
312 Node* generator) { in TakeFirstAsyncGeneratorRequestFromQueue() argument
315 CSA_ASSERT(this, TaggedIsAsyncGenerator(generator)); in TakeFirstAsyncGeneratorRequestFromQueue()
317 LoadObjectField(generator, JSAsyncGeneratorObject::kQueueOffset); in TakeFirstAsyncGeneratorRequestFromQueue()
322 StoreObjectField(generator, JSAsyncGeneratorObject::kQueueOffset, next); in TakeFirstAsyncGeneratorRequestFromQueue()
336 Node* generator = args.GetReceiver(); in TF_BUILTIN() local
340 AsyncGeneratorEnqueue(&args, context, generator, value, in TF_BUILTIN()
354 Node* generator = args.GetReceiver(); in TF_BUILTIN() local
358 AsyncGeneratorEnqueue(&args, context, generator, value, in TF_BUILTIN()
372 Node* generator = args.GetReceiver(); in TF_BUILTIN() local
376 AsyncGeneratorEnqueue(&args, context, generator, value, in TF_BUILTIN()
407 Node* const generator = Parameter(Descriptor::kGenerator); in TF_BUILTIN() local
417 // generator is not suspended due to an AwaitExpression. in TF_BUILTIN()
419 LoadGeneratorState(generator)); in TF_BUILTIN()
421 LoadFirstAsyncGeneratorRequestFromQueue(generator)); in TF_BUILTIN()
427 CSA_ASSERT(this, IsGeneratorNotExecuting(generator)); in TF_BUILTIN()
430 ReturnIf(IsGeneratorAwaiting(generator), UndefinedConstant()); in TF_BUILTIN()
446 CloseGenerator(generator); in TF_BUILTIN()
457 // and the generator is not closed, resume the generator with a "return" in TF_BUILTIN()
460 // generator is not closed, resume the generator with a "throw" completion. in TF_BUILTIN()
461 // If the generator was closed, perform AsyncGeneratorReject(thrownValue). in TF_BUILTIN()
464 context, generator); in TF_BUILTIN()
465 TailCallBuiltin(Builtins::kAsyncGeneratorReturn, context, generator, in TF_BUILTIN()
470 CallBuiltin(Builtins::kAsyncGeneratorReject, context, generator, in TF_BUILTIN()
472 var_next.Bind(LoadFirstAsyncGeneratorRequestFromQueue(generator)); in TF_BUILTIN()
479 CallBuiltin(Builtins::kAsyncGeneratorResolve, context, generator, in TF_BUILTIN()
481 var_state.Bind(LoadGeneratorState(generator)); in TF_BUILTIN()
482 var_next.Bind(LoadFirstAsyncGeneratorRequestFromQueue(generator)); in TF_BUILTIN()
488 // Remember the {resume_type} for the {generator}. in TF_BUILTIN()
490 generator, JSGeneratorObject::kResumeModeOffset, resume_type); in TF_BUILTIN()
492 LoadValueFromAsyncGeneratorRequest(next), generator); in TF_BUILTIN()
493 var_state.Bind(LoadGeneratorState(generator)); in TF_BUILTIN()
494 var_next.Bind(LoadFirstAsyncGeneratorRequestFromQueue(generator)); in TF_BUILTIN()
500 Node* const generator = Parameter(Descriptor::kGenerator); in TF_BUILTIN() local
505 CSA_SLOW_ASSERT(this, TaggedIsAsyncGenerator(generator)); in TF_BUILTIN()
506 CSA_ASSERT(this, Word32BinaryNot(IsGeneratorAwaiting(generator))); in TF_BUILTIN()
512 Node* const next = TakeFirstAsyncGeneratorRequestFromQueue(generator); in TF_BUILTIN()
568 Node* const generator = Parameter(Descriptor::kGenerator); in TF_BUILTIN() local
572 Node* const next = TakeFirstAsyncGeneratorRequestFromQueue(generator); in TF_BUILTIN()
580 Node* const generator = Parameter(Descriptor::kGenerator); in TF_BUILTIN() local
585 Node* const request = LoadFirstAsyncGeneratorRequestFromQueue(generator); in TF_BUILTIN()
590 generator); in TF_BUILTIN()
596 SetGeneratorAwaiting(generator); in TF_BUILTIN()
597 Await(context, generator, value, outer_promise, AwaitContext::kLength, in TF_BUILTIN()
605 Node* const generator = in TF_BUILTIN() local
608 SetGeneratorNotAwaiting(generator); in TF_BUILTIN()
611 // Return ! AsyncGeneratorResolve(_F_.[[Generator]], _value_, *false*). in TF_BUILTIN()
612 CallBuiltin(Builtins::kAsyncGeneratorResolve, context, generator, value, in TF_BUILTIN()
615 TailCallBuiltin(Builtins::kAsyncGeneratorResumeNext, context, generator); in TF_BUILTIN()
621 // resolve/reject closures depending on whether or not the generator is marked in TF_BUILTIN()
624 // In particular, non-closed generators will resume the generator with either in TF_BUILTIN()
627 // generator. (per proposal-async-iteration/#sec-asyncgeneratoryield step 8.b) in TF_BUILTIN()
629 // Closed generators do not resume the generator in the resolve/reject in TF_BUILTIN()
635 Node* const generator = Parameter(Descriptor::kGenerator); in TF_BUILTIN() local
638 Node* const req = LoadFirstAsyncGeneratorRequestFromQueue(generator); in TF_BUILTIN()
649 Node* const state = LoadGeneratorState(generator); in TF_BUILTIN()
661 generator); in TF_BUILTIN()
664 SetGeneratorAwaiting(generator); in TF_BUILTIN()
667 Await(context, generator, value, outer_promise, AwaitContext::kLength, in TF_BUILTIN()
675 // Resume the generator with "return" resume_mode, and finally perform
692 Node* const generator = in TF_BUILTIN() local
695 SetGeneratorNotAwaiting(generator); in TF_BUILTIN()
698 // #async-generator-resume-next-return-processor-fulfilled step 2: in TF_BUILTIN()
699 // Return ! AsyncGeneratorResolve(_F_.[[Generator]], _value_, *true*). in TF_BUILTIN()
700 CallBuiltin(Builtins::kAsyncGeneratorResolve, context, generator, value, in TF_BUILTIN()
703 TailCallBuiltin(Builtins::kAsyncGeneratorResumeNext, context, generator); in TF_BUILTIN()
710 Node* const generator = in TF_BUILTIN() local
713 SetGeneratorNotAwaiting(generator); in TF_BUILTIN()
716 // #async-generator-resume-next-return-processor-rejected step 2: in TF_BUILTIN()
717 // Return ! AsyncGeneratorReject(_F_.[[Generator]], _reason_). in TF_BUILTIN()
718 CallBuiltin(Builtins::kAsyncGeneratorReject, context, generator, value); in TF_BUILTIN()
720 TailCallBuiltin(Builtins::kAsyncGeneratorResumeNext, context, generator); in TF_BUILTIN()