Lines Matching refs:thread
23 JSTaggedValue JSIterator::IteratorCloseAndReturn(JSThread *thread, const JSHandle<JSTaggedValue> &iter)
25 ASSERT(thread->HasPendingException());
26 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
27 JSTaggedValue exception = thread->GetException();
29 JSHandle<JSTaggedValue>(thread, exception)));
30 JSHandle<JSTaggedValue> result = JSIterator::IteratorClose(thread, iter, record);
31 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
38 JSHandle<JSTaggedValue> JSIterator::GetIterator(JSThread *thread, const JSHandle<JSTaggedValue> &obj)
41 RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, obj);
43 JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
45 JSHandle<JSTaggedValue> func = JSObject::GetMethod(thread, obj, iteratorSymbol);
46 RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, obj);
48 return GetIterator(thread, obj, func);
51 JSHandle<JSTaggedValue> JSIterator::GetIterator(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
55 RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, obj);
57 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
58 EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, method, obj, undefined, 0);
60 RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
61 JSHandle<JSTaggedValue> iter(thread, ret);
64 THROW_TYPE_ERROR_AND_RETURN(thread, "JSIterator::GetIterator: iter is not object", undefined);
69 JSHandle<JSTaggedValue> JSIterator::GetAsyncIterator(JSThread *thread, const JSHandle<JSTaggedValue> &obj)
72 JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
73 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
77 JSHandle<JSTaggedValue> method = JSObject::GetMethod(thread, obj, asynciteratorSymbol);
78 RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, obj);
81 JSHandle<JSTaggedValue> func = JSObject::GetMethod(thread, obj, iteratorSymbol);
82 RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
83 JSHandle<JSTaggedValue> syncIterator = GetIterator(thread, obj, func);
84 JSHandle<JSTaggedValue> nextStr = thread->GlobalConstants()->GetHandledNextString();
85 JSHandle<JSTaggedValue> nextMethod = JSTaggedValue::GetProperty(thread, syncIterator, nextStr).GetValue();
86 RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
90 JSAsyncFromSyncIterator::CreateAsyncFromSyncIterator(thread, syncIteratorRecord);
91 RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
96 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
97 EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, method, obj, undefined, 0);
99 RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
100 JSHandle<JSTaggedValue> iterator(thread, ret);
103 THROW_TYPE_ERROR_AND_RETURN(thread, "Is not object", undefined);
110 JSHandle<JSTaggedValue> JSIterator::IteratorNext(JSThread *thread, const JSHandle<JSTaggedValue> &iter)
112 const GlobalEnvConstants *globalConst = thread->GlobalConstants();
116 JSHandle<JSTaggedValue> next(JSObject::GetMethod(thread, iter, key));
117 RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
119 EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, next, iter, undefined, 0);
122 RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, undefined);
125 THROW_TYPE_ERROR_AND_RETURN(thread, "Is not Object", undefined);
127 JSHandle<JSTaggedValue> result(thread, ret);
131 JSHandle<JSTaggedValue> JSIterator::IteratorNext(JSThread *thread, const JSHandle<JSTaggedValue> &iter,
134 const GlobalEnvConstants *globalConst = thread->GlobalConstants();
137 JSHandle<JSTaggedValue> next(JSObject::GetMethod(thread, iter, key));
138 RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
140 EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, next, iter, undefined, 1);
141 RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, undefined);
145 RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, undefined);
148 THROW_TYPE_ERROR_AND_RETURN(thread, "Is not Object", undefined);
150 JSHandle<JSTaggedValue> result(thread, ret);
154 JSHandle<JSTaggedValue> JSIterator::IteratorNext(JSThread *thread, const JSHandle<AsyncIteratorRecord> &iter,
157 const GlobalEnvConstants *globalConst = thread->GlobalConstants();
159 JSHandle<JSTaggedValue> iterator(thread, iter->GetIterator());
160 JSHandle<JSTaggedValue> next(thread, iter->GetNextMethod());
162 EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, next, iterator, undefined, 1);
163 RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, undefined);
167 RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, undefined);
170 THROW_TYPE_ERROR_AND_RETURN(thread, "Is not Object", undefined);
172 JSHandle<JSTaggedValue> result(thread, ret);
176 JSHandle<JSTaggedValue> JSIterator::IteratorNext(JSThread *thread, const JSHandle<AsyncIteratorRecord> &iter)
178 const GlobalEnvConstants *globalConst = thread->GlobalConstants();
180 JSHandle<JSTaggedValue> iterator(thread, iter->GetIterator());
181 JSHandle<JSTaggedValue> next(thread, iter->GetNextMethod());
183 EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, next, iterator, undefined, 0);
186 RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, undefined);
189 THROW_TYPE_ERROR_AND_RETURN(thread, "Is not Object", undefined);
191 JSHandle<JSTaggedValue> result(thread, ret);
195 bool JSIterator::IteratorComplete(JSThread *thread, const JSHandle<JSTaggedValue> &iterResult)
199 JSHandle<JSTaggedValue> doneStr = thread->GlobalConstants()->GetHandledDoneString();
200 JSHandle<JSTaggedValue> done = JSTaggedValue::GetProperty(thread, iterResult, doneStr).GetValue();
201 RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false);
205 JSHandle<JSTaggedValue> JSIterator::IteratorValue(JSThread *thread, const JSHandle<JSTaggedValue> &iterResult)
209 JSHandle<JSTaggedValue> valueStr = thread->GlobalConstants()->GetHandledValueString();
210 JSHandle<JSTaggedValue> value = JSTaggedValue::GetProperty(thread, iterResult, valueStr).GetValue();
211 RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
215 JSHandle<JSTaggedValue> JSIterator::IteratorStep(JSThread *thread, const JSHandle<JSTaggedValue> &iter)
218 JSHandle<JSTaggedValue> result = IteratorNext(thread, iter);
220 RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, result);
222 bool done = IteratorComplete(thread, result);
224 JSHandle<JSTaggedValue> doneHandle(thread, JSTaggedValue(done));
225 RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, doneHandle);
228 JSHandle<JSTaggedValue> falseHandle(thread, JSTaggedValue::False());
234 JSHandle<JSTaggedValue> JSIterator::IteratorClose(JSThread *thread, const JSHandle<JSTaggedValue> &iter,
239 const GlobalEnvConstants *globalConst = thread->GlobalConstants();
241 if (thread->HasPendingException()) {
242 exceptionOnThread = JSHandle<JSTaggedValue>(thread, thread->GetException());
243 thread->ClearException();
247 JSTaggedValue func = ObjectFastOperator::FastGetPropertyByName(thread, iter.GetTaggedValue(), returnStr);
249 JSHandle<JSTaggedValue> returnFunc(thread, func);
250 RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, returnFunc);
255 thread->SetException(exceptionOnThread.GetTaggedValue());
261 THROW_TYPE_ERROR_AND_RETURN(thread, "return function is not Callable", returnFunc);
265 EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, returnFunc, iter, undefined, 0);
267 RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
269 thread->SetException(exceptionOnThread.GetTaggedValue());
271 JSHandle<JSTaggedValue> innerResult(thread, ret);
272 JSHandle<CompletionRecord> completionRecord(thread, globalConst->GetUndefined());
279 thread->SetException(exceptionOnThread.GetTaggedValue());
284 if (thread->HasPendingException()) {
289 THROW_TYPE_ERROR_AND_RETURN(thread, "Is not object", undefined);
292 thread->SetException(exceptionOnThread.GetTaggedValue());
297 JSHandle<JSObject> JSIterator::CreateIterResultObject(JSThread *thread, const JSHandle<JSTaggedValue> &value, bool done)
299 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
300 auto globalConst = thread->GlobalConstants();
307 obj->SetPropertyInlinedProps(thread, VALUE_INLINE_PROPERTY_INDEX, value.GetTaggedValue());
308 obj->SetPropertyInlinedProps(thread, DONE_INLINE_PROPERTY_INDEX, JSTaggedValue(done));