Home
last modified time | relevance | path

Searched refs:promise (Results 1 - 25 of 44) sorted by relevance

12

/arkcompiler/ets_runtime/ecmascript/
H A Djs_promise.cpp27 const JSHandle<JSPromise> &promise) in CreateResolvingFunctions()
37 // 3. Set the [[Promise]] internal slot of resolve to promise. in CreateResolvingFunctions()
38 resolve->SetPromise(thread, promise); in CreateResolvingFunctions()
44 // 6. Set the [[Promise]] internal slot of reject to promise. in CreateResolvingFunctions()
45 reject->SetPromise(thread, promise); in CreateResolvingFunctions()
55 JSTaggedValue JSPromise::FulfillPromise(JSThread *thread, const JSHandle<JSPromise> &promise, in FulfillPromise() argument
59 // 1. Assert: the value of promise's [[PromiseState]] internal slot is "pending". in FulfillPromise()
60 ASSERT_PRINT(promise->GetPromiseState() == PromiseState::PENDING, "FulfillPromise: state must be pending"); in FulfillPromise()
61 // 2. Let reactions be the value of promise's [[PromiseFulfillReactions]] internal slot. in FulfillPromise()
62 JSHandle<TaggedQueue> reactions(thread, promise in FulfillPromise()
26 CreateResolvingFunctions(JSThread *thread, const JSHandle<JSPromise> &promise) CreateResolvingFunctions() argument
132 RejectPromise(JSThread *thread, const JSHandle<JSPromise> &promise, const JSHandle<JSTaggedValue> &reason) RejectPromise() argument
[all...]
H A Djs_async_generator_object.cpp160 // 2. Let promise be ? PromiseResolve(%Promise%, completion.[[Value]]). in AsyncGeneratorResumeNext()
163 JSTaggedValue promise = PromiseResolve(thread, in AsyncGeneratorResumeNext() local
165 JSHandle<JSPromise> handPromise(thread, promise); in AsyncGeneratorResumeNext()
186 // 11. Perform ! PerformPromiseThen(promise, onFulfilled, onRejected). in AsyncGeneratorResumeNext()
257 "Resolve: The promise and resolution cannot be the same.", StackCheck::NO); in AsyncGeneratorEnqueue()
272 JSHandle<JSObject> promise(thread, pcap->GetPromise()); in AsyncGeneratorEnqueue()
273 return promise.GetTaggedValue(); in AsyncGeneratorEnqueue()
299 JSHandle<JSObject> promise(thread, pcap->GetPromise()); in AsyncGeneratorEnqueue()
300 return promise.GetTaggedValue(); in AsyncGeneratorEnqueue()
303 JSTaggedValue JSAsyncGeneratorObject::PromiseResolve(JSThread *thread, const JSHandle<JSTaggedValue> promise, in PromiseResolve() argument
[all...]
H A Djs_async_function.cpp79 JSHandle<JSPromise> promise(thread, pcap->GetPromise()); in AsyncFunctionAwait()
81 thread, promise, JSHandle<JSTaggedValue>::Cast(fulFunc), JSHandle<JSTaggedValue>::Cast(rejFunc), tcap); in AsyncFunctionAwait()
110 // 2.Let promise be ? PromiseResolve(%Promise%, value). in AsyncFunctionAwait()
138 JSHandle<JSObject> promise = JSHandle<JSObject>::Cast(promiseValue); in AsyncFunctionAwait() local
139 BuiltinsPromise::PerformPromiseThen(thread, JSHandle<JSPromise>::Cast(promise), in AsyncFunctionAwait()
H A Djs_promise.h109 // ES6 25.4.1.3 CreateResolvingFunctions ( promise )
111 const JSHandle<JSPromise> &promise);
113 // ES6 25.4.1.4 FulfillPromise ( promise, value)
114 static JSTaggedValue FulfillPromise(JSThread *thread, const JSHandle<JSPromise> &promise,
123 // ES6 25.4.1.7 RejectPromise (promise, reason)
124 static JSTaggedValue RejectPromise(JSThread *thread, const JSHandle<JSPromise> &promise,
H A Djs_async_from_sync_iterator.cpp73 JSHandle<JSObject> promise = JSHandle<JSObject>::Cast(valueWrapper); in AsyncFromSyncIteratorContinuation() local
82 builtins::BuiltinsPromise::PerformPromiseThen(thread, JSHandle<JSPromise>::Cast(promise), in AsyncFromSyncIteratorContinuation()
/arkcompiler/runtime_core/static_core/plugins/ets/tests/native/promise/
H A Dpromise_test.cpp28 ets_object promise; in TEST_F() local
31 ASSERT_EQ(env_->PromiseCreate(&deferred, &promise), ETS_OK); in TEST_F()
38 CallEtsFuntion(&result, "check_resolve", promise); in TEST_F()
44 ets_object promise; in TEST_F() local
47 ASSERT_EQ(env_->PromiseCreate(&deferred, &promise), ETS_OK); in TEST_F()
54 CallEtsFuntion(&result, "check_reject", promise); in TEST_F()
/arkcompiler/ets_runtime/ecmascript/builtins/tests/
H A Dbuiltins_promise_test.cpp107 JSTaggedValue PromiseAlgorithm(JSThread *thread, JSHandle<JSFunction>& promise, JSTaggedValue arg, in PromiseAlgorithm() argument
110 auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); in PromiseAlgorithm()
111 ecmaRuntimeCallInfo->SetFunction(promise.GetTaggedValue()); in PromiseAlgorithm()
112 ecmaRuntimeCallInfo->SetThis(promise.GetTaggedValue()); in PromiseAlgorithm()
138 JSTaggedValue ThanAlgorithm(JSThread *thread, JSHandle<JSPromise>& promise, JSTaggedValue arg1, in ThanAlgorithm() argument
141 auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, promise.GetTaggedValue(), 8); in ThanAlgorithm()
142 ecmaRuntimeCallInfo->SetFunction(promise.GetTaggedValue()); in ThanAlgorithm()
143 ecmaRuntimeCallInfo->SetThis(promise.GetTaggedValue()); in ThanAlgorithm()
160 JSHandle<JSFunction> promise = JSHandle<JSFunction>::Cast(env->GetPromiseFunction()); in HWTEST_F_L0() local
167 auto result = PromiseAlgorithm(thread, promise, paramMs in HWTEST_F_L0()
184 JSHandle<JSFunction> promise = JSHandle<JSFunction>::Cast(env->GetPromiseFunction()); HWTEST_F_L0() local
217 JSHandle<JSFunction> promise = JSHandle<JSFunction>::Cast(env->GetPromiseFunction()); HWTEST_F_L0() local
240 JSHandle<JSFunction> promise = JSHandle<JSFunction>::Cast(env->GetPromiseFunction()); HWTEST_F_L0() local
272 JSHandle<JSFunction> promise = JSHandle<JSFunction>::Cast(env->GetPromiseFunction()); HWTEST_F_L0() local
321 JSHandle<JSFunction> promise = JSHandle<JSFunction>::Cast(env->GetPromiseFunction()); HWTEST_F_L0() local
391 JSHandle<JSFunction> promise = JSHandle<JSFunction>::Cast(env->GetPromiseFunction()); HWTEST_F_L0() local
460 JSHandle<JSFunction> promise = JSHandle<JSFunction>::Cast(env->GetPromiseFunction()); HWTEST_F_L0() local
507 JSHandle<JSFunction> promise = JSHandle<JSFunction>::Cast(env->GetPromiseFunction()); HWTEST_F_L0() local
549 JSHandle<JSFunction> promise = JSHandle<JSFunction>::Cast(env->GetPromiseFunction()); HWTEST_F_L0() local
[all...]
/arkcompiler/ets_runtime/test/fuzztest/promiserejectinfo_fuzzer/
H A Dpromiserejectinfo_fuzzer.cpp36 Local<JSValueRef> promise(promiseStirng); in PromiseRejectInfoNewFuzzTest()
40 [[maybe_unused]]PromiseRejectInfo promiseReject(promise, reason, in PromiseRejectInfoNewFuzzTest()
55 [[maybe_unused]]Local<PromiseRef> promise = capability->GetPromise(vm); in GetPromiseFuzzTest() local
69 Local<JSValueRef> promise(promiseStirng); in GetDataFuzzTest()
72 PromiseRejectInfo promiseReject(promise, reason, in GetDataFuzzTest()
88 Local<JSValueRef> promise(promiseStirng); in PromiseRejectInfoGetPromiseFuzzTest()
92 PromiseRejectInfo promiseReject(promise, reason, PromiseRejectInfo::PROMISE_REJECTION_EVENT::REJECT, newdata); in PromiseRejectInfoGetPromiseFuzzTest()
107 Local<JSValueRef> promise(promiseStirng); in PromiseRejectInfoGetReasonFuzzTest()
111 PromiseRejectInfo promiseReject(promise, reason, PromiseRejectInfo::PROMISE_REJECTION_EVENT::REJECT, data2); in PromiseRejectInfoGetReasonFuzzTest()
126 Local<JSValueRef> promise(promiseStirn in PromiseRejectInfoGetOperationFuzzTest()
[all...]
/arkcompiler/ets_runtime/test/fuzztest/promiseref_fuzzer/
H A Dpromiseref_fuzzer.cpp37 Local<PromiseRef> promise = capability->GetPromise(vm); in PromiseRefCatchFuzzTest() local
40 promise->Catch(vm, reject); in PromiseRefCatchFuzzTest()
57 Local<PromiseRef> promise = capability->GetPromise(vm); in PromiseRefThenFinallyFuzzTest() local
60 promise->Finally(vm, reject); in PromiseRefThenFinallyFuzzTest()
61 promise->Then(vm, reject, reject); in PromiseRefThenFinallyFuzzTest()
78 Local<PromiseRef> promise = capability->GetPromise(vm); in PromiseRefThenWithTwoParameterFuzzTest() local
81 promise->Then(vm, reject); in PromiseRefThenWithTwoParameterFuzzTest()
/arkcompiler/runtime_core/static_core/plugins/ets/runtime/intrinsics/
H A Dstd_core_Promise.cpp78 void EtsPromiseResolve(EtsPromise *promise, EtsObject *value) in EtsPromiseResolve() argument
81 if (promise == nullptr) { in EtsPromiseResolve()
87 EtsHandle<EtsPromise> hpromise(coro, promise); in EtsPromiseResolve()
104 // We can use internal promise's value as return value in EtsPromiseResolve()
110 void EtsPromiseReject(EtsPromise *promise, EtsObject *error) in EtsPromiseReject() argument
113 if (promise == nullptr) { in EtsPromiseReject()
119 EtsHandle<EtsPromise> hpromise(coro, promise); in EtsPromiseReject()
128 void EtsPromiseSubmitCallback(EtsPromise *promise, EtsObject *callback) in EtsPromiseSubmitCallback() argument
134 EtsHandle<EtsPromise> hpromise(coro, promise); in EtsPromiseSubmitCallback()
160 * This is a backed by JS equivalent promise in AwaitProxyPromise()
190 EtsAwaitPromise(EtsPromise *promise) EtsAwaitPromise() argument
[all...]
/arkcompiler/runtime_core/static_core/runtime/coroutines/
H A Dcoroutine_events.h128 * @param promise A weak reference (from global storage) to the language-dependent promise object that will hold
131 explicit CompletionEvent(mem::Reference *promise, CoroutineManager *coroManager) in CompletionEvent() argument
132 : CoroutineEvent(Type::COMPLETION, coroManager), promise_(promise) in CompletionEvent()
142 void SetPromise(mem::Reference *promise) in SetPromise() argument
145 promise_ = promise; in SetPromise()
/arkcompiler/ets_runtime/ecmascript/tests/
H A Djs_promise_test.cpp54 JSHandle<JSTaggedValue> promise = env->GetPromiseFunction(); in HWTEST_F_L0() local
56 JSHandle<PromiseCapability> capbility = JSPromise::NewPromiseCapability(thread, promise); in HWTEST_F_L0()
75 JSHandle<JSTaggedValue> promise = env->GetPromiseFunction(); in HWTEST_F_L0() local
76 JSHandle<PromiseCapability> capbility = JSPromise::NewPromiseCapability(thread, promise); in HWTEST_F_L0()
94 JSHandle<JSTaggedValue> promise = env->GetPromiseFunction(); in HWTEST_F_L0() local
95 JSHandle<PromiseCapability> capbility = JSPromise::NewPromiseCapability(thread, promise); in HWTEST_F_L0()
/arkcompiler/ets_runtime/test/fuzztest/jsvaluerefispromisevalue_fuzzer/
H A Djsvaluerefispromisevalue_fuzzer.cpp41 Local<PromiseRef> promise = capability->GetPromise(vm); in JSValueRefIsPromiseValueFuzzTest() local
45 Local<PromiseRef> catchPromise = promise->Catch(vm, reject); in JSValueRefIsPromiseValueFuzzTest()
46 promise->IsPromise(vm); in JSValueRefIsPromiseValueFuzzTest()
/arkcompiler/runtime_core/static_core/plugins/ets/tests/interop_js/tests/promise/
H A Drun_to_js_and_back_test.js24 let promise = etsVm.call('getPromise');
25 etsVm.call('setAndCheckPromise', promise);
H A Dawait_js_promise.js82 let promise = promiseCreator();
84 let res = etsVm.call('testAwaitJsPromise', promise);
103 // resolve the passed promise if necessary
/arkcompiler/runtime_core/static_core/plugins/ets/runtime/
H A Dets_coroutine.cpp83 auto *promise = EtsPromise::FromCoreType(storage->Get(promiseRef)); in RequestCompletion() local
85 if (promise == nullptr) { in RequestCompletion()
88 << " has completed, but the associated promise has been already collected by the GC. Exception thrown: " in RequestCompletion()
94 EtsHandle<EtsPromise> hpromise(this, promise); in RequestCompletion()
124 EtsObject *EtsCoroutine::GetValueFromPromiseSync(EtsPromise *promise) in GetValueFromPromiseSync() argument
126 return intrinsics::EtsAwaitPromise(promise); in GetValueFromPromiseSync()
H A Dets_entrypoints.cpp69 auto *promise = reinterpret_cast<EtsPromise *>(obj); in LaunchCoroutine() local
70 ASSERT(promise != nullptr); in LaunchCoroutine()
89 EtsHandle<EtsPromise> promiseHandle(currentCoro, promise); in LaunchCoroutine()
119 EtsPromise *promise = EtsPromise::Create(); in LaunchFromInterpreterImpl() local
120 if (UNLIKELY(promise == nullptr)) { in LaunchFromInterpreterImpl()
134 EtsHandle<EtsPromise> promiseHandle(currentCoro, promise); in LaunchFromInterpreterImpl()
H A Dets_coroutine.h112 EtsObject *GetValueFromPromiseSync(EtsPromise *promise);
/arkcompiler/ets_runtime/ecmascript/builtins/
H A Dbuiltins_async_from_sync_iterator.cpp127 JSHandle<JSObject> promise(thread, pcap->GetPromise()); in Throw()
128 return promise.GetTaggedValue(); in Throw()
171 JSHandle<JSObject> promise(thread, pcap->GetPromise()); in Return()
172 return promise.GetTaggedValue(); in Return()
205 JSHandle<JSObject> promise(thread, pcap->GetPromise()); in Return()
206 return promise.GetTaggedValue(); in Return()
H A Dbuiltins_promise.cpp47 // 3. Let promise be OrdinaryCreateFromConstructor(NewTarget, "%PromisePrototype%", in PromiseConstructor()
49 // 4. ReturnIfAbrupt(promise). in PromiseConstructor()
55 // 5. Set promise's [[PromiseState]] internal slot to "pending". in PromiseConstructor()
56 // 6. Set promise's [[PromiseFulfillReactions]] internal slot to a new empty List. in PromiseConstructor()
57 // 7. Set promise's [[PromiseRejectReactions]] internal slot to a new empty List. in PromiseConstructor()
58 // 8. Let resolvingFunctions be CreateResolvingFunctions(promise). in PromiseConstructor()
86 // 11. Return promise. in PromiseConstructor()
270 JSHandle<JSObject> promise(thread, promiseCapability->GetPromise()); in Resolve()
271 return promise.GetTaggedValue(); in Resolve()
307 JSHandle<JSObject> promise(threa in Reject()
329 JSHandle<JSTaggedValue> promise = GetThis(argv); Catch() local
358 JSHandle<JSObject> promise = JSHandle<JSObject>::Cast(thisValue); Then() local
375 PerformPromiseThen(JSThread *thread, const JSHandle<JSPromise> &promise, const JSHandle<JSTaggedValue> &onFulfilled, const JSHandle<JSTaggedValue> &onRejected, const JSHandle<PromiseCapability> &capability) PerformPromiseThen() argument
1048 JSHandle<JSTaggedValue> promise = GetThis(argv); Finally() local
[all...]
H A Dbuiltins_promise_job.cpp93 JSHandle<JSTaggedValue> promise = GetCallArg(argv, 0); in PromiseResolveThenableJob() local
94 ASSERT(promise->IsJSPromise()); in PromiseResolveThenableJob()
97 JSPromise::CreateResolvingFunctions(thread, JSHandle<JSPromise>::Cast(promise)); in PromiseResolveThenableJob()
/arkcompiler/ets_runtime/test/aottest/asyncgenerator/
H A Dasyncgenerator.js65 var promise = Promise.resolve(2).then(() => 3);
66 return asyncIterator_2.return(promise).then(function(result) {
/arkcompiler/runtime_core/static_core/plugins/ets/runtime/types/
H A Dets_promise.h51 static EtsPromise *FromCoreType(ObjectHeader *promise) in FromCoreType() argument
53 return reinterpret_cast<EtsPromise *>(promise); in FromCoreType()
71 static EtsPromise *FromEtsObject(EtsObject *promise) in FromEtsObject() argument
73 return reinterpret_cast<EtsPromise *>(promise); in FromEtsObject()
211 /// Allows to get exclusive access to the promise state
234 /// Blocks current coroutine until promise is resolved/rejected
242 // launch promise then/catch callback: void()
277 ObjectPointer<EtsObject> linkedPromise_; // linked JS promise as JSValue (if exists)
279 EtsLong remotePromiseResolver_; // resolver for mirror promise
/arkcompiler/runtime_core/static_core/plugins/ets/runtime/napi/
H A Dets_napi_helpers.cpp394 EtsPromise *promise = EtsPromise::Create(currentCoro); in EtsAsyncCall() local
395 if (UNLIKELY(promise == nullptr)) { in EtsAsyncCall()
400 auto promiseRef = vm->GetGlobalObjectStorage()->Add(promise, mem::Reference::ObjectType::GLOBAL); in EtsAsyncCall()
429 EtsHandle<EtsPromise> promiseHandle(currentCoro, promise); in EtsAsyncCall()
/arkcompiler/ets_runtime/ecmascript/napi/test/
H A Djsnapi_first_tests.cpp644 Local<PromiseRef> promise = capability->GetPromise(vm_); in HWTEST_F_L0() local
646 Local<PromiseRef> catchPromise = promise->Catch(vm_, reject); in HWTEST_F_L0()
647 ASSERT_TRUE(promise->IsPromise(vm_)); in HWTEST_F_L0()
661 Local<PromiseRef> promise = capability->GetPromise(vm_); in HWTEST_F_L0() local
663 Local<PromiseRef> catchPromise = promise->Catch(vm_, reject); in HWTEST_F_L0()
664 ASSERT_TRUE(promise->IsPromise(vm_)); in HWTEST_F_L0()
703 Local<PromiseRef> promise = capability->GetPromise(vm_); in HWTEST_F_L0() local
706 Local<PromiseRef> thenPromise = promise->Then(vm_, resolve, reject); in HWTEST_F_L0()
707 ASSERT_TRUE(promise->IsPromise(vm_)); in HWTEST_F_L0()
720 Local<PromiseRef> promise in HWTEST_F_L0() local
1637 Local<PromiseRef> promise = capability->GetPromise(vm_); HWTEST_F_L0() local
[all...]

Completed in 17 milliseconds

12