Lines Matching refs:thread
41 JSThread *thread = argv->GetThread();
42 [[maybe_unused]] EcmaHandleScope handleScope(thread);
51 thread, containers::ErrorFlag::IS_NULL_ERROR, "The ArkTS Array's constructor cannot be directly invoked.");
52 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
62 return JSSharedArray::ArrayCreate(thread, JSTaggedNumber(0), newTarget).GetTaggedValue();
66 JSTaggedValue newArray = JSSharedArray::ArrayCreate(thread, JSTaggedNumber(argc), newTarget).GetTaggedValue();
67 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
69 THROW_TYPE_ERROR_AND_RETURN(thread, "Failed to create array.", JSTaggedValue::Exception());
71 JSHandle<JSObject> newArrayHandle(thread, newArray);
80 JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
81 JSMutableHandle<JSTaggedValue> itemK(thread, JSTaggedValue::Undefined());
86 auto error = ContainerError::ParamError(thread, "Parameter error.Only accept sendable value.");
87 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
89 JSObject::CreateDataProperty(thread, newArrayHandle, key, itemK);
93 JSSharedArray::Cast(*newArrayHandle)->SetArrayLength(thread, argc);
104 JSThread *thread = argv->GetThread();
105 [[maybe_unused]] EcmaHandleScope handleScope(thread);
118 THROW_TYPE_ERROR_AND_RETURN(thread, "the mapfn is not callable.", JSTaggedValue::Exception());
125 THROW_TYPE_ERROR_AND_RETURN(thread, "The items is null.", JSTaggedValue::Exception());
129 return BuiltinsString::StringToSList(thread, strItems);
133 auto error = ContainerError::ParamError(thread, "Parameter error.TypedArray not support yet.");
134 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
137 JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
139 JSHandle<JSTaggedValue> usingIterator = JSObject::GetMethod(thread, items, iteratorSymbol);
141 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
143 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
146 JSHandle<JSTaggedValue> iterator(thread, JSTaggedValue::Hole());
148 iterator = JSIterator::GetIterator(thread, items, usingIterator);
150 return JSMapIterator::MapIteratorToList(thread, iterator);
162 EcmaInterpreter::NewRuntimeCallInfo(thread, thisHandle, undefined, undefined, 0);
164 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
166 newArray = JSSharedArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue();
167 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
170 THROW_TYPE_ERROR_AND_RETURN(thread, "Failed to construct the array.", JSTaggedValue::Exception());
172 JSHandle<JSObject> newArrayHandle(thread, newArray);
175 iterator = JSIterator::GetIterator(thread, items, usingIterator);
177 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
182 JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
183 JSMutableHandle<JSTaggedValue> mapValue(thread, JSTaggedValue::Undefined());
188 JSHandle<JSTaggedValue> next = JSIterator::IteratorStep(thread, iterator);
190 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
196 JSSharedArray::LengthSetter(thread, newArrayHandle, key, true);
197 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
202 JSHandle<JSTaggedValue> nextValue = JSIterator::IteratorValue(thread, next);
204 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
213 EcmaInterpreter::NewRuntimeCallInfo(thread, mapfn, thisArgHandle, undefined, argsLength);
214 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
217 RETURN_VALUE_IF_ABRUPT_COMPLETION(thread,
218 JSIterator::IteratorClose(thread, iterator, mapValue).GetTaggedValue());
224 auto error = ContainerError::ParamError(thread, "Parameter error.Only accept sendable value.");
225 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
230 JSHandle<JSTaggedValue> defineStatus(thread, JSTaggedValue(JSObject::CreateDataPropertyOrThrow(
231 thread, newArrayHandle, key, mapValue, SCheckMode::SKIP)));
232 RETURN_VALUE_IF_ABRUPT_COMPLETION(thread,
233 JSIterator::IteratorClose(thread, iterator, defineStatus).GetTaggedValue());
239 JSHandle<JSObject> arrayLikeObj = JSTaggedValue::ToObject(thread, items);
241 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
244 int64_t len = ArrayHelper::GetArrayLength(thread, arrayLike);
246 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
255 EcmaInterpreter::NewRuntimeCallInfo(thread, thisHandle, undefined, undefined, 1);
256 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
259 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
261 newArray = JSSharedArray::ArrayCreate(thread, JSTaggedNumber(static_cast<double>(len))).GetTaggedValue();
262 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
265 THROW_TYPE_ERROR_AND_RETURN(thread, "Failed to construct the array.", JSTaggedValue::Exception());
267 JSHandle<JSObject> newArrayHandle(thread, newArray);
276 JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
277 JSMutableHandle<JSTaggedValue> mapValue(thread, JSTaggedValue::Undefined());
280 JSHandle<JSTaggedValue> kValue = JSSharedArray::FastGetPropertyByValue(thread, arrayLike, k);
281 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
286 EcmaInterpreter::NewRuntimeCallInfo(thread, mapfn, thisArgHandle, undefined, argsLength);
287 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
290 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
296 auto error = ContainerError::ParamError(thread, "Parameter error.Only accept sendable value.");
297 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
299 JSObject::CreateDataPropertyOrThrow(thread, newArrayHandle, k, mapValue, SCheckMode::SKIP);
300 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
304 JSHandle<JSTaggedValue> lenHandle(thread, JSTaggedValue(len));
305 JSSharedArray::LengthSetter(thread, newArrayHandle, lenHandle, true);
308 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
318 JSThread *thread = argv->GetThread();
319 [[maybe_unused]] EcmaHandleScope handleScope(thread);
321 auto error = ContainerError::ParamError(thread, "Parameter error.Not enough parameters.");
322 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
327 auto error = ContainerError::ParamError(thread, "Parameter error.Invalid array length.");
328 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
330 auto arrayLength = JSTaggedValue::ToUint32(thread, arrayLengthValue);
331 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
333 auto error = ContainerError::ParamError(thread, "Parameter error.Invalid array length.");
334 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
338 auto error = ContainerError::ParamError(thread, "Parameter error.Only accept sendable value.");
339 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
341 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
345 EcmaInterpreter::NewRuntimeCallInfo(thread, thisHandle, undefined, undefined, 0);
347 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
349 newArray = JSSharedArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue();
350 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
353 THROW_TYPE_ERROR_AND_RETURN(thread, "Failed to construct the array.", JSTaggedValue::Exception());
355 JSHandle<JSObject> newArrayHandle(thread, newArray);
356 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
359 elements->Set(thread, k, initValue);
361 newArrayHandle->SetElements(thread, elements);
362 auto len = JSHandle<JSTaggedValue>(thread, JSTaggedValue(arrayLength));
363 JSSharedArray::LengthSetter(thread, newArrayHandle, len, true);
365 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
374 JSThread *thread = argv->GetThread();
375 BUILTINS_API_TRACE(thread, SharedArray, IsArray);
376 [[maybe_unused]] EcmaHandleScope handleScope(thread);
396 JSThread *thread = argv->GetThread();
397 [[maybe_unused]] EcmaHandleScope handleScope(thread);
403 auto error = ContainerError::BindError(thread, "The concat method cannot be bound.");
404 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
406 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
407 [[maybe_unused]] ConcurrentApiScope<JSSharedArray> scope(thread, thisHandle);
408 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
413 JSTaggedValue newArray = JSSharedArray::ArraySpeciesCreate(thread, thisObjHandle, JSTaggedNumber(arrayLen));
414 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
416 THROW_TYPE_ERROR_AND_RETURN(thread, "array must be object or undefined.", JSTaggedValue::Exception());
418 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
419 JSHandle<JSObject> newArrayHandle(thread, newArray);
423 JSMutableHandle<JSTaggedValue> ele(thread, JSTaggedValue::Undefined());
424 JSMutableHandle<JSTaggedValue> fromKey(thread, JSTaggedValue::Undefined());
425 JSMutableHandle<JSTaggedValue> toKey(thread, JSTaggedValue::Undefined());
435 auto error = ContainerError::ParamError(thread, "Parameter error.Only accept sendable value.");
436 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
439 bool isSpreadable = ArrayHelper::IsConcatSpreadable(thread, ele);
440 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
446 int64_t len = ArrayHelper::GetArrayLength(thread, ele);
448 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
450 THROW_TYPE_ERROR_AND_RETURN(thread, "out of range.", JSTaggedValue::Exception());
453 if (ele->IsStableJSArray(thread)) {
454 JSStableArray::Concat(thread, newArrayHandle, JSHandle<JSObject>::Cast(ele), k, n);
455 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
462 fromKey.Update(JSTaggedValue::ToString(thread, JSTaggedValue(k)));
464 bool exists = JSTaggedValue::HasProperty(thread, ele, fromKey);
465 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
469 JSSharedArray::FastGetPropertyByValue(thread, ele, fromKey);
471 auto error = ContainerError::ParamError(thread, "Parameter error.Only accept sendable value.");
472 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
474 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
476 JSObject::CreateDataPropertyOrThrow(thread, newArrayHandle, toKey, fromValHandle, SCheckMode::SKIP);
477 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
488 THROW_TYPE_ERROR_AND_RETURN(thread, "out of range.", JSTaggedValue::Exception());
492 JSObject::CreateDataPropertyOrThrow(thread, newArrayHandle, n, ele, SCheckMode::SKIP);
493 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
498 JSHandle<JSTaggedValue> lenHandle(thread, JSTaggedValue(n));
499 JSSharedArray::LengthSetter(thread, newArrayHandle, lenHandle, true);
500 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
511 JSThread *thread = argv->GetThread();
512 [[maybe_unused]] EcmaHandleScope handleScope(thread);
515 auto error = ContainerError::BindError(thread, "The entries method cannot be bound.");
516 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
518 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
521 JSHandle<JSObject> self = JSTaggedValue::ToObject(thread, GetThis(argv));
522 [[maybe_unused]] ConcurrentApiScope<JSSharedArray> scope(thread, thisHandle);
523 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
528 JSTaggedValue BuiltinsSharedArray::CheckElementForEvery(JSThread *thread,
534 JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
535 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
538 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
540 uint64_t len = static_cast<uint64_t>(ArrayHelper::GetArrayLength(thread, thisObjVal));
542 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
544 bool exists = JSTaggedValue::HasProperty(thread, thisObjVal, k);
545 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
547 JSHandle<JSTaggedValue> kValue = JSSharedArray::FastGetPropertyByValue(thread, thisObjVal, k);
548 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
551 EcmaInterpreter::NewRuntimeCallInfo(thread, callbackFnHandle, thisArgHandle, undefined, argsLength);
552 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
555 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
561 thread->CheckSafepointIfSuspended();
571 JSThread *thread = argv->GetThread();
572 [[maybe_unused]] EcmaHandleScope handleScope(thread);
577 auto error = ContainerError::BindError(thread, "The every method cannot be bound.");
578 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
580 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
582 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
584 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
589 THROW_TYPE_ERROR_AND_RETURN(thread, "the callbackfun is not callable.", JSTaggedValue::Exception());
609 if (thisObjVal->IsStableJSArray(thread)) {
610 callResult = JSStableArray::HandleEveryOfStable(thread, thisObjHandle, callbackFnHandle, thisArgHandle, k);
611 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
616 return CheckElementForEvery(thread, thisObjVal, callbackFnHandle, thisArgHandle, k);
624 JSThread *thread = argv->GetThread();
625 [[maybe_unused]] EcmaHandleScope handleScope(thread);
630 auto error = ContainerError::BindError(thread, "The some method cannot be bound.");
631 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
633 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
635 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
639 int64_t len = ArrayHelper::GetArrayLength(thread, thisObjVal);
641 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
646 THROW_TYPE_ERROR_AND_RETURN(thread, "the callbackfun is not callable.", JSTaggedValue::Exception());
664 JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
665 JSMutableHandle<JSTaggedValue> kValue(thread, JSTaggedValue::Undefined());
668 if (thisObjVal->IsStableJSArray(thread)) {
669 callResult = JSStableArray::HandleSomeOfStable(thread, thisObjHandle, callbackFnHandle, thisArgHandle, k);
670 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
677 JSTaggedValue::HasProperty(thread, thisObjVal, k));
678 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
681 kValue.Update(JSArray::FastGetPropertyByValue(thread, thisObjVal, key));
682 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
684 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
686 EcmaInterpreter::NewRuntimeCallInfo(thread, callbackFnHandle, thisArgHandle, undefined, argsLength);
687 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
690 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
696 thread->CheckSafepointIfSuspended();
708 JSThread *thread = argv->GetThread();
709 [[maybe_unused]] EcmaHandleScope handleScope(thread);
714 auto error = ContainerError::BindError(thread, "The fill method cannot be bound.");
715 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
717 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisObjVal);
718 [[maybe_unused]] ConcurrentApiScope<JSSharedArray, ModType::WRITE> scope(thread, thisObjVal);
719 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
726 JSObject::TryOptimizeAsFastElements(thread, thisObjHandle);
732 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
736 auto error = ContainerError::ParamError(thread, "Parameter error.Only accept sendable value.");
737 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
742 value = JSHandle<JSTaggedValue>(thread, JSTaggedValue::ToBigInt(thread, value));
744 value = JSHandle<JSTaggedValue>(thread, JSTaggedValue::ToNumber(thread, value));
746 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
750 int64_t len = ArrayHelper::GetLength(thread, thisObjVal);
752 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
756 JSTaggedNumber argStartTemp = JSTaggedValue::ToInteger(thread, startArg);
758 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
773 JSTaggedNumber argEndTemp = JSTaggedValue::ToInteger(thread, endArg);
775 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
793 if (thisObjVal->IsStableJSArray(thread) && !startArg->IsJSObject() && !endArg->IsJSObject()) {
794 auto opResult = JSStableArray::Fill(thread, thisObjHandle, value, start, end, len);
799 bool result = JSTypedArray::FastTypedArrayFill(thread, thisObjVal, value, start, end);
800 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
807 JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
810 JSSharedArray::FastSetPropertyByValue(thread, thisObjVal, key, value);
811 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
819 JSTaggedValue BuiltinsSharedArray::FilterUnStableJSArray(JSThread *thread, JSHandle<JSTaggedValue> &thisArgHandle,
823 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
826 JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
827 JSMutableHandle<JSTaggedValue> toIndexHandle(thread, JSTaggedValue::Undefined());
829 bool exists = JSTaggedValue::HasProperty(thread, thisObjVal, k);
830 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
832 JSHandle<JSTaggedValue> kValue = JSSharedArray::FastGetPropertyByValue(thread, thisObjVal, k);
833 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
836 EcmaInterpreter::NewRuntimeCallInfo(thread, callbackFnHandle, thisArgHandle, undefined, argsLength);
837 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
840 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
843 JSObject::CreateDataPropertyOrThrow(thread, newArrayHandle, toIndexHandle, kValue, SCheckMode::SKIP);
844 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
857 JSThread *thread = argv->GetThread();
858 BUILTINS_API_TRACE(thread, SharedArray, Filter);
859 [[maybe_unused]] EcmaHandleScope handleScope(thread);
864 auto error = ContainerError::BindError(thread, "The filter method cannot be bound.");
865 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
867 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
868 [[maybe_unused]] ConcurrentApiScope<JSSharedArray> scope(thread, thisHandle);
870 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
874 uint64_t len = static_cast<uint64_t>(ArrayHelper::GetArrayLength(thread, thisObjVal));
876 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
881 THROW_TYPE_ERROR_AND_RETURN(thread, "the callbackfun is not callable.", JSTaggedValue::Exception());
889 JSTaggedValue newArray = JSSharedArray::ArraySpeciesCreate(thread, thisObjHandle, JSTaggedNumber(arrayLen));
891 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
892 JSHandle<JSObject> newArrayHandle(thread, newArray);
911 JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
912 JSMutableHandle<JSTaggedValue> toIndexHandle(thread, JSTaggedValue::Undefined());
914 if (thisObjVal->IsStableJSArray(thread)) {
916 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
919 FilterUnStableJSArray(thread, thisArgHandle, thisObjVal, k, len, toIndex, newArrayHandle, callbackFnHandle);
929 JSThread *thread = argv->GetThread();
930 [[maybe_unused]] EcmaHandleScope handleScope(thread);
935 auto error = ContainerError::BindError(thread, "The find method cannot be bound.");
936 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
938 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
939 [[maybe_unused]] ConcurrentApiScope<JSSharedArray> scope(thread, thisHandle);
941 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
945 int64_t len = ArrayHelper::GetLength(thread, thisObjVal);
947 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
952 THROW_TYPE_ERROR_AND_RETURN(thread, "the predicate is not callable.", JSTaggedValue::Exception());
967 JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
970 JSHandle<JSTaggedValue> kValue = JSSharedArray::FastGetPropertyByValue(thread, thisObjVal, k);
971 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
974 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
976 EcmaInterpreter::NewRuntimeCallInfo(thread, callbackFnHandle, thisArgHandle, undefined, argsLength);
977 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
980 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
996 JSThread *thread = argv->GetThread();
997 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1002 auto error = ContainerError::BindError(thread, "The findIndex method cannot be bound.");
1003 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
1005 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
1006 [[maybe_unused]] ConcurrentApiScope<JSSharedArray> scope(thread, thisHandle);
1008 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1012 uint64_t len = static_cast<uint64_t>(ArrayHelper::GetLength(thread, thisObjVal));
1014 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1019 THROW_TYPE_ERROR_AND_RETURN(thread, "the predicate is not callable.", JSTaggedValue::Exception());
1036 if (thisObjVal->IsStableJSArray(thread)) {
1037 callResult = JSStableArray::HandleFindIndexOfStable(thread, thisObjHandle, callbackFnHandle, thisArgHandle, k);
1038 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1043 JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
1044 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
1047 JSHandle<JSTaggedValue> kValue = JSSharedArray::FastGetPropertyByValue(thread, thisObjVal, k);
1048 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1051 EcmaInterpreter::NewRuntimeCallInfo(thread, callbackFnHandle, thisArgHandle, undefined, argsLength);
1052 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1055 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1070 JSThread *thread = argv->GetThread();
1071 BUILTINS_API_TRACE(thread, SharedArray, ForEach);
1072 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1077 auto error = ContainerError::BindError(thread, "The forEach method cannot be bound.");
1078 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
1080 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
1081 [[maybe_unused]] ConcurrentApiScope<JSSharedArray> scope(thread, thisHandle);
1083 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1087 uint64_t len = static_cast<uint64_t>(ArrayHelper::GetArrayLength(thread, thisObjVal));
1089 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1094 THROW_TYPE_ERROR_AND_RETURN(thread, "the callbackfun is not callable.", JSTaggedValue::Exception());
1111 JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
1113 if (thisObjVal->IsStableJSArray(thread)) {
1114 JSStableArray::HandleforEachOfStable(thread, thisObjHandle, callbackFnHandle, thisArgHandle, len, k);
1115 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1118 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
1120 bool exists = JSTaggedValue::HasProperty(thread, thisObjVal, k);
1121 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1123 JSHandle<JSTaggedValue> kValue = JSSharedArray::FastGetPropertyByValue(thread, thisObjVal, k);
1124 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1127 EcmaInterpreter::NewRuntimeCallInfo(thread, callbackFnHandle, thisArgHandle, undefined, argsLength);
1128 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1131 RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, funcResult);
1141 EcmaRuntimeCallInfo *argv, JSThread *thread, const JSHandle<JSTaggedValue> &thisHandle)
1144 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
1146 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1149 int64_t length = ArrayHelper::GetLength(thread, thisObjVal);
1151 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1157 int64_t fromIndex = ArrayHelper::GetStartIndexFromArgs(thread, argv, 1, length);
1158 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1159 return IndexOfSlowPath(argv, thread, thisObjVal, length, fromIndex);
1163 EcmaRuntimeCallInfo *argv, JSThread *thread, const JSHandle<JSTaggedValue> &thisObjVal,
1169 JSMutableHandle<JSTaggedValue> keyHandle(thread, JSTaggedValue::Undefined());
1174 bool found = ArrayHelper::ElementIsStrictEqualTo(thread, thisObjVal, keyHandle, target);
1175 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1188 JSThread *thread = argv->GetThread();
1189 BUILTINS_API_TRACE(thread, SharedArray, IndexOf);
1190 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1194 auto error = ContainerError::BindError(thread, "The indexOf method cannot be bound.");
1195 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
1197 [[maybe_unused]] ConcurrentApiScope<JSSharedArray> scope(thread, thisHandle);
1198 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1201 if (thisHandle->IsStableJSArray(thread)) {
1202 auto error = ContainerError::BindError(thread, "The indexOf method not support stable array.");
1203 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
1205 opResult = IndexOfSlowPath(argv, thread, thisHandle);
1215 JSThread *thread = argv->GetThread();
1219 auto error = ContainerError::BindError(thread, "The join method cannot be bound.");
1220 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
1222 [[maybe_unused]] ConcurrentApiScope<JSSharedArray> scope(thread, thisHandle);
1223 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1232 JSThread *thread = argv->GetThread();
1236 auto error = ContainerError::BindError(thread, "The keys method cannot be bound.");
1237 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
1239 [[maybe_unused]] ConcurrentApiScope<JSSharedArray> scope(thread, thisHandle);
1240 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1250 JSThread *thread = argv->GetThread();
1251 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1256 auto error = ContainerError::BindError(thread, "The map method cannot be bound.");
1257 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
1259 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
1260 [[maybe_unused]] ConcurrentApiScope<JSSharedArray> scope(thread, thisHandle);
1262 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1266 int64_t rawLen = ArrayHelper::GetArrayLength(thread, thisObjVal);
1268 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1273 THROW_TYPE_ERROR_AND_RETURN(thread, "the callbackfun is not callable.", JSTaggedValue::Exception());
1281 JSSharedArray::ArraySpeciesCreate(thread, thisObjHandle, JSTaggedNumber(static_cast<double>(rawLen)));
1283 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1285 THROW_TYPE_ERROR_AND_RETURN(thread, "Failed to create Object.", JSTaggedValue::Exception());
1287 JSHandle<JSObject> newArrayHandle(thread, newArray);
1304 if (thisObjVal->IsStableJSArray(thread)) {
1306 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1308 JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
1309 JSMutableHandle<JSTaggedValue> mapResultHandle(thread, JSTaggedValue::Undefined());
1310 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
1313 bool exists = JSTaggedValue::HasProperty(thread, thisObjVal, k);
1314 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1316 JSHandle<JSTaggedValue> kValue = JSSharedArray::FastGetPropertyByValue(thread, thisObjVal, k);
1317 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1320 EcmaInterpreter::NewRuntimeCallInfo(thread, callbackFnHandle, thisArgHandle, undefined, argsLength);
1321 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1325 auto error = ContainerError::ParamError(thread, "Parameter error.Only accept sendable value.");
1326 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
1328 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1330 JSObject::CreateDataPropertyOrThrow(thread, newArrayHandle, k, mapResultHandle, SCheckMode::SKIP);
1331 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1346 JSThread *thread = argv->GetThread();
1347 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1352 auto error = ContainerError::BindError(thread, "The pop method cannot be bound.");
1353 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
1355 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
1356 [[maybe_unused]] ConcurrentApiScope<JSSharedArray, ModType::WRITE> scope(thread, thisHandle);
1357 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1366 JSThread *thread = argv->GetThread();
1367 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1370 if (thisHandle->IsStableJSArray(thread) && JSObject::IsArrayLengthWritable(thread, thisObjHandle)) {
1375 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1379 int64_t len = ArrayHelper::GetArrayLength(thread, thisObjVal);
1381 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1387 JSHandle<JSTaggedValue> lengthValue(thread, JSTaggedValue(0));
1388 JSSharedArray::LengthSetter(thread, thisObjHandle, lengthValue, true);
1389 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1404 JSHandle<JSTaggedValue> indexHandle(thread, JSTaggedValue(newLen));
1406 JSTaggedValue::GetProperty(thread, thisObjVal, indexHandle, SCheckMode::SKIP).GetValue();
1407 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1408 JSTaggedValue::DeletePropertyOrThrow(thread, thisObjVal, indexHandle);
1409 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1410 JSSharedArray::LengthSetter(thread, thisObjHandle, indexHandle, true);
1411 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1421 JSThread *thread = argv->GetThread();
1422 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1425 auto error = ContainerError::BindError(thread, "The push method cannot be bound.");
1426 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
1428 [[maybe_unused]] ConcurrentApiScope<JSSharedArray, ModType::WRITE> scope(thread, thisHandle);
1429 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1430 if (thisHandle->IsStableJSArray(thread)) {
1438 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
1440 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1444 int64_t len = ArrayHelper::GetArrayLength(thread, thisObjVal);
1446 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1449 THROW_TYPE_ERROR_AND_RETURN(thread, "out of range.", JSTaggedValue::Exception());
1458 JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
1463 auto error = ContainerError::ParamError(thread, "Parameter error.Only accept sendable value.");
1464 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
1466 JSSharedArray::FastSetPropertyByValue(thread, thisObjVal, key, kValue);
1467 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1474 JSSharedArray::LengthSetter(thread, thisObjHandle, key, true);
1476 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1482 JSTaggedValue BuiltinsSharedArray::ReduceUnStableJSArray(JSThread *thread, JSHandle<JSTaggedValue> &thisHandle,
1486 const GlobalEnvConstants *globalConst = thread->GlobalConstants();
1488 JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
1490 bool exists = (thisHandle->IsTypedArray() || JSTaggedValue::HasProperty(thread, thisObjVal, k));
1491 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1493 JSHandle<JSTaggedValue> kValue = JSSharedArray::FastGetPropertyByValue(thread, thisObjVal, k);
1494 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1500 EcmaInterpreter::NewRuntimeCallInfo(thread, callbackFnHandle, thisArgHandle, undefined, argsLength);
1501 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1505 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1518 JSThread *thread = argv->GetThread();
1519 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1525 auto error = ContainerError::BindError(thread, "The reduce method cannot be bound.");
1526 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
1528 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
1529 [[maybe_unused]] ConcurrentApiScope<JSSharedArray> scope(thread, thisHandle);
1531 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1535 int64_t len = ArrayHelper::GetLength(thread, thisObjVal);
1537 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1542 THROW_TYPE_ERROR_AND_RETURN(thread, "the callbackfun is not callable.", JSTaggedValue::Exception());
1547 THROW_TYPE_ERROR_AND_RETURN(thread, "out of range.", JSTaggedValue::Exception());
1565 JSMutableHandle<JSTaggedValue> accumulator(thread, JSTaggedValue::Undefined());
1572 JSTaggedValue::HasProperty(thread, thisObjVal, k));
1573 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1575 accumulator.Update(JSSharedArray::FastGetPropertyByValue(thread, thisObjVal, k).GetTaggedValue());
1576 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1581 THROW_TYPE_ERROR_AND_RETURN(thread, "accumulator can't be initialized.", JSTaggedValue::Exception());
1585 if (thisObjVal->IsStableJSArray(thread)) {
1586 JSStableArray::Reduce(thread, thisObjHandle, callbackFnHandle, accumulator, k, len);
1587 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1589 auto opResult = ReduceUnStableJSArray(thread, thisHandle, thisObjVal, k, len, accumulator, callbackFnHandle);
1598 JSThread *thread = argv->GetThread();
1599 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1604 auto error = ContainerError::BindError(thread, "The shift method cannot be bound.");
1605 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
1607 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
1608 [[maybe_unused]] ConcurrentApiScope<JSSharedArray, ModType::WRITE> scope(thread, thisHandle);
1610 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1611 if (thisHandle->IsStableJSArray(thread) && JSObject::IsArrayLengthWritable(thread, thisObjHandle)) {
1618 int64_t len = ArrayHelper::GetArrayLength(thread, thisObjVal);
1620 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1626 JSHandle<JSTaggedValue> zeroLenHandle(thread, JSTaggedValue(len));
1627 JSSharedArray::LengthSetter(thread, thisObjHandle, zeroLenHandle, false);
1628 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1633 JSHandle<JSTaggedValue> firstKey(thread, JSTaggedValue(0));
1635 JSTaggedValue::GetProperty(thread, thisObjVal, firstKey, SCheckMode::SKIP).GetValue();
1637 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1654 JSMutableHandle<JSTaggedValue> toKey(thread, JSTaggedValue::Undefined());
1657 bool exists = JSTaggedValue::HasProperty(thread, thisObjVal, k);
1658 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1660 JSHandle<JSTaggedValue> fromValue = JSSharedArray::FastGetPropertyByValue(thread, thisObjVal, k);
1661 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1662 JSSharedArray::FastSetPropertyByValue(thread, thisObjVal, k - 1, fromValue);
1663 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1666 JSTaggedValue::DeletePropertyOrThrow(thread, thisObjVal, toKey);
1667 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1672 JSHandle<JSTaggedValue> deleteKey(thread, JSTaggedValue(len - 1));
1673 JSTaggedValue::DeletePropertyOrThrow(thread, thisObjVal, deleteKey);
1675 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1678 JSHandle<JSTaggedValue> newLenHandle(thread, JSTaggedValue(len - 1));
1679 JSSharedArray::LengthSetter(thread, thisObjHandle, newLenHandle, true);
1681 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1692 JSThread *thread = argv->GetThread();
1693 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1698 auto error = ContainerError::BindError(thread, "The slice method cannot be bound.");
1699 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
1701 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
1702 [[maybe_unused]] ConcurrentApiScope<JSSharedArray> scope(thread, thisHandle);
1704 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1708 int64_t len = ArrayHelper::GetArrayLength(thread, thisObjVal);
1710 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1718 JSTaggedNumber argStartTemp = JSTaggedValue::ToInteger(thread, msg0);
1720 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1742 JSTaggedNumber argEndTemp = JSTaggedValue::ToInteger(thread, msg1);
1743 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1754 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1759 if (thisHandle->IsStableJSArray(thread) && !thisObjHandle->GetJSHClass()->HasConstructor()
1761 auto opResult = JSStableArray::Slice(thread, thisObjHandle, k, count);
1767 JSSharedArray::ArraySpeciesCreate(thread, thisObjHandle, JSTaggedNumber(static_cast<double>(count)));
1769 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1773 JSHandle<JSObject> newArrayHandle(thread, newArray);
1788 JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
1789 JSMutableHandle<JSTaggedValue> nKey(thread, JSTaggedValue::Undefined());
1792 bool exists = JSTaggedValue::HasProperty(thread, thisObjVal, key);
1793 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1796 JSHandle<JSTaggedValue> kValueHandle = JSSharedArray::FastGetPropertyByValue(thread, thisObjVal, key);
1797 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1798 JSObject::CreateDataPropertyOrThrow(thread, newArrayHandle, nKey, kValueHandle, SCheckMode::SKIP);
1799 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1806 JSHandle<JSTaggedValue> newLenHandle(thread, JSTaggedValue(n));
1807 JSSharedArray::LengthSetter(thread, newArrayHandle, newLenHandle, true);
1809 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1819 JSThread *thread = argv->GetThread();
1820 BUILTINS_API_TRACE(thread, SharedArray, Sort);
1821 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1826 THROW_TYPE_ERROR_AND_RETURN(thread, "Callable is false", JSTaggedValue::Exception());
1832 auto error = ContainerError::BindError(thread, "The sort method cannot be bound.");
1833 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
1835 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
1836 [[maybe_unused]] ConcurrentApiScope<JSSharedArray, ModType::WRITE> scope(thread, thisHandle);
1837 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1840 if (thisHandle->IsStableJSArray(thread) && callbackFnHandle->IsUndefined()) {
1841 JSStableArray::Sort(thread, thisObjHandle, callbackFnHandle);
1843 JSSharedArray::Sort(thread, JSHandle<JSTaggedValue>::Cast(thisObjHandle), callbackFnHandle);
1844 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1855 JSThread *thread = argv->GetThread();
1856 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1861 auto error = ContainerError::BindError(thread, "The splice method cannot be bound.");
1862 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
1864 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
1866 thread, thisHandle);
1868 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1871 int64_t len = ArrayHelper::GetArrayLength(thread, thisObjVal);
1873 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1882 JSTaggedNumber argStartTemp = JSTaggedValue::ToInteger(thread, msg0);
1884 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1910 JSTaggedNumber argDeleteCount = JSTaggedValue::ToInteger(thread, msg1);
1911 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1918 THROW_TYPE_ERROR_AND_RETURN(thread, "out of range.", JSTaggedValue::Exception());
1922 thread, thisObjHandle, JSTaggedNumber(static_cast<double>(actualDeleteCount)));
1923 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1924 JSHandle<JSObject> newArrayHandle(thread, newArray);
1925 if (thisHandle->IsStableJSArray(thread)) {
1937 JSMutableHandle<JSTaggedValue> fromKey(thread, JSTaggedValue::Undefined());
1938 JSMutableHandle<JSTaggedValue> toKey(thread, JSTaggedValue::Undefined());
1943 bool exists = JSTaggedValue::HasProperty(thread, thisObjVal, fromKey);
1944 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1946 JSHandle<JSTaggedValue> fromValue = JSSharedArray::FastGetPropertyByValue(thread, thisObjVal, fromKey);
1947 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1950 toKey.Update(JSTaggedValue::ToString(thread, toKey).GetTaggedValue());
1951 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1953 JSObject::CreateDataPropertyOrThrow(thread, newArrayHandle, toKey, fromValue);
1954 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1959 JSHandle<JSTaggedValue> deleteCountHandle(thread, JSTaggedValue(actualDeleteCount));
1960 JSSharedArray::LengthSetter(thread, newArrayHandle, deleteCountHandle, true);
1961 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1984 bool exists = JSTaggedValue::HasProperty(thread, thisObjVal, fromKey);
1985 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1987 JSHandle<JSTaggedValue> fromValue = JSSharedArray::FastGetPropertyByValue(thread, thisObjVal, fromKey);
1988 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1989 JSSharedArray::FastSetPropertyByValue(thread, thisObjVal, toKey, fromValue);
1990 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1992 JSTaggedValue::DeletePropertyOrThrow(thread, thisObjVal, toKey);
1993 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
1998 JSMutableHandle<JSTaggedValue> deleteKey(thread, JSTaggedValue::Undefined());
2001 JSTaggedValue::DeletePropertyOrThrow(thread, thisObjVal, deleteKey);
2002 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2026 bool exists = JSTaggedValue::HasProperty(thread, thisObjVal, fromKey);
2027 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2029 JSHandle<JSTaggedValue> fromValue = JSSharedArray::FastGetPropertyByValue(thread, thisObjVal, fromKey);
2030 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2031 JSSharedArray::FastSetPropertyByValue(thread, thisObjVal, toKey, fromValue);
2032 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2034 JSTaggedValue::DeletePropertyOrThrow(thread, thisObjVal, toKey);
2035 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2043 JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
2047 auto error = ContainerError::ParamError(thread, "Parameter error.Only accept sendable value.");
2048 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
2051 JSSharedArray::FastSetPropertyByValue(thread, thisObjVal, key, itemValue);
2052 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2057 JSHandle<JSTaggedValue> newLenHandle(thread, JSTaggedValue(newLen));
2058 JSSharedArray::LengthSetter(thread, thisObjHandle, newLenHandle, true);
2060 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2070 JSThread *thread = argv->GetThread();
2071 [[maybe_unused]] EcmaHandleScope handleScope(thread);
2072 auto ecmaVm = thread->GetEcmaVM();
2077 auto error = ContainerError::BindError(thread, "The toString method cannot be bound.");
2078 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
2080 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
2081 [[maybe_unused]] ConcurrentApiScope<JSSharedArray> scope(thread, thisHandle);
2083 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2087 JSHandle<JSTaggedValue> joinKey = thread->GlobalConstants()->GetHandledJoinString();
2088 JSHandle<JSTaggedValue> callbackFnHandle = JSTaggedValue::GetProperty(thread, thisObjVal, joinKey).GetValue();
2091 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2097 JSHandle<JSTaggedValue> toStringKey = thread->GlobalConstants()->GetHandledToStringString();
2098 callbackFnHandle = JSTaggedValue::GetProperty(thread, objectPrototype, toStringKey).GetValue();
2099 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2102 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
2104 EcmaInterpreter::NewRuntimeCallInfo(thread, callbackFnHandle, thisObjVal, undefined, argsLength);
2105 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2116 JSThread *thread = argv->GetThread();
2117 [[maybe_unused]] EcmaHandleScope handleScope(thread);
2125 auto error = ContainerError::BindError(thread, "The unshift method cannot be bound.");
2126 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
2128 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
2129 [[maybe_unused]] ConcurrentApiScope<JSSharedArray, ModType::WRITE> scope(thread, thisHandle);
2131 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2135 int64_t len = ArrayHelper::GetArrayLength(thread, thisObjVal);
2137 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2158 THROW_TYPE_ERROR_AND_RETURN(thread, "out of range.", JSTaggedValue::Exception());
2160 JSMutableHandle<JSTaggedValue> fromKey(thread, JSTaggedValue::Undefined());
2161 JSMutableHandle<JSTaggedValue> toKey(thread, JSTaggedValue::Undefined());
2166 bool exists = JSTaggedValue::HasProperty(thread, thisObjVal, fromKey);
2167 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2169 JSHandle<JSTaggedValue> fromValue = JSSharedArray::FastGetPropertyByValue(thread, thisObjVal, fromKey);
2170 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2171 JSSharedArray::FastSetPropertyByValue(thread, thisObjVal, toKey, fromValue);
2172 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2174 JSTaggedValue::DeletePropertyOrThrow(thread, thisObjVal, toKey);
2175 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2192 auto error = ContainerError::ParamError(thread, "Parameter error.Only accept sendable value.");
2193 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
2195 JSSharedArray::FastSetPropertyByValue(thread, thisObjVal, toKey, toValue);
2196 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2203 JSHandle<JSTaggedValue> newLenHandle(thread, JSTaggedValue(newLen));
2204 JSSharedArray::LengthSetter(thread, thisObjHandle, newLenHandle, true);
2206 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2217 JSThread *thread = argv->GetThread();
2218 [[maybe_unused]] EcmaHandleScope handleScope(thread);
2221 auto error = ContainerError::BindError(thread, "The values method cannot be bound.");
2222 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
2224 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
2227 JSHandle<JSObject> self = JSTaggedValue::ToObject(thread, GetThis(argv));
2228 [[maybe_unused]] ConcurrentApiScope<JSSharedArray> scope(thread, thisHandle);
2229 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2237 JSThread *thread = argv->GetThread();
2238 BUILTINS_API_TRACE(thread, SharedArray, Unscopables);
2239 [[maybe_unused]] EcmaHandleScope handleScope(thread);
2240 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
2241 const GlobalEnvConstants *globalConst = thread->GlobalConstants();
2245 JSHandle<JSTaggedValue> trueVal(thread, JSTaggedValue::True());
2248 JSObject::CreateDataProperty(thread, unscopableList, atKey, trueVal);
2251 JSObject::CreateDataProperty(thread, unscopableList, copyWithKey, trueVal);
2254 JSObject::CreateDataProperty(thread, unscopableList, entriesKey, trueVal);
2257 JSObject::CreateDataProperty(thread, unscopableList, fillKey, trueVal);
2260 JSObject::CreateDataProperty(thread, unscopableList, findKey, trueVal);
2263 JSObject::CreateDataProperty(thread, unscopableList, findIndexKey, trueVal);
2266 JSObject::CreateDataProperty(thread, unscopableList, findLastKey, trueVal);
2269 JSObject::CreateDataProperty(thread, unscopableList, findLastIndexKey, trueVal);
2272 JSObject::CreateDataProperty(thread, unscopableList, flatKey, trueVal);
2275 JSObject::CreateDataProperty(thread, unscopableList, flatMapKey, trueVal);
2278 JSObject::CreateDataProperty(thread, unscopableList, includesKey, trueVal);
2281 JSObject::CreateDataProperty(thread, unscopableList, keysKey, trueVal);
2284 JSObject::CreateDataProperty(thread, unscopableList, valuesKey, trueVal);
2287 JSObject::CreateDataProperty(thread, unscopableList, toReversedKey, trueVal);
2290 JSObject::CreateDataProperty(thread, unscopableList, toSortedKey, trueVal);
2293 JSObject::CreateDataProperty(thread, unscopableList, toSplicedKey, trueVal);
2302 JSThread *thread = argv->GetThread();
2303 [[maybe_unused]] EcmaHandleScope handleScope(thread);
2307 auto error = ContainerError::BindError(thread, "The includes method cannot be bound.");
2308 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
2310 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
2311 [[maybe_unused]] ConcurrentApiScope<JSSharedArray> scope(thread, thisHandle);
2312 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2319 int64_t len = ArrayHelper::GetLength(thread, thisObjVal);
2320 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2330 JSTaggedNumber fromIndexTemp = JSTaggedValue::ToNumber(thread, msg1);
2331 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2353 JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
2354 JSMutableHandle<JSTaggedValue> kValueHandle(thread, JSTaggedValue::Undefined());
2357 JSHandle<JSTaggedValue> handledFrom(thread, JSTaggedValue(from));
2358 fromStr = JSTaggedValue::ToString(thread, handledFrom);
2359 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2361 kValueHandle.Update(JSSharedArray::FastGetPropertyByValue(thread, thisObjVal, key).GetTaggedValue());
2362 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2377 JSThread *thread = argv->GetThread();
2378 [[maybe_unused]] EcmaHandleScope handleScope(thread);
2383 auto error = ContainerError::BindError(thread, "The at method cannot be bound.");
2384 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
2386 [[maybe_unused]] ConcurrentApiScope<JSSharedArray> scope(thread, thisHandle);
2387 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2388 if (thisHandle->IsStableJSArray(thread)) {
2392 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
2394 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2398 int64_t len = ArrayHelper::GetLength(thread, thisObjVal);
2400 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2403 JSTaggedNumber index = JSTaggedValue::ToInteger(thread, GetCallArg(argv, 0));
2405 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2425 JSHandle<JSTaggedValue> element = JSSharedArray::FastGetPropertyByValue(thread, thisObjVal, k);
2426 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2435 JSThread *thread = argv->GetThread();
2436 [[maybe_unused]] EcmaHandleScope handleScope(thread);
2438 auto error = ContainerError::ParamError(thread, "Parameter error.Not enough parameter.");
2439 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
2443 auto error = ContainerError::BindError(thread, "The ShrinkTo method cannot be bound.");
2444 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
2446 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
2447 [[maybe_unused]] ConcurrentApiScope<JSSharedArray, ModType::WRITE> scope(thread, thisHandle);
2450 auto error = ContainerError::ParamError(thread, "Parameter error.Invalid array length.");
2451 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
2453 auto newLength = JSTaggedValue::ToUint32(thread, newLengthValue);
2454 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2456 auto error = ContainerError::ParamError(thread, "Parameter error.Invalid array length.");
2457 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
2459 int64_t len = ArrayHelper::GetLength(thread, thisHandle);
2460 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2464 JSSharedArray::LengthSetter(thread, thisObjHandle, newLengthValue, true);
2465 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2474 JSThread *thread = argv->GetThread();
2475 [[maybe_unused]] EcmaHandleScope handleScope(thread);
2477 auto error = ContainerError::ParamError(thread, "Parameter error.Not enough parameters.");
2478 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
2482 auto error = ContainerError::BindError(thread, "The ExtendTo method cannot be bound.");
2483 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
2485 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
2486 [[maybe_unused]] ConcurrentApiScope<JSSharedArray, ModType::WRITE> scope(thread, thisHandle);
2489 auto error = ContainerError::ParamError(thread, "Parameter error.Invalid array length.");
2490 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
2492 auto newLength = JSTaggedValue::ToUint32(thread, newLengthValue);
2493 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2495 auto error = ContainerError::ParamError(thread, "Parameter error.Invalid array length.");
2496 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
2499 int64_t length = ArrayHelper::GetLength(thread, thisHandle);
2500 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2507 auto error = ContainerError::ParamError(thread, "Parameter error.Only accept sendable value.");
2508 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
2510 JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
2513 JSObject::CreateDataPropertyOrThrow(thread, thisObjHandle, key, initValue, SCheckMode::SKIP);
2516 JSSharedArray::LengthSetter(thread, thisObjHandle, key, true);
2517 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2521 JSTaggedValue BuiltinsSharedArray::LastIndexOfSlowPath(EcmaRuntimeCallInfo *argv, JSThread *thread,
2525 JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
2527 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2530 int64_t length = ArrayHelper::GetLength(thread, thisObjVal);
2532 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2538 int64_t fromIndex = ArrayHelper::GetLastStartIndexFromArgs(thread, argv, 1, length);
2539 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2540 return LastIndexOfSlowPath(argv, thread, thisObjVal, fromIndex);
2543 JSTaggedValue BuiltinsSharedArray::LastIndexOfSlowPath(EcmaRuntimeCallInfo *argv, JSThread *thread,
2549 JSMutableHandle<JSTaggedValue> keyHandle(thread, JSTaggedValue::Undefined());
2554 bool found = ArrayHelper::ElementIsStrictEqualTo(thread, thisObjVal, keyHandle, target);
2555 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2568 JSThread *thread = argv->GetThread();
2569 BUILTINS_API_TRACE(thread, SharedArray, LastIndexOf);
2570 [[maybe_unused]] EcmaHandleScope handleScope(thread);
2574 auto error = ContainerError::BindError(thread, "The lastIndexOf method cannot be bound.");
2575 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
2577 [[maybe_unused]] ConcurrentApiScope<JSSharedArray> scope(thread, thisHandle);
2578 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
2580 if (thisHandle->IsStableJSArray(thread)) {
2581 auto error = ContainerError::BindError(thread, "The lastIndexOf method not support stable array.");
2582 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
2584 return LastIndexOfSlowPath(argv, thread, thisHandle);