150 StoreRoot(RootIndex::kCurrentMicrotask, microtask);
157 Label is_callable(
this), is_callback(
this),
158 is_promise_fulfill_reaction_job(
this),
159 is_promise_reject_reaction_job(
this),
160 is_promise_resolve_thenable_job(
this),
163 int32_t case_values[] = {CALLABLE_TASK_TYPE, CALLBACK_TASK_TYPE,
164 PROMISE_FULFILL_REACTION_JOB_TASK_TYPE,
165 PROMISE_REJECT_REACTION_JOB_TASK_TYPE,
166 PROMISE_RESOLVE_THENABLE_JOB_TASK_TYPE};
167 Label* case_labels[] = {
168 &is_callable, &is_callback, &is_promise_fulfill_reaction_job,
169 &is_promise_reject_reaction_job, &is_promise_resolve_thenable_job};
171 Switch(microtask_type, &is_unreachable, case_values, case_labels,
182#ifdef V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA
183 SetupContinuationPreservedEmbedderData(microtask);
189 Call(microtask_context, callable, UndefinedConstant());
193#ifdef V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA
194 ClearContinuationPreservedEmbedderData();
205#ifdef V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA
206 SetupContinuationPreservedEmbedderData(microtask);
221 CallRuntime(Runtime::kRunMicrotaskCallback, current_context,
222 microtask_callback, microtask_data);
224#ifdef V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA
225 ClearContinuationPreservedEmbedderData();
230 BIND(&is_promise_resolve_thenable_job);
234 microtask, PromiseResolveThenableJobTask::kContextOffset);
239 microtask, PromiseResolveThenableJobTask::kPromiseToResolveOffset);
241 LoadObjectField(microtask, PromiseResolveThenableJobTask::kThenOffset);
243 microtask, PromiseResolveThenableJobTask::kThenableOffset);
244#ifdef V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA
245 SetupContinuationPreservedEmbedderData(microtask);
248 CAST(promise_to_resolve));
253 promise_to_resolve, thenable, then);
257 CAST(promise_to_resolve));
261#ifdef V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA
262 ClearContinuationPreservedEmbedderData();
267 BIND(&is_promise_fulfill_reaction_job);
271 microtask, PromiseReactionJobTask::kContextOffset);
280 microtask, PromiseReactionJobTask::kPromiseOrCapabilityOffset));
282#ifdef V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA
283 SetupContinuationPreservedEmbedderData(microtask);
288 promise_or_capability);
292 CallBuiltin(Builtin::kPromiseFulfillReactionJob, microtask_context,
293 argument, job_handler, promise_or_capability);
298 promise_or_capability);
300#ifdef V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA
301 ClearContinuationPreservedEmbedderData();
309 BIND(&is_promise_reject_reaction_job);
313 microtask, PromiseReactionJobTask::kContextOffset);
322 microtask, PromiseReactionJobTask::kPromiseOrCapabilityOffset));
324#ifdef V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA
325 SetupContinuationPreservedEmbedderData(microtask);
330 promise_or_capability);
334 CallBuiltin(Builtin::kPromiseRejectReactionJob, microtask_context,
335 argument, job_handler, promise_or_capability);
340 promise_or_capability);
342#ifdef V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA
343 ClearContinuationPreservedEmbedderData();
351 BIND(&is_unreachable);
358 var_exception.value());
534 auto microtask = Parameter<Microtask>(Descriptor::kMicrotask);
535 auto context = Parameter<Context>(Descriptor::kContext);
541 Label if_shutdown(
this, Label::kDeferred);
549 Label if_grow(
this, Label::kDeferred);
550 GotoIf(IntPtrEqual(size, capacity), &if_grow);
555 CalculateRingBufferOffset(capacity,
start, size),
556 BitcastTaggedToWord(microtask));
559 IntPtrAdd(size, IntPtrConstant(1)));
560 Return(UndefinedConstant());
570 ExternalConstant(ExternalReference::call_enqueue_microtask_function());
575 Return(UndefinedConstant());
579 Return(UndefinedConstant());
587 UncheckedParameter<RawPtrT>(Descriptor::kMicrotaskQueue);
589 Label loop(
this), done(
this);
596 GotoIf(WordEqual(size, IntPtrConstant(0)), &done);
603 CalculateRingBufferOffset(capacity,
start, IntPtrConstant(0));
609 IntPtrSub(capacity, IntPtrConstant(1)));
616 RunSingleMicrotask(current_context, microtask);
623 StoreRoot(RootIndex::kCurrentMicrotask, UndefinedConstant());
624 Return(UndefinedConstant());