• Home
  • Raw
  • Download

Lines Matching full:thread

42     JSThread *thread = argv->GetThread();  in PromiseConstructor()  local
43 [[maybe_unused]] EcmaHandleScope handleScope(thread); in PromiseConstructor()
44 EcmaVM *ecmaVm = thread->GetEcmaVM(); in PromiseConstructor()
46 const GlobalEnvConstants *globalConst = thread->GlobalConstants(); in PromiseConstructor()
50 …THROW_TYPE_ERROR_AND_RETURN(thread, "PromiseConstructor: NewTarget is undefined", JSTaggedValue::E… in PromiseConstructor()
55 …THROW_TYPE_ERROR_AND_RETURN(thread, "PromiseConstructor: executor is not callable", JSTaggedValue:… in PromiseConstructor()
64 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in PromiseConstructor()
70 …gFunctionsRecord> resolvingFunction = JSPromise::CreateResolvingFunctions(thread, instancePromise); in PromiseConstructor()
74 InternalCallParams *arguments = thread->GetInternalCallParams(); in PromiseConstructor()
77 …JSTaggedValue taggedValue = JSFunction::Call(thread, executor, thisValue, 2, arguments->GetArgv())… in PromiseConstructor()
78 JSHandle<JSTaggedValue> completionValue(thread, taggedValue); in PromiseConstructor()
83 if (thread->HasPendingException()) { in PromiseConstructor()
84 completionValue = JSPromise::IfThrowGetThrowValue(thread); in PromiseConstructor()
85 thread->ClearException(); in PromiseConstructor()
86 JSHandle<JSTaggedValue> reject(thread, resolvingFunction->GetRejectFunction()); in PromiseConstructor()
88 JSFunction::Call(thread, reject, thisValue, 1, arguments->GetArgv()); in PromiseConstructor()
89 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in PromiseConstructor()
101 JSThread *thread = argv->GetThread(); in All() local
102 [[maybe_unused]] EcmaHandleScope handleScope(thread); in All()
103 EcmaVM *ecmaVm = thread->GetEcmaVM(); in All()
111 …THROW_TYPE_ERROR_AND_RETURN(thread, "Promise ALL: this value is not object", JSTaggedValue::Except… in All()
116 JSHandle<JSTaggedValue> sctor = JSObject::GetProperty(thread, ctor, speciesSymbol).GetValue(); in All()
117 RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, sctor.GetTaggedValue()); in All()
124 JSHandle<PromiseCapability> capa = JSPromise::NewPromiseCapability(thread, ctor); in All()
126 RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, capa.GetTaggedValue()); in All()
128 JSHandle<JSTaggedValue> itor = JSIterator::GetIterator(thread, GetCallArg(argv, 0)); in All()
130 if (thread->HasPendingException()) { in All()
131 itor = JSPromise::IfThrowGetThrowValue(thread); in All()
133 RETURN_REJECT_PROMISE_IF_ABRUPT(thread, itor, capa); in All()
139 JSHandle<CompletionRecord> result = PerformPromiseAll(thread, itRecord, ctor, capa); in All()
142 thread->ClearException(); in All()
147 JSIterator::IteratorClose(thread, itor, JSHandle<JSTaggedValue>::Cast(result)); in All()
150 RETURN_REJECT_PROMISE_IF_ABRUPT(thread, result, capa); in All()
154 RETURN_REJECT_PROMISE_IF_ABRUPT(thread, result, capa); in All()
166 JSThread *thread = argv->GetThread(); in Race() local
167 [[maybe_unused]] EcmaHandleScope handleScope(thread); in Race()
168 EcmaVM *ecmaVm = thread->GetEcmaVM(); in Race()
175 … THROW_TYPE_ERROR_AND_RETURN(thread, "Race: this value is not object", JSTaggedValue::Exception()); in Race()
181 …JSHandle<JSTaggedValue> speciesConstructor = JSObject::GetProperty(thread, thisValue, speciesSymbo… in Race()
182 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in Race()
189 …JSHandle<PromiseCapability> promiseCapability = JSPromise::NewPromiseCapability(thread, thisValue); in Race()
190 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in Race()
195 JSHandle<JSTaggedValue> iterator = JSIterator::GetIterator(thread, iterable); in Race()
196 if (thread->HasPendingException()) { in Race()
197 iterator = JSPromise::IfThrowGetThrowValue(thread); in Race()
199 RETURN_REJECT_PROMISE_IF_ABRUPT(thread, iterator, promiseCapability); in Race()
210 …JSHandle<CompletionRecord> result = PerformPromiseRace(thread, iteratorRecord, promiseCapability, … in Race()
212 thread->ClearException(); in Race()
215 JSIterator::IteratorClose(thread, iterator, JSHandle<JSTaggedValue>::Cast(result)); in Race()
218 RETURN_REJECT_PROMISE_IF_ABRUPT(thread, result, promiseCapability); in Race()
222 RETURN_REJECT_PROMISE_IF_ABRUPT(thread, result, promiseCapability); in Race()
233 JSThread *thread = argv->GetThread(); in Resolve() local
234 [[maybe_unused]] EcmaHandleScope handleScope(thread); in Resolve()
236 const GlobalEnvConstants *globalConst = thread->GlobalConstants(); in Resolve()
241 …THROW_TYPE_ERROR_AND_RETURN(thread, "Resolve: this value is not object", JSTaggedValue::Exception(… in Resolve()
250 … JSHandle<JSTaggedValue> ctorValue = JSObject::GetProperty(thread, xValue, ctorKey).GetValue(); in Resolve()
251 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in Resolve()
259 …JSHandle<PromiseCapability> promiseCapability = JSPromise::NewPromiseCapability(thread, thisValue); in Resolve()
260 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in Resolve()
264 JSHandle<JSTaggedValue> resolve(thread, promiseCapability->GetResolve()); in Resolve()
266 InternalCallParams *arguments = thread->GetInternalCallParams(); in Resolve()
268 JSFunction::Call(thread, resolve, undefined, 1, arguments->GetArgv()); in Resolve()
269 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in Resolve()
272 JSHandle<JSObject> promise(thread, promiseCapability->GetPromise()); in Resolve()
281 JSThread *thread = argv->GetThread(); in Reject() local
282 [[maybe_unused]] EcmaHandleScope handleScope(thread); in Reject()
283 const GlobalEnvConstants *globalConst = thread->GlobalConstants(); in Reject()
289 …THROW_TYPE_ERROR_AND_RETURN(thread, "Reject: this value is not object", JSTaggedValue::Exception()… in Reject()
294 …JSHandle<PromiseCapability> promiseCapability = JSPromise::NewPromiseCapability(thread, thisValue); in Reject()
295 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in Reject()
300 JSHandle<JSTaggedValue> reject(thread, promiseCapability->GetReject()); in Reject()
302 InternalCallParams *arguments = thread->GetInternalCallParams(); in Reject()
304 JSFunction::Call(thread, reject, undefined, 1, arguments->GetArgv()); in Reject()
305 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in Reject()
308 JSHandle<JSObject> promise(thread, promiseCapability->GetPromise()); in Reject()
326 JSThread *thread = argv->GetThread(); in Catch() local
327 [[maybe_unused]] EcmaHandleScope handleScope(thread); in Catch()
328 const GlobalEnvConstants *globalConst = thread->GlobalConstants(); in Catch()
333 InternalCallParams *arguments = thread->GetInternalCallParams(); in Catch()
335 return JSFunction::Invoke(thread, promise, thenKey, 2, arguments->GetArgv()); // 2: two args in Catch()
343 JSThread *thread = argv->GetThread(); in Then() local
344 [[maybe_unused]] EcmaHandleScope handleScope(thread); in Then()
345 auto ecmaVm = thread->GetEcmaVM(); in Then()
352 …THROW_TYPE_ERROR_AND_RETURN(thread, "Then: thisValue is not promise!", JSTaggedValue::Exception()); in Then()
358 … JSHandle<JSTaggedValue> constructor = JSObject::SpeciesConstructor(thread, promise, defaultFunc); in Then()
359 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in Then()
363 …JSHandle<PromiseCapability> resultCapability = JSPromise::NewPromiseCapability(thread, constructor… in Then()
364 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in Then()
370 …return PerformPromiseThen(thread, JSHandle<JSPromise>::Cast(promise), onFulfilled, onRejected, res… in Then()
373 JSTaggedValue BuiltinsPromise::PerformPromiseThen(JSThread *thread, const JSHandle<JSPromise> &prom… in PerformPromiseThen() argument
378 auto ecmaVm = thread->GetEcmaVM(); in PerformPromiseThen()
382 JSMutableHandle<JSTaggedValue> fulfilled(thread, onFulfilled.GetTaggedValue()); in PerformPromiseThen()
383 auto globalConst = thread->GlobalConstants(); in PerformPromiseThen()
387 JSMutableHandle<JSTaggedValue> rejected(thread, onRejected.GetTaggedValue()); in PerformPromiseThen()
392 fulfillReaction->SetPromiseCapability(thread, capability.GetTaggedValue()); in PerformPromiseThen()
393 fulfillReaction->SetHandler(thread, fulfilled.GetTaggedValue()); in PerformPromiseThen()
396 rejectReaction->SetPromiseCapability(thread, capability.GetTaggedValue()); in PerformPromiseThen()
397 rejectReaction->SetHandler(thread, rejected.GetTaggedValue()); in PerformPromiseThen()
401 JSHandle<TaggedQueue> fulfillReactions(thread, promise->GetPromiseFulfillReactions()); in PerformPromiseThen()
403 … TaggedQueue::Push(thread, fulfillReactions, JSHandle<JSTaggedValue>::Cast(fulfillReaction)); in PerformPromiseThen()
404 promise->SetPromiseFulfillReactions(thread, JSTaggedValue(newQueue)); in PerformPromiseThen()
406 JSHandle<TaggedQueue> rejectReactions(thread, promise->GetPromiseRejectReactions()); in PerformPromiseThen()
407 …newQueue = TaggedQueue::Push(thread, rejectReactions, JSHandle<JSTaggedValue>::Cast(rejectReaction… in PerformPromiseThen()
408 promise->SetPromiseRejectReactions(thread, JSTaggedValue(newQueue)); in PerformPromiseThen()
411 argv->Set(thread, 0, fulfillReaction.GetTaggedValue()); in PerformPromiseThen()
412 argv->Set(thread, 1, promise->GetPromiseResult()); in PerformPromiseThen()
415 …job::MicroJobQueue::EnqueueJob(thread, job, job::QueueType::QUEUE_PROMISE, promiseReactionsJob, ar… in PerformPromiseThen()
418 argv->Set(thread, 0, rejectReaction.GetTaggedValue()); in PerformPromiseThen()
419 argv->Set(thread, 1, promise->GetPromiseResult()); in PerformPromiseThen()
423 JSHandle<JSTaggedValue> reason(thread, JSTaggedValue::Null()); in PerformPromiseThen()
424thread->GetEcmaVM()->PromiseRejectionTracker(promise, reason, PromiseRejectionEvent::HANDLE); in PerformPromiseThen()
427 …job::MicroJobQueue::EnqueueJob(thread, job, job::QueueType::QUEUE_PROMISE, promiseReactionsJob, ar… in PerformPromiseThen()
433 JSHandle<CompletionRecord> BuiltinsPromise::PerformPromiseAll(JSThread *thread, in PerformPromiseAll() argument
438 auto ecmaVm = thread->GetEcmaVM(); in PerformPromiseAll()
439 const GlobalEnvConstants *globalConst = thread->GlobalConstants(); in PerformPromiseAll()
447 values->SetValue(thread, emptyArray); in PerformPromiseAll()
450 remainCnt->SetValue(thread, JSTaggedNumber(1)); in PerformPromiseAll()
454 JSHandle<JSTaggedValue> itor(thread, itRecord->GetIterator()); in PerformPromiseAll()
455 JSMutableHandle<JSTaggedValue> next(thread, globalConst->GetUndefined()); in PerformPromiseAll()
458 next.Update(JSIterator::IteratorStep(thread, itor).GetTaggedValue()); in PerformPromiseAll()
460 if (thread->HasPendingException()) { in PerformPromiseAll()
462 next.Update(JSPromise::IfThrowGetThrowValue(thread).GetTaggedValue()); in PerformPromiseAll()
465 RETURN_COMPLETION_IF_ABRUPT(thread, next); in PerformPromiseAll()
471 remainCnt->SetValue(thread, --JSTaggedNumber(remainCnt->GetValue())); in PerformPromiseAll()
476 … JSArray::CreateArrayFromList(thread, JSHandle<TaggedArray>(thread, values->GetValue())); in PerformPromiseAll()
478 JSHandle<JSTaggedValue> resCapaFunc(thread, capa->GetResolve()); in PerformPromiseAll()
479 InternalCallParams *arguments = thread->GetInternalCallParams(); in PerformPromiseAll()
482 …JSFunction::Call(thread, resCapaFunc, globalConst->GetHandledUndefined(), 1, arguments->GetArgv()); in PerformPromiseAll()
484 JSHandle<JSTaggedValue> resolveAbrupt(thread, resolveRes); in PerformPromiseAll()
485 RETURN_COMPLETION_IF_ABRUPT(thread, resolveAbrupt); in PerformPromiseAll()
489 CompletionRecordType::NORMAL, JSHandle<JSTaggedValue>(thread, capa->GetPromise())); in PerformPromiseAll()
493 JSHandle<JSTaggedValue> nextVal = JSIterator::IteratorValue(thread, next); in PerformPromiseAll()
495 if (thread->HasPendingException()) { in PerformPromiseAll()
497 nextVal = JSHandle<JSTaggedValue>(thread, thread->GetException()); in PerformPromiseAll()
501 RETURN_COMPLETION_IF_ABRUPT(thread, nextVal); in PerformPromiseAll()
504 JSHandle<TaggedArray>::Cast(JSHandle<JSTaggedValue>(thread, values->GetValue())); in PerformPromiseAll()
505 valuesArray = TaggedArray::SetCapacity(thread, valuesArray, index + 1); in PerformPromiseAll()
506 valuesArray->Set(thread, index, JSTaggedValue::Undefined()); in PerformPromiseAll()
507 values->SetValue(thread, valuesArray); in PerformPromiseAll()
510 InternalCallParams *arguments = thread->GetInternalCallParams(); in PerformPromiseAll()
512 …JSTaggedValue taggedNextPromise = JSFunction::Invoke(thread, ctor, resolveKey, 1, arguments->GetAr… in PerformPromiseAll()
514 JSHandle<JSTaggedValue> nextPromise(thread, taggedNextPromise); in PerformPromiseAll()
515 RETURN_COMPLETION_IF_ABRUPT(thread, nextPromise); in PerformPromiseAll()
522 falseRecord->SetValue(thread, JSTaggedValue::False()); in PerformPromiseAll()
523 resoleveElement->SetAlreadyCalled(thread, falseRecord); in PerformPromiseAll()
525 resoleveElement->SetIndex(thread, JSTaggedValue(index)); in PerformPromiseAll()
527 resoleveElement->SetValues(thread, values); in PerformPromiseAll()
529 resoleveElement->SetCapabilities(thread, capa); in PerformPromiseAll()
531 resoleveElement->SetRemainingElements(thread, remainCnt); in PerformPromiseAll()
533 remainCnt->SetValue(thread, ++JSTaggedNumber(remainCnt->GetValue())); in PerformPromiseAll()
538 … JSFunction::Invoke(thread, nextPromise, thenKey, 2, arguments->GetArgv()); // 2: two args in PerformPromiseAll()
540 JSHandle<JSTaggedValue> result(thread, taggedResult); in PerformPromiseAll()
542 RETURN_COMPLETION_IF_ABRUPT(thread, result); in PerformPromiseAll()
548 JSHandle<CompletionRecord> BuiltinsPromise::PerformPromiseRace(JSThread *thread, in PerformPromiseRace() argument
567 auto ecmaVm = thread->GetEcmaVM(); in PerformPromiseRace()
568 const GlobalEnvConstants *globalConst = thread->GlobalConstants(); in PerformPromiseRace()
570 JSHandle<JSTaggedValue> iterator(thread, iteratorRecord->GetIterator()); in PerformPromiseRace()
571 JSMutableHandle<JSTaggedValue> next(thread, globalConst->GetUndefined()); in PerformPromiseRace()
573 next.Update(JSIterator::IteratorStep(thread, iterator).GetTaggedValue()); in PerformPromiseRace()
574 if (thread->HasPendingException()) { in PerformPromiseRace()
576 next.Update(JSPromise::IfThrowGetThrowValue(thread).GetTaggedValue()); in PerformPromiseRace()
578 RETURN_COMPLETION_IF_ABRUPT(thread, next); in PerformPromiseRace()
581 JSHandle<JSTaggedValue> promise(thread, capability->GetPromise()); in PerformPromiseRace()
586 JSHandle<JSTaggedValue> nextValue = JSIterator::IteratorValue(thread, next); in PerformPromiseRace()
587 if (thread->HasPendingException()) { in PerformPromiseRace()
589 nextValue = JSPromise::IfThrowGetThrowValue(thread); in PerformPromiseRace()
591 RETURN_COMPLETION_IF_ABRUPT(thread, nextValue); in PerformPromiseRace()
594 InternalCallParams *arguments = thread->GetInternalCallParams(); in PerformPromiseRace()
596 …JSTaggedValue result = JSFunction::Invoke(thread, constructor, resolveStr, 1, arguments->GetArgv()… in PerformPromiseRace()
598 JSHandle<JSTaggedValue> nextPromise(thread, result); in PerformPromiseRace()
599 if (thread->HasPendingException()) { in PerformPromiseRace()
600 nextPromise = JSPromise::IfThrowGetThrowValue(thread); in PerformPromiseRace()
602 RETURN_COMPLETION_IF_ABRUPT(thread, nextPromise); in PerformPromiseRace()
606 …result = JSFunction::Invoke(thread, nextPromise, thenStr, 2, arguments->GetArgv()); // 2: two args in PerformPromiseRace()
608 JSHandle<JSTaggedValue> handleResult(thread, result); in PerformPromiseRace()
609 if (thread->HasPendingException()) { in PerformPromiseRace()
610 handleResult = JSPromise::IfThrowGetThrowValue(thread); in PerformPromiseRace()
612 RETURN_COMPLETION_IF_ABRUPT(thread, handleResult); in PerformPromiseRace()