| /arkcompiler/ets_runtime/ecmascript/tests/ |
| D | weak_ref_old_gc_test.cpp | 69 JSHandle<TaggedArray> array = thread->GetEcmaVM()->GetFactory()->NewTaggedArray(2); in ArrayTestCreate() local 70 return *array; in ArrayTestCreate() 76 auto array = vm->GetFactory()->NewTaggedArray(2, JSTaggedValue::Undefined(), true); in HWTEST_F_L0() local 78 array->Set(thread, 0, newObj1.GetTaggedValue()); in HWTEST_F_L0() 83 array->Set(thread, 1, value); in HWTEST_F_L0() 84 EXPECT_EQ(newObj1.GetTaggedValue(), array->Get(0)); in HWTEST_F_L0() 85 EXPECT_EQ(value, array->Get(1)); in HWTEST_F_L0() 87 EXPECT_EQ(newObj1.GetTaggedValue(), array->Get(0)); in HWTEST_F_L0() 88 EXPECT_EQ(JSTaggedValue::Undefined(), array->Get(1)); in HWTEST_F_L0() 94 JSHandle<TaggedArray> array = ecmaVM->GetFactory()->NewTaggedArray(2); in HWTEST_F_L0() local [all …]
|
| D | weak_ref_semi_gc_test.cpp | 68 JSHandle<TaggedArray> array = thread->GetEcmaVM()->GetFactory()->NewTaggedArray(2); in ArrayTestCreate() local 69 return *array; in ArrayTestCreate() 75 JSHandle<TaggedArray> array = ecmaVM->GetFactory()->NewTaggedArray(2); in HWTEST_F_L0() local 76 EXPECT_TRUE(*array != nullptr); in HWTEST_F_L0() 78 array->Set(thread, 0, newObj1.GetTaggedValue()); in HWTEST_F_L0() 83 array->Set(thread, 1, value); in HWTEST_F_L0() 84 EXPECT_EQ(newObj1.GetTaggedValue(), array->Get(0)); in HWTEST_F_L0() 85 EXPECT_EQ(value, array->Get(1)); in HWTEST_F_L0() 87 EXPECT_EQ(newObj1.GetTaggedValue(), array->Get(0)); in HWTEST_F_L0() 88 EXPECT_EQ(JSTaggedValue::Undefined(), array->Get(1)); in HWTEST_F_L0() [all …]
|
| D | js_api_plain_array_test.cpp | 107 JSHandle<JSAPIPlainArray> array(thread, CreatePlainArray()); in HWTEST_F_L0() local 116 JSAPIPlainArray::Add(thread, array, key, value); in HWTEST_F_L0() 125 JSAPIPlainArray::Add(thread, array, key, value); in HWTEST_F_L0() 127 EXPECT_EQ(array->GetSize(), static_cast<int>(NODE_NUMBERS)); in HWTEST_F_L0() 136 JSTaggedValue gvalue = array->GetKeyAt(i); in HWTEST_F_L0() 139 EXPECT_EQ(array->GetKeyAt(-1), JSTaggedValue::Undefined()); in HWTEST_F_L0() 140 EXPECT_EQ(array->GetKeyAt(NODE_NUMBERS), JSTaggedValue::Undefined()); in HWTEST_F_L0() 142 array->Clear(thread); in HWTEST_F_L0() 143 EXPECT_EQ(array->GetSize(), 0); // 0 means the value in HWTEST_F_L0() 154 JSHandle<JSAPIPlainArray> array(thread, CreatePlainArray()); in HWTEST_F_L0() local [all …]
|
| /arkcompiler/runtime_core/static_core/plugins/ets/tests/mock/ |
| D | array_native_test.cpp | 74 ets_booleanArray array = env_->NewBooleanArray(src.size()); in TEST_F() local 75 ASSERT_NE(array, nullptr); in TEST_F() 77 ets_size length = env_->GetArrayLength(array); in TEST_F() 80 env_->SetBooleanArrayRegion(array, 0, src.size(), src.data()); in TEST_F() 83 ets_boolean *buf = env_->PinBooleanArray(array); in TEST_F() 89 env_->GetBooleanArrayRegion(array, 0, src.size(), res2.data()); in TEST_F() 92 env_->UnpinBooleanArray(array); in TEST_F() 97 env_->GetBooleanArrayRegion(array, 0, length, vec.data()); in TEST_F() 104 env_->GetBooleanArrayRegion(array, half, length - half, vec.data()); in TEST_F() 113 ets_byteArray array = env_->NewByteArray(src.size()); in TEST_F() local [all …]
|
| /arkcompiler/ets_runtime/test/moduletest/arraysplice/ |
| D | arraysplice.js | 33 var array = new Array(10); 34 var spliced = array.splice(1, 1); 35 for (let i = 0; i < array.length; ++i) { 36 print(i in array) 44 array = []; 47 let bad_start = { valueOf: function () { array.push(2 * i); return -1; } }; 48 let bad_count = { valueOf: function () { array.push(2 * i + 1); return 1; } }; 49 spliced = array.splice(bad_start, bad_count); 50 print("array.length", array.length); 53 let array = [1, 2, 3, 4]; variable [all …]
|
| /arkcompiler/runtime_core/static_core/runtime/coretypes/ |
| D | array.cpp | 51 auto *array = AllocateArray(arrayClass, elemSize, length, spaceType); in Create() local 52 if (UNLIKELY(array == nullptr)) { in Create() 59 array->SetLength(length); in Create() 60 std::copy_n(data, length * elemSize, reinterpret_cast<uint8_t *>(array->GetData())); in Create() 65 return array; in Create() 72 auto *array = AllocateArray(arrayClass, elemSize, length, spaceType); in Create() local 73 if (array == nullptr) { in Create() 78 array->SetLength(length); in Create() 83 return array; in Create() 91 auto *array = AllocateArray(arrayClass, elemSize, length, spaceType); in Create() local [all …]
|
| /arkcompiler/ets_runtime/test/moduletest/arrayfindlast/ |
| D | arrayfindlast.js | 25 result = arr.findLast((element, index, array) => { 26 array.length = 5; 35 result = arr.findLastIndex((element, index, array) => { 36 if (array.length == 5) { 37 array.push(100); 42 result = arr.findLastIndex((element, index, array) => { 48 result = arr2.findLast((element, index, array) => { 53 result = arr2.findLastIndex((element, index, array) => { 58 result = arr2.findLastIndex((element, index, array) => { 59 array[5] = 100;
|
| /arkcompiler/ets_runtime/ecmascript/ic/ |
| D | proto_change_details.cpp | 20 …<ChangeListener> ChangeListener::Add(const JSThread *thread, const JSHandle<ChangeListener> &array, in Add() argument 24 if (!array->Full()) { in Add() 26 uint32_t arrayIndex = array->PushBack(thread, weakValue); in Add() 31 return array; in Add() 37 uint32_t holeIndex = CheckHole(array); in Add() 40 array->Set(thread, holeIndex, weakValue); in Add() 44 return array; in Add() 47 …JSHandle<WeakVector> newArray = WeakVector::Grow(thread, JSHandle<WeakVector>(array), array->GetCa… in Add() 57 uint32_t ChangeListener::CheckHole(const JSHandle<ChangeListener> &array) in CheckHole() argument 59 for (uint32_t i = 0; i < array->GetEnd(); i++) { in CheckHole() [all …]
|
| /arkcompiler/runtime_core/static_core/plugins/ets/tests/runtime/types/ |
| D | ets_array_test.cpp | 76 auto *array = EtsPrimitiveArray<ClassType, ETS_CLASS_ROOT>::Create(arrayLength); in TestEtsPrimitiveArray() local 77 ASSERT_NE(array, nullptr); in TestEtsPrimitiveArray() 79 ASSERT_EQ(array->GetLength(), arrayLength); in TestEtsPrimitiveArray() 80 ASSERT_EQ(array->GetElementSize(), sizeof(ClassType)); in TestEtsPrimitiveArray() 81 ASSERT_EQ(array->IsPrimitive(), true); in TestEtsPrimitiveArray() 84 array->Set(idx, element); in TestEtsPrimitiveArray() 85 ASSERT_EQ(array->Get(idx), element); in TestEtsPrimitiveArray() 108 auto *array = EtsObjectArray::Create(klass, arrayLength); in TestEtsObjectArray() local 109 ASSERT_NE(array, nullptr); in TestEtsObjectArray() 111 ASSERT_EQ(array->GetLength(), arrayLength); in TestEtsObjectArray() [all …]
|
| /arkcompiler/ets_runtime/test/aottest/stobjbyindex/ |
| D | stobjbyindex.ts | 19 var array = [100, "hello"]; 20 print(array[0]); 21 print(array[1]); 22 array[0] = "helloworld"; 23 array[1] = 200; 24 print(array[0]); 25 print(array[1]);
|
| /arkcompiler/ets_runtime/ecmascript/ic/tests/ |
| D | ic_invoke_test.cpp | 57 JSHandle<TaggedArray> array = factory->NewTaggedArray(10); in HWTEST_F_L0() local 60 …thread, static_cast<ProfileTypeInfo *>(*array), slotId, func.GetTaggedValue(), JSTaggedValue(123)); in HWTEST_F_L0() 62 ASSERT_EQ(array->Get(thread, slotId), func.GetTaggedValue()); in HWTEST_F_L0() 63 ASSERT_EQ(array->Get(thread, slotId + 1), JSTaggedValue(123)); in HWTEST_F_L0() 86 JSHandle<TaggedArray> array = factory->NewTaggedArray(10); in HWTEST_F_L0() local 89 …thread, static_cast<ProfileTypeInfo *>(*array), slotId, 3, array1.GetTaggedValue(), array2.GetTagg… in HWTEST_F_L0() 91 JSTaggedValue slot = array->Get(thread, slotId); in HWTEST_F_L0() 100 ASSERT_EQ(array->Get(thread, slotId + 1), JSTaggedValue::Hole()); in HWTEST_F_L0() 107 JSHandle<TaggedArray> array = factory->NewTaggedArray(6); in HWTEST_F_L0() local 113 array->Set(thread, 0, func0.GetTaggedValue()); in HWTEST_F_L0() [all …]
|
| /arkcompiler/toolchain/tooling/base/ |
| D | pt_returns.cpp | 33 std::unique_ptr<PtJson> array = PtJson::CreateArray(); in ToJson() local 38 array->Push(location); in ToJson() 40 result->Add("locations", array); in ToJson() 49 std::unique_ptr<PtJson> array = PtJson::CreateArray(); in ToJson() local 54 array->Push(location); in ToJson() 56 result->Add("locations", array); in ToJson() 79 std::unique_ptr<PtJson> array = PtJson::CreateArray(); in ToJson() local 84 array->Push(location); in ToJson() 86 result->Add("locations", array); in ToJson() 107 std::unique_ptr<PtJson> array = PtJson::CreateArray(); in ToJson() local [all …]
|
| /arkcompiler/ets_runtime/ecmascript/ts_types/ |
| D | lib_ark_builtins.d.ts | 497 every(predicate: (value: any, index: number, array: any[]) => unknown, thisArg?: any): boolean; 501 filter(predicate: (value: any, index: number, array: any[]) => unknown, thisArg?: any): any[]; 507 forEach(callbackfn: (value: any, index: number, array: any[]) => void, thisArg?: any): void; 517 map(callbackfn: (value: any, index: number, array: any[]) => any, thisArg?: any): any[]; 523 …reduce(callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => … 525 …reduceRight(callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]… 533 some(predicate: (value: any, index: number, array: any[]) => unknown, thisArg?: any): boolean; 555 callback: (this: any, value: any, index: number, array: any[]) => any, 746 constructor(array: ArrayLike<number> | ArrayBufferLike): Uint8ClampedArray; 764 …every(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: an… [all …]
|
| /arkcompiler/ets_frontend/ets2panda/linter/test/ |
| D | var_declarations.ts | 28 var array = [1, 2, 3, 4]; 29 for (var i = 0; i < array.length; i++) console.log(array[i]); 31 for (var j in array) { 33 console.log(array[j]); 37 for (var e of array) console.log(e);
|
| /arkcompiler/ets_frontend/ets2panda/linter-4.2/test/ |
| D | var_declarations.ts | 28 var array = [1, 2, 3, 4]; 29 for (var i = 0; i < array.length; i++) console.log(array[i]); 31 for (var j in array) { 33 console.log(array[j]); 37 for (var e of array) console.log(e);
|
| /arkcompiler/ets_frontend/ets2panda/compiler/base/ |
| D | destructuring.cpp | 34 VReg array = pg->AllocReg(); in GenRestElement() local 47 pg->StoreAccumulator(restElement, array); in GenRestElement() 56 pg->StoreObjByValue(restElement, array, index); in GenRestElement() 66 pg->LoadAccumulator(restElement, array); in GenRestElement() 71 static void GenArray(PandaGen *pg, const ir::ArrayExpression *array) in GenArray() argument 73 DestructuringIterator iterator(pg, array); in GenArray() 75 if (array->Elements().empty()) { in GenArray() 82 pg->SetLabel(array, labelSet.TryBegin()); in GenArray() 84 for (const auto *element : array->Elements()) { in GenArray() 88 GenRestElement(pg, element->AsRestElement(), iterator, array->IsDeclaration()); in GenArray() [all …]
|
| /arkcompiler/runtime_core/static_core/runtime/tests/ |
| D | stack_like_allocator_test.cpp | 91 std::array<void *, ITERATIONS + 1> array {nullptr}; in TEST_F() local 93 array[i] = alloc.Alloc(FRAME_SIZE); in TEST_F() 94 ASSERT_NE(array[i], nullptr); in TEST_F() 95 *(static_cast<uint64_t *>(array[i])) = i; in TEST_F() 98 ASSERT_EQ(*(static_cast<uint64_t *>(array[i])), i); in TEST_F() 99 alloc.Free(array[i]); in TEST_F() 107 std::array<void *, MAX_SIZE + 1> array {nullptr}; in AlignmentTest() local 109 array[i] = alloc.Alloc(i * GetAlignmentInBytes(ALIGNMENT)); in AlignmentTest() 110 if (array[i] == nullptr) { in AlignmentTest() 113 ASSERT_NE(array[i], nullptr); in AlignmentTest() [all …]
|
| /arkcompiler/ets_runtime/test/moduletest/typedarrayfindlast/ |
| D | typedarrayfindlast.js | 55 let result1 = obj.findLast((element, index, array) => { 59 result1 = obj.findLast((element, index, array) => { 63 result1 = obj.findLastIndex((element, index, array) => { 65 array[3] = 100; 70 result1 = obj.findLastIndex((element, index, array) => { 85 let result1 = obj.findLast((element, index, array) => { 89 result1 = obj.findLast((element, index, array) => { 93 result1 = obj.findLastIndex((element, index, array) => { 95 array[3] = 100n; 100 result1 = obj.findLastIndex((element, index, array) => {
|
| /arkcompiler/ets_runtime/ecmascript/compiler/ |
| D | typed_array_stub_builder.h | 32 GateRef FastGetPropertyByIndex(GateRef glue, GateRef array, GateRef index, GateRef jsType); 33 GateRef FastCopyElementToArray(GateRef glue, GateRef typedArray, GateRef array); 34 GateRef LoadTypedArrayElement(GateRef glue, GateRef array, GateRef key, GateRef jsType); 35 …GateRef StoreTypedArrayElement(GateRef glue, GateRef array, GateRef index, GateRef value, GateRef … 36 GateRef CheckTypedArrayIndexInRange(GateRef array, GateRef index); 42 GateRef GetViewedArrayBuffer(GateRef array) in GetViewedArrayBuffer() argument 45 return Load(VariableType::JS_ANY(), array, offset); in GetViewedArrayBuffer() 48 GateRef GetArrayLength(GateRef array) in GetArrayLength() argument 51 return Load(VariableType::INT32(), array, offset); in GetArrayLength() 54 GateRef GetByteOffset(GateRef array) in GetByteOffset() argument [all …]
|
| D | call_signature.cpp | 45 std::array<VariableType, 3> params = { \ 155 std::array<VariableType, 3> params = { in DEF_CALL_SIGNATURE() 173 std::array<VariableType, 2> params = { \ 216 std::array<VariableType, 2> params = { in DEF_CALL_SIGNATURE() 230 std::array<VariableType, 6> params = { in DEF_CALL_SIGNATURE() 249 std::array<VariableType, 4> params = { in DEF_CALL_SIGNATURE() 266 std::array<VariableType, 4> params = { in DEF_CALL_SIGNATURE() 283 std::array<VariableType, 6> params = { in DEF_CALL_SIGNATURE() 302 std::array<VariableType, 4> params = { in DEF_CALL_SIGNATURE() 319 std::array<VariableType, 4> params = { in DEF_CALL_SIGNATURE() [all …]
|
| /arkcompiler/ets_runtime/test/aottest/stobjbyvalue/ |
| D | stobjbyvalue.ts | 23 var array = [100, "hello"]; 24 print(array[first]); 25 print(array[second]); 26 array[first] = "helloworld"; 27 array[second] = 200; 28 print(array[first]); 29 print(array[second]);
|
| /arkcompiler/runtime_core/static_core/plugins/ets/tests/interop_js/tests/escompat/array_js_suites/ |
| D | test_from_async.js | 33 Array.fromAsync(arr).then((array) => ASSERT_EQ(array.at(0), arr.at(0))); 34 Array.fromAsync(arr, fnMap).then((array) => ASSERT_EQ(array.at(0), 'String')); 35 Array.fromAsync(arr, fnMap1).then((array) => ASSERT_EQ(array.at(0), 'String1'));
|
| /arkcompiler/runtime_core/static_core/plugins/ets/tests/stdlib-templates/escompat/ |
| D | escompat_Array.ets | 45 …res += check((): int => { return testCreateFrom()}, "Test Create Array<Object> object from array"); 46 …nt => { return testCreateFrom2()}, "Test Create Array<Object> object from array with given functio… 58 …ures += check((): int => { return testJoinEmpty()}, "Test join(0) method with empty source array"); 92 …ures += check((): int => { return testIndexOfFromEmpty()}, "Test indexOf method with empty array"); 95 failures += check((): int => { return testFlatFlat()}, "Test flat non empty flat array"); 96 …failures += check((): int => { return testFlatNonFlat1()}, "Test flat non empty non flat array 1"); 97 …failures += check((): int => { return testFlatNonFlat2()}, "Test flat non empty non flat array 2"); 104 failures += check((): int => { return array{{.ci.name}}()}, "Test262: {{.ci.name}}"); 115 let array: Array<Object> = new Array<Object>(source); 116 let length: int = array.length(); [all …]
|
| /arkcompiler/ets_runtime/ecmascript/builtins/tests/ |
| D | builtins_atomics_test.cpp | 64 JSTypedArray *CreateTypedArray(JSThread *thread, const JSHandle<TaggedArray> &array) in CreateTypedArray() argument 69 JSHandle<JSTaggedValue> jsarray(JSArray::CreateArrayFromList(thread, array)); in CreateTypedArray() 87 JSTypedArray *CreateTypedArray(JSThread *thread, const JSHandle<TaggedArray> &array, DataViewType t… in CreateTypedArray() argument 91 JSHandle<JSTaggedValue> jsarray(JSArray::CreateArrayFromList(thread, array)); in CreateTypedArray() 246 [[maybe_unused]] JSHandle<TaggedArray> array(factory->NewTaggedArray(3)); in HWTEST_F_L0() local 247 array->Set(thread, 0, JSTaggedValue(7)); in HWTEST_F_L0() 248 array->Set(thread, 1, JSTaggedValue(8)); in HWTEST_F_L0() 249 array->Set(thread, 2, JSTaggedValue(9)); in HWTEST_F_L0() 251 …JSHandle<JSTaggedValue> obj = JSHandle<JSTaggedValue>(thread, CreateTypedArray(thread, array, Data… in HWTEST_F_L0() 269 [[maybe_unused]] JSHandle<TaggedArray> array(factory->NewTaggedArray(10)); in HWTEST_F_L0() local [all …]
|
| /arkcompiler/ets_runtime/test/aottest/optimization/ |
| D | optimization.ts | 47 function binarySearch(array: number[], target: number): number { 49 let high : number = array.length - 1; 53 if (array[mid] == target) { 55 } else if (array[mid] < target) { 57 } else if (array[mid] > target) { 64 let array: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; variable 65 let ret = binarySearch(array, 3); 77 print(foo(array));
|