mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2025-02-17 10:18:13 +00:00
Remove leading spaces at empty line
Issue: #I67PO6 Signed-off-by: Gymee <yumeijie@huawei.com>
This commit is contained in:
parent
171ba03d31
commit
0500527db8
@ -68,7 +68,7 @@ JSTaggedValue AsyncGeneratorHelper::Return(JSThread *thread, const JSHandle<Gene
|
||||
{
|
||||
JSHandle<JSTaggedValue> val(thread, completionRecord->GetValue());
|
||||
JSHandle<JSAsyncGeneratorObject> genObject(thread, genContext->GetGeneratorObject());
|
||||
|
||||
|
||||
genObject->SetResumeResult(thread, val);
|
||||
if (genObject->IsSuspendYield() || genObject->IsExecuting()) {
|
||||
genObject->SetAsyncGeneratorState(JSAsyncGeneratorState::COMPLETED);
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
|
||||
private:
|
||||
static std::string DecodeFunctionName(const std::string &name);
|
||||
|
||||
|
||||
static JSHandle<JSTaggedValue> GetErrorJSFunction(JSThread *thread);
|
||||
|
||||
static JSHandle<EcmaString> BuildEcmaStackTrace(JSThread *thread);
|
||||
|
@ -81,7 +81,7 @@ HWTEST_F_L0(BitHelperTest, CountLeadingZeros_CountTrailingZeros)
|
||||
EXPECT_EQ(CountLeadingZeros<uint32_t>(uint32MinValue), 32U);
|
||||
EXPECT_EQ(CountTrailingZeros<uint32_t>(uint32MaxValue), 0U);
|
||||
EXPECT_EQ(CountTrailingZeros<uint32_t>(uint32MinValue), 32U);
|
||||
|
||||
|
||||
uint64_t uint64MaxValue = std::numeric_limits<uint64_t>::max();
|
||||
uint64_t uint64MinValue = std::numeric_limits<uint64_t>::min();
|
||||
EXPECT_EQ(CountLeadingZeros<uint64_t>(uint64MaxValue), 0U);
|
||||
|
@ -100,7 +100,7 @@ HWTEST_F_L0(JsonStringifierTest, Stringify_001)
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> handleObj = JSHandle<JSTaggedValue>(thread, CreateBaseJSObject(thread, "z"));
|
||||
JSHandle<JSFunction> handleFunc1 = factory->NewJSFunction(env, reinterpret_cast<void *>(TestForStringfy1));
|
||||
JSHandle<JSFunction> handleFunc2 = factory->NewJSFunction(env, reinterpret_cast<void *>(TestForStringfy2));
|
||||
|
@ -192,7 +192,7 @@ private:
|
||||
void InitializeAsyncFunction(const JSHandle<GlobalEnv> &env, const JSHandle<JSHClass> &objFuncClass) const;
|
||||
|
||||
void InitializeGeneratorFunction(const JSHandle<GlobalEnv> &env, const JSHandle<JSHClass> &objFuncClass) const;
|
||||
|
||||
|
||||
void InitializeAsyncGeneratorFunction(const JSHandle<GlobalEnv> &env,
|
||||
const JSHandle<JSHClass> &objFuncClass) const;
|
||||
|
||||
|
@ -31,7 +31,7 @@ JSTaggedValue BuiltinsAsyncGenerator::AsyncGeneratorFunctionConstructor(EcmaRunt
|
||||
|
||||
// ecma 27.6.1.2 AsyncGenerator.prototype.next
|
||||
JSTaggedValue BuiltinsAsyncGenerator::AsyncGeneratorPrototypeNext(EcmaRuntimeCallInfo *argv)
|
||||
{
|
||||
{
|
||||
JSThread *thread = argv->GetThread();
|
||||
BUILTINS_API_TRACE(thread, AsyncGenerator, PrototypeNext);
|
||||
// 1.Let g be the this value.
|
||||
|
@ -76,7 +76,7 @@ JSTaggedValue BuiltinsCjsModule::Require(EcmaRuntimeCallInfo *msg)
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||
return JSTaggedValue::Hole();
|
||||
}
|
||||
|
||||
|
||||
JSTaggedValue BuiltinsCjsModule::GetExportsForCircularRequire(EcmaRuntimeCallInfo *msg)
|
||||
{
|
||||
ASSERT(msg);
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
static JSTaggedValue CjsModuleConstructor(EcmaRuntimeCallInfo *argv);
|
||||
|
||||
static JSTaggedValue Compiler(EcmaRuntimeCallInfo *msg);
|
||||
|
||||
|
||||
static JSTaggedValue Load(EcmaRuntimeCallInfo *msg);
|
||||
|
||||
static JSTaggedValue Require(EcmaRuntimeCallInfo *msg);
|
||||
|
@ -431,7 +431,7 @@ JSTaggedValue BuiltinsNumber::ValueOf(EcmaRuntimeCallInfo *argv)
|
||||
BUILTINS_API_TRACE(thread, Number, ValueOf);
|
||||
// 1. Let x be ? thisNumberValue(this value).
|
||||
JSTaggedValue x = ThisNumberValue(thread, argv);
|
||||
|
||||
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
return x;
|
||||
}
|
||||
|
@ -909,7 +909,7 @@ JSTaggedValue BuiltinsRegExp::Replace(EcmaRuntimeCallInfo *argv)
|
||||
// v. Let n be n+1
|
||||
++index;
|
||||
}
|
||||
|
||||
|
||||
// j. Let namedCaptures be ? Get(result, "groups").
|
||||
JSHandle<JSTaggedValue> groupsKey = globalConst->GetHandledGroupsString();
|
||||
JSTaggedValue named =
|
||||
|
@ -644,7 +644,7 @@ JSTaggedValue BuiltinsString::MatchAll(EcmaRuntimeCallInfo *argv)
|
||||
JSTaggedValue::Exception());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (regexp->IsECMAObject()) {
|
||||
// c. c. Let matcher be ? GetMethod(regexp, @@matchAll).
|
||||
// d. d. If matcher is not undefined, then
|
||||
@ -964,7 +964,7 @@ JSTaggedValue BuiltinsString::ReplaceAll(EcmaRuntimeCallInfo *argv)
|
||||
replaceTag = JSHandle<JSTaggedValue>(JSTaggedValue::ToString(thread, replaceTag));
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
}
|
||||
|
||||
|
||||
// 7. Let searchLength be the length of searchString.
|
||||
// 8. Let advanceBy be max(1, searchLength).
|
||||
int32_t searchLength = static_cast<int32_t>(EcmaStringAccessor(searchString).GetLength());
|
||||
@ -1021,7 +1021,7 @@ JSTaggedValue BuiltinsString::ReplaceAll(EcmaRuntimeCallInfo *argv)
|
||||
endOfLastMatch = pos + searchLength;
|
||||
pos = EcmaStringAccessor::IndexOf(ecmaVm, thisString, searchString, pos + advanceBy);
|
||||
}
|
||||
|
||||
|
||||
if (endOfLastMatch < static_cast<int32_t>(EcmaStringAccessor(thisString).GetLength())) {
|
||||
auto thisLen = EcmaStringAccessor(thisString).GetLength();
|
||||
JSHandle<EcmaString> suffixString(thread,
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
static JSTaggedValue MatchAll(EcmaRuntimeCallInfo *argv);
|
||||
// 21.1.3.12
|
||||
static JSTaggedValue Normalize(EcmaRuntimeCallInfo *argv);
|
||||
|
||||
|
||||
static JSTaggedValue PadStart(EcmaRuntimeCallInfo *argv);
|
||||
|
||||
static JSTaggedValue PadEnd(EcmaRuntimeCallInfo *argv);
|
||||
@ -102,7 +102,7 @@ public:
|
||||
static JSTaggedValue ToUpperCase(EcmaRuntimeCallInfo *argv);
|
||||
// 21.1.3.25
|
||||
static JSTaggedValue Trim(EcmaRuntimeCallInfo *argv);
|
||||
|
||||
|
||||
static JSTaggedValue TrimStart(EcmaRuntimeCallInfo *argv);
|
||||
|
||||
static JSTaggedValue TrimEnd(EcmaRuntimeCallInfo *argv);
|
||||
|
@ -330,7 +330,7 @@ HWTEST_F_L0(BuiltinsAtomicsTest, SubAndAdd_1)
|
||||
ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue());
|
||||
ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast<int32_t>(0)));
|
||||
ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast<int32_t>(2)));
|
||||
|
||||
|
||||
[[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo);
|
||||
BuiltinsAtomics::Sub(ecmaRuntimeCallInfo);
|
||||
JSTaggedValue addResult = BuiltinsAtomics::Add(ecmaRuntimeCallInfo);
|
||||
@ -383,8 +383,7 @@ HWTEST_F_L0(BuiltinsAtomicsTest, And_2)
|
||||
JSTaggedValue result = BuiltinsAtomics::And(ecmaRuntimeCallInfo);
|
||||
TestHelper::TearDownFrame(thread, prev);
|
||||
ASSERT_EQ(result.GetInt(), 7);
|
||||
|
||||
|
||||
|
||||
auto ecmaRuntimeCallInfos = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8);
|
||||
ecmaRuntimeCallInfos->SetFunction(JSTaggedValue::Undefined());
|
||||
ecmaRuntimeCallInfos->SetThis(JSTaggedValue::Undefined());
|
||||
@ -405,7 +404,7 @@ HWTEST_F_L0(BuiltinsAtomicsTest, CompareExchange_1)
|
||||
array->Set(thread, 0, JSTaggedValue(5));
|
||||
array->Set(thread, 1, JSTaggedValue(0));
|
||||
array->Set(thread, 2, JSTaggedValue(0));
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> obj = JSHandle<JSTaggedValue>(thread, CreateTypedArray(thread, array, DataViewType::UINT8));
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 12);
|
||||
ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
|
||||
@ -414,7 +413,7 @@ HWTEST_F_L0(BuiltinsAtomicsTest, CompareExchange_1)
|
||||
ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast<int32_t>(0)));
|
||||
ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast<int32_t>(5)));
|
||||
ecmaRuntimeCallInfo->SetCallArg(3, JSTaggedValue(static_cast<int32_t>(2)));
|
||||
|
||||
|
||||
[[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo);
|
||||
JSTaggedValue result = BuiltinsAtomics::CompareExchange(ecmaRuntimeCallInfo);
|
||||
TestHelper::TearDownFrame(thread, prev);
|
||||
@ -429,7 +428,7 @@ HWTEST_F_L0(BuiltinsAtomicsTest, CompareExchange_2)
|
||||
array->Set(thread, 0, JSTaggedValue(5));
|
||||
array->Set(thread, 1, JSTaggedValue(0));
|
||||
array->Set(thread, 2, JSTaggedValue(0));
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> obj = JSHandle<JSTaggedValue>(thread, CreateTypedArray(thread, array, DataViewType::INT8));
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 12);
|
||||
ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
|
||||
@ -438,13 +437,12 @@ HWTEST_F_L0(BuiltinsAtomicsTest, CompareExchange_2)
|
||||
ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast<int32_t>(0)));
|
||||
ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast<int32_t>(5)));
|
||||
ecmaRuntimeCallInfo->SetCallArg(3, JSTaggedValue(static_cast<int32_t>(2)));
|
||||
|
||||
|
||||
[[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo);
|
||||
JSTaggedValue result = BuiltinsAtomics::CompareExchange(ecmaRuntimeCallInfo);
|
||||
TestHelper::TearDownFrame(thread, prev);
|
||||
ASSERT_EQ(result.GetInt(), 5);
|
||||
|
||||
|
||||
|
||||
auto ecmaRuntimeCallInfos = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8);
|
||||
ecmaRuntimeCallInfos->SetFunction(JSTaggedValue::Undefined());
|
||||
ecmaRuntimeCallInfos->SetThis(JSTaggedValue::Undefined());
|
||||
@ -552,7 +550,7 @@ HWTEST_F_L0(BuiltinsAtomicsTest, Exchange_1)
|
||||
array->Set(thread, 0, JSTaggedValue(3));
|
||||
array->Set(thread, 1, JSTaggedValue(0));
|
||||
array->Set(thread, 2, JSTaggedValue(0));
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> obj = JSHandle<JSTaggedValue>(thread, CreateTypedArray(thread, array));
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10);
|
||||
ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
|
||||
@ -560,7 +558,7 @@ HWTEST_F_L0(BuiltinsAtomicsTest, Exchange_1)
|
||||
ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue());
|
||||
ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast<int32_t>(0)));
|
||||
ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast<int32_t>(6)));
|
||||
|
||||
|
||||
[[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo);
|
||||
JSTaggedValue result = BuiltinsAtomics::Exchange(ecmaRuntimeCallInfo);
|
||||
TestHelper::TearDownFrame(thread, prev);
|
||||
@ -575,7 +573,7 @@ HWTEST_F_L0(BuiltinsAtomicsTest, Exchange_2)
|
||||
array->Set(thread, 0, JSTaggedValue(3));
|
||||
array->Set(thread, 1, JSTaggedValue(0));
|
||||
array->Set(thread, 2, JSTaggedValue(0));
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> obj = JSHandle<JSTaggedValue>(thread, CreateTypedArray(thread, array));
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10);
|
||||
ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
|
||||
@ -583,13 +581,12 @@ HWTEST_F_L0(BuiltinsAtomicsTest, Exchange_2)
|
||||
ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue());
|
||||
ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast<int32_t>(0)));
|
||||
ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast<int32_t>(6)));
|
||||
|
||||
|
||||
[[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo);
|
||||
JSTaggedValue result = BuiltinsAtomics::Exchange(ecmaRuntimeCallInfo);
|
||||
TestHelper::TearDownFrame(thread, prev);
|
||||
ASSERT_EQ(result.GetInt(), 3);
|
||||
|
||||
|
||||
|
||||
auto ecmaRuntimeCallInfos = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8);
|
||||
ecmaRuntimeCallInfos->SetFunction(JSTaggedValue::Undefined());
|
||||
ecmaRuntimeCallInfos->SetThis(JSTaggedValue::Undefined());
|
||||
@ -610,7 +607,7 @@ HWTEST_F_L0(BuiltinsAtomicsTest, Or_1)
|
||||
array->Set(thread, 0, JSTaggedValue(5));
|
||||
array->Set(thread, 1, JSTaggedValue(0));
|
||||
array->Set(thread, 2, JSTaggedValue(0));
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> obj = JSHandle<JSTaggedValue>(thread, CreateTypedArray(thread, array));
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10);
|
||||
ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
|
||||
@ -618,7 +615,7 @@ HWTEST_F_L0(BuiltinsAtomicsTest, Or_1)
|
||||
ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue());
|
||||
ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast<int32_t>(0)));
|
||||
ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast<int32_t>(2)));
|
||||
|
||||
|
||||
[[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo);
|
||||
JSTaggedValue result = BuiltinsAtomics::Or(ecmaRuntimeCallInfo);
|
||||
TestHelper::TearDownFrame(thread, prev);
|
||||
@ -633,7 +630,7 @@ HWTEST_F_L0(BuiltinsAtomicsTest, Or_2)
|
||||
array->Set(thread, 0, JSTaggedValue(5));
|
||||
array->Set(thread, 1, JSTaggedValue(0));
|
||||
array->Set(thread, 2, JSTaggedValue(0));
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> obj = JSHandle<JSTaggedValue>(thread, CreateTypedArray(thread, array));
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 12);
|
||||
ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
|
||||
@ -641,13 +638,12 @@ HWTEST_F_L0(BuiltinsAtomicsTest, Or_2)
|
||||
ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue());
|
||||
ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast<int32_t>(0)));
|
||||
ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast<int32_t>(2)));
|
||||
|
||||
|
||||
[[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo);
|
||||
JSTaggedValue result = BuiltinsAtomics::Or(ecmaRuntimeCallInfo);
|
||||
TestHelper::TearDownFrame(thread, prev);
|
||||
ASSERT_EQ(result.GetInt(), 5);
|
||||
|
||||
|
||||
|
||||
auto ecmaRuntimeCallInfos = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8);
|
||||
ecmaRuntimeCallInfos->SetFunction(JSTaggedValue::Undefined());
|
||||
ecmaRuntimeCallInfos->SetThis(JSTaggedValue::Undefined());
|
||||
@ -668,7 +664,7 @@ HWTEST_F_L0(BuiltinsAtomicsTest, Sub_1)
|
||||
array->Set(thread, 0, JSTaggedValue(5));
|
||||
array->Set(thread, 1, JSTaggedValue(0));
|
||||
array->Set(thread, 2, JSTaggedValue(0));
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> obj = JSHandle<JSTaggedValue>(thread, CreateTypedArray(thread, array));
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10);
|
||||
ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
|
||||
@ -676,7 +672,7 @@ HWTEST_F_L0(BuiltinsAtomicsTest, Sub_1)
|
||||
ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue());
|
||||
ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast<int32_t>(0)));
|
||||
ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast<int32_t>(2)));
|
||||
|
||||
|
||||
[[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo);
|
||||
JSTaggedValue result = BuiltinsAtomics::Sub(ecmaRuntimeCallInfo);
|
||||
TestHelper::TearDownFrame(thread, prev);
|
||||
@ -691,7 +687,7 @@ HWTEST_F_L0(BuiltinsAtomicsTest, Sub_2)
|
||||
array->Set(thread, 0, JSTaggedValue(0));
|
||||
array->Set(thread, 1, JSTaggedValue(5));
|
||||
array->Set(thread, 2, JSTaggedValue(0));
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> obj = JSHandle<JSTaggedValue>(thread, CreateTypedArray(thread, array));
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10);
|
||||
ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
|
||||
@ -699,12 +695,12 @@ HWTEST_F_L0(BuiltinsAtomicsTest, Sub_2)
|
||||
ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue());
|
||||
ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast<int32_t>(1)));
|
||||
ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast<int32_t>(2)));
|
||||
|
||||
|
||||
[[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo);
|
||||
JSTaggedValue result = BuiltinsAtomics::Sub(ecmaRuntimeCallInfo);
|
||||
TestHelper::TearDownFrame(thread, prev);
|
||||
ASSERT_EQ(result.GetInt(), 5);
|
||||
|
||||
|
||||
auto ecmaRuntimeCallInfos = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8);
|
||||
ecmaRuntimeCallInfos->SetFunction(JSTaggedValue::Undefined());
|
||||
ecmaRuntimeCallInfos->SetThis(JSTaggedValue::Undefined());
|
||||
@ -725,7 +721,7 @@ HWTEST_F_L0(BuiltinsAtomicsTest, Xor_1)
|
||||
array->Set(thread, 0, JSTaggedValue(5));
|
||||
array->Set(thread, 1, JSTaggedValue(7));
|
||||
array->Set(thread, 2, JSTaggedValue(0));
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> obj = JSHandle<JSTaggedValue>(thread, CreateTypedArray(thread, array));
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10);
|
||||
ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
|
||||
@ -733,7 +729,7 @@ HWTEST_F_L0(BuiltinsAtomicsTest, Xor_1)
|
||||
ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue());
|
||||
ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast<int32_t>(1)));
|
||||
ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast<int32_t>(2)));
|
||||
|
||||
|
||||
[[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo);
|
||||
JSTaggedValue result = BuiltinsAtomics::Xor(ecmaRuntimeCallInfo);
|
||||
TestHelper::TearDownFrame(thread, prev);
|
||||
@ -748,7 +744,7 @@ HWTEST_F_L0(BuiltinsAtomicsTest, Xor_2)
|
||||
array->Set(thread, 0, JSTaggedValue(5));
|
||||
array->Set(thread, 1, JSTaggedValue(7));
|
||||
array->Set(thread, 2, JSTaggedValue(0));
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> obj = JSHandle<JSTaggedValue>(thread, CreateTypedArray(thread, array));
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10);
|
||||
ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
|
||||
@ -756,12 +752,12 @@ HWTEST_F_L0(BuiltinsAtomicsTest, Xor_2)
|
||||
ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue());
|
||||
ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast<int32_t>(1)));
|
||||
ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast<int32_t>(2)));
|
||||
|
||||
|
||||
[[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo);
|
||||
JSTaggedValue result = BuiltinsAtomics::Xor(ecmaRuntimeCallInfo);
|
||||
TestHelper::TearDownFrame(thread, prev);
|
||||
ASSERT_EQ(result.GetInt(), 7);
|
||||
|
||||
|
||||
auto ecmaRuntimeCallInfos = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8);
|
||||
ecmaRuntimeCallInfos->SetFunction(JSTaggedValue::Undefined());
|
||||
ecmaRuntimeCallInfos->SetThis(JSTaggedValue::Undefined());
|
||||
@ -947,4 +943,4 @@ HWTEST_F_L0(BuiltinsAtomicsTest, Notify)
|
||||
TestHelper::TearDownFrame(thread, prev);
|
||||
ASSERT_EQ(result, JSTaggedValue(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -482,7 +482,7 @@ static JSTaggedValue JSDateTimeFormatForObj_001(JSThread *thread)
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSTaggedValue> objFun = env->GetObjectFunction();
|
||||
JSHandle<JSObject> optionsObj = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(objFun), objFun);
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> timeZoneName = globalConst->GetHandledTimeZoneNameString();
|
||||
JSHandle<JSTaggedValue> localesString(factory->NewFromASCII("en-US"));
|
||||
JSHandle<JSTaggedValue> digitValue(factory->NewFromASCII("2-digit"));
|
||||
@ -576,7 +576,7 @@ static JSTaggedValue JSDateTimeFormatForObj_002(JSThread *thread)
|
||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
JSHandle<JSTaggedValue> objFun = env->GetObjectFunction();
|
||||
JSHandle<JSObject> optionsObj = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(objFun), objFun);
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> timeZoneName = globalConst->GetHandledTimeZoneNameString();
|
||||
JSHandle<JSTaggedValue> timeZone = globalConst->GetHandledTimeZoneString();
|
||||
JSHandle<JSTaggedValue> numicValue(factory->NewFromASCII("numeric"));
|
||||
@ -647,4 +647,4 @@ HWTEST_F_L0(BuiltinsDateTimeFormatTest, DateTimeFormat_003)
|
||||
JSHandle<TaggedArray> elements(thread, resultHandle->GetElements());
|
||||
EXPECT_EQ(elements->GetLength(), 16U);
|
||||
}
|
||||
} // namespace panda::test
|
||||
} // namespace panda::test
|
||||
|
@ -134,7 +134,7 @@ HWTEST_F_L0(BuiltinsNumberFormatTest, Format_001)
|
||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
auto globalConst = thread->GlobalConstants();
|
||||
JSHandle<JSTaggedValue> objFun = env->GetObjectFunction();
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> styleKey = globalConst->GetHandledStyleString();
|
||||
JSHandle<JSTaggedValue> styleValue(factory->NewFromASCII("decimal"));
|
||||
JSHandle<JSTaggedValue> localeString(factory->NewFromASCII("en-US"));
|
||||
@ -155,7 +155,7 @@ HWTEST_F_L0(BuiltinsNumberFormatTest, Format_002)
|
||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
auto globalConst = thread->GlobalConstants();
|
||||
JSHandle<JSTaggedValue> objFun = env->GetObjectFunction();
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> styleKey = globalConst->GetHandledStyleString();
|
||||
JSHandle<JSTaggedValue> currencyKey = globalConst->GetHandledCurrencyString();
|
||||
JSHandle<JSTaggedValue> currencyDisplayKey = globalConst->GetHandledCurrencyDisplayString();
|
||||
@ -167,7 +167,7 @@ HWTEST_F_L0(BuiltinsNumberFormatTest, Format_002)
|
||||
JSHandle<JSTaggedValue> currencySignDisplayValue(factory->NewFromASCII("accounting"));
|
||||
JSHandle<JSTaggedValue> localeString(factory->NewFromASCII("en-US"));
|
||||
JSHandle<JSTaggedValue> numberVal(thread, JSTaggedValue(static_cast<int32_t>(-3500)));
|
||||
|
||||
|
||||
JSHandle<JSObject> optionsObj = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(objFun), objFun);
|
||||
JSObject::SetProperty(thread, optionsObj, styleKey, styleValue);
|
||||
JSObject::SetProperty(thread, optionsObj, currencyKey, currencyValue);
|
||||
@ -186,7 +186,7 @@ HWTEST_F_L0(BuiltinsNumberFormatTest, Format_003)
|
||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
auto globalConst = thread->GlobalConstants();
|
||||
JSHandle<JSTaggedValue> objFun = env->GetObjectFunction();
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> styleKey = globalConst->GetHandledStyleString();
|
||||
JSHandle<JSTaggedValue> signDisplayKey = globalConst->GetHandledSignDisplayString();
|
||||
|
||||
@ -194,7 +194,7 @@ HWTEST_F_L0(BuiltinsNumberFormatTest, Format_003)
|
||||
JSHandle<JSTaggedValue> signDisplayValue(factory->NewFromASCII("exceptZero"));
|
||||
JSHandle<JSTaggedValue> localeString(factory->NewFromASCII("en-US"));
|
||||
JSHandle<JSTaggedValue> numberVal(thread, JSTaggedValue(static_cast<double>(0.55)));
|
||||
|
||||
|
||||
JSHandle<JSObject> optionsObj = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(objFun), objFun);
|
||||
JSObject::SetProperty(thread, optionsObj, styleKey, styleValue);
|
||||
JSObject::SetProperty(thread, optionsObj, signDisplayKey, signDisplayValue);
|
||||
@ -211,7 +211,7 @@ HWTEST_F_L0(BuiltinsNumberFormatTest, Format_004)
|
||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
auto globalConst = thread->GlobalConstants();
|
||||
JSHandle<JSTaggedValue> objFun = env->GetObjectFunction();
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> styleKey = globalConst->GetHandledStyleString();
|
||||
JSHandle<JSTaggedValue> unitKey = globalConst->GetHandledUnitString();
|
||||
|
||||
@ -219,7 +219,7 @@ HWTEST_F_L0(BuiltinsNumberFormatTest, Format_004)
|
||||
JSHandle<JSTaggedValue> unitValue(factory->NewFromASCII("liter"));
|
||||
JSHandle<JSTaggedValue> localeString(factory->NewFromASCII("en-US"));
|
||||
JSHandle<JSTaggedValue> numberVal(thread, JSTaggedValue(3500));
|
||||
|
||||
|
||||
JSHandle<JSObject> optionsObj = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(objFun), objFun);
|
||||
JSObject::SetProperty(thread, optionsObj, styleKey, styleValue);
|
||||
JSObject::SetProperty(thread, optionsObj, unitKey, unitValue);
|
||||
@ -236,12 +236,12 @@ HWTEST_F_L0(BuiltinsNumberFormatTest, Format_005)
|
||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
auto globalConst = thread->GlobalConstants();
|
||||
JSHandle<JSTaggedValue> objFun = env->GetObjectFunction();
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> notationKey = globalConst->GetHandledNotationString();
|
||||
JSHandle<JSTaggedValue> notationValue(factory->NewFromASCII("compact"));
|
||||
JSHandle<JSTaggedValue> localeString(factory->NewFromASCII("zh-CN"));
|
||||
JSHandle<JSTaggedValue> numberVal(thread, JSTaggedValue(987654321));
|
||||
|
||||
|
||||
JSHandle<JSObject> optionsObj = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(objFun), objFun);
|
||||
JSObject::SetProperty(thread, optionsObj, notationKey, notationValue);
|
||||
JSTaggedValue formatResult = BuiltinsFormatTest(thread, optionsObj, numberVal, localeString);
|
||||
@ -274,7 +274,7 @@ HWTEST_F_L0(BuiltinsNumberFormatTest, FormatToParts)
|
||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
auto globalConst = thread->GlobalConstants();
|
||||
JSHandle<JSTaggedValue> objFun = env->GetObjectFunction();
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> styleKey = globalConst->GetHandledStyleString();
|
||||
JSHandle<JSTaggedValue> currencyKey = globalConst->GetHandledCurrencyString();
|
||||
|
||||
@ -282,7 +282,7 @@ HWTEST_F_L0(BuiltinsNumberFormatTest, FormatToParts)
|
||||
JSHandle<JSTaggedValue> currencyValue(factory->NewFromASCII("EUR"));
|
||||
JSHandle<JSTaggedValue> localeString(factory->NewFromASCII("de-DE"));
|
||||
JSHandle<JSTaggedValue> numberVal(thread, JSTaggedValue(3500));
|
||||
|
||||
|
||||
JSHandle<JSObject> optionsObj = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(objFun), objFun);
|
||||
JSObject::SetProperty(thread, optionsObj, styleKey, styleValue);
|
||||
JSObject::SetProperty(thread, optionsObj, currencyKey, currencyValue);
|
||||
@ -301,7 +301,7 @@ HWTEST_F_L0(BuiltinsNumberFormatTest, FormatToParts)
|
||||
[[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo);
|
||||
JSTaggedValue result = BuiltinsNumberFormat::FormatToParts(ecmaRuntimeCallInfo);
|
||||
TestHelper::TearDownFrame(thread, prev);
|
||||
|
||||
|
||||
JSHandle<JSArray> resultHandle(thread, result);
|
||||
JSHandle<TaggedArray> elements(thread, resultHandle->GetElements());
|
||||
EXPECT_EQ(elements->GetLength(), 10U); // "3","." ,"5" ,"0" ,"0" ,"," ,"0" ,0" ," " ,"€"
|
||||
@ -313,14 +313,14 @@ HWTEST_F_L0(BuiltinsNumberFormatTest, ResolvedOptions)
|
||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
auto globalConst = thread->GlobalConstants();
|
||||
JSHandle<JSTaggedValue> objFun = env->GetObjectFunction();
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> styleKey = globalConst->GetHandledStyleString();
|
||||
JSHandle<JSTaggedValue> currencyKey = globalConst->GetHandledCurrencyString();
|
||||
|
||||
JSHandle<JSTaggedValue> styleValue(factory->NewFromASCII("currency"));
|
||||
JSHandle<JSTaggedValue> currencyValue(factory->NewFromASCII("USD"));
|
||||
JSHandle<JSTaggedValue> localeString(factory->NewFromASCII("en-US"));
|
||||
|
||||
|
||||
JSHandle<JSObject> optionsObj = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(objFun), objFun);
|
||||
JSObject::SetProperty(thread, optionsObj, styleKey, styleValue);
|
||||
JSObject::SetProperty(thread, optionsObj, currencyKey, currencyValue);
|
||||
@ -343,4 +343,4 @@ HWTEST_F_L0(BuiltinsNumberFormatTest, ResolvedOptions)
|
||||
EXPECT_EQ(JSTaggedValue::SameValue(
|
||||
JSObject::GetProperty(thread, resultObj, currencyKey).GetValue(), currencyValue), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ HWTEST_F_L0(BuiltinsStringIteratorTest, Next_002)
|
||||
JSHandle<JSStringIterator> stringIterator =
|
||||
JSHandle<JSStringIterator>(thread, CreateBuiltinsJSStringIterator(thread, string));
|
||||
JSHandle<JSTaggedValue> valueStr = globalConst->GetHandledValueString();
|
||||
|
||||
|
||||
auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4);
|
||||
ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined());
|
||||
ecmaRuntimeCallInfo1->SetThis(stringIterator.GetTaggedValue());
|
||||
|
@ -149,7 +149,7 @@ HWTEST_F_L0(BuiltinsWeakRefTest, Deref2)
|
||||
TestHelper::TearDownFrame(thread, prev);
|
||||
JSTaggedValue result1 = BuiltinsWeakRef::Deref(ecmaRuntimeCallInfo);
|
||||
ASSERT_EQ(result1, target.GetTaggedValue());
|
||||
|
||||
|
||||
JSObject::SetProperty(thread, target, styleKey, styleValue);
|
||||
ASSERT_EQ(result1, target.GetTaggedValue());
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ private:
|
||||
class VectorRegister {
|
||||
public:
|
||||
explicit VectorRegister(VectorRegisterId reg, Scale scale = D) : reg_(reg), scale_(scale) {};
|
||||
|
||||
|
||||
inline VectorRegisterId GetId() const
|
||||
{
|
||||
return reg_;
|
||||
@ -424,4 +424,4 @@ private:
|
||||
uint32_t GetShiftOfLdr(const MemoryOperand &operand, Scale scale, bool isRegX);
|
||||
};
|
||||
} // namespace panda::ecmascript::aarch64
|
||||
#endif
|
||||
#endif
|
||||
|
@ -137,7 +137,7 @@ HWTEST_F_L0(AssemblerX64Test, Emit)
|
||||
{
|
||||
x64::AssemblerX64 masm(chunk_);
|
||||
Label lable1;
|
||||
|
||||
|
||||
size_t current = 0;
|
||||
__ Pushq(rbp);
|
||||
uint32_t value = masm.GetU8(current++);
|
||||
|
@ -824,7 +824,7 @@ void SlowPathLowering::SaveFrameToContext(GateRef gate, GateRef jsFunc)
|
||||
builder_.SetValueToTaggedArray(VariableType::JS_ANY(), glue_, taggedArray, builder_.Int32(idx), tmpGate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
acc_.DeleteGate(saveRegister);
|
||||
|
||||
// setRegsArrays
|
||||
|
@ -913,7 +913,7 @@ void TSTypeLowering::LowerTypedLdObjByIndex(GateRef gate)
|
||||
GateRef guard = acc_.GetDep(gate);
|
||||
ASSERT(acc_.GetOpCode(guard) == OpCode::GUARD);
|
||||
builder_.SetDepend(acc_.GetDep(guard));
|
||||
|
||||
|
||||
GateRef check = Circuit::NullGate();
|
||||
if (tsManager_->IsFloat32ArrayType(receiverType)) {
|
||||
check = builder_.TypedArrayCheck(receiverType, receiver);
|
||||
@ -923,7 +923,7 @@ void TSTypeLowering::LowerTypedLdObjByIndex(GateRef gate)
|
||||
}
|
||||
GateRef index = acc_.GetValueIn(gate, 0);
|
||||
check = builder_.BoolAnd(check, builder_.IndexCheck(receiverType, receiver, index));
|
||||
|
||||
|
||||
acc_.ReplaceIn(guard, 1, check);
|
||||
acc_.SetDep(guard, builder_.GetDepend());
|
||||
builder_.SetDepend(guard);
|
||||
@ -965,7 +965,7 @@ void TSTypeLowering::LowerTypedStObjByIndex(GateRef gate)
|
||||
LOG_ECMA(FATAL) << "this branch is unreachable";
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
|
||||
GateRef index = acc_.GetValueIn(gate, 1);
|
||||
check = builder_.BoolAnd(check, builder_.IndexCheck(receiverType, receiver, index));
|
||||
|
||||
|
@ -111,7 +111,7 @@ JSTaggedValue ContainersArrayList::Clear(EcmaRuntimeCallInfo *argv)
|
||||
JSThread *thread = argv->GetThread();
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||
JSHandle<JSTaggedValue> self = GetThis(argv);
|
||||
|
||||
|
||||
if (!self->IsJSAPIArrayList()) {
|
||||
if (self->IsJSProxy() && JSHandle<JSProxy>::Cast(self)->GetTarget().IsJSAPIArrayList()) {
|
||||
self = JSHandle<JSTaggedValue>(thread, JSHandle<JSProxy>::Cast(self)->GetTarget());
|
||||
@ -134,7 +134,7 @@ JSTaggedValue ContainersArrayList::Clone(EcmaRuntimeCallInfo *argv)
|
||||
JSThread *thread = argv->GetThread();
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||
JSHandle<JSTaggedValue> self = GetThis(argv);
|
||||
|
||||
|
||||
if (!self->IsJSAPIArrayList()) {
|
||||
if (self->IsJSProxy() && JSHandle<JSProxy>::Cast(self)->GetTarget().IsJSAPIArrayList()) {
|
||||
self = JSHandle<JSTaggedValue>(thread, JSHandle<JSProxy>::Cast(self)->GetTarget());
|
||||
@ -157,7 +157,7 @@ JSTaggedValue ContainersArrayList::Has(EcmaRuntimeCallInfo *argv)
|
||||
JSThread *thread = argv->GetThread();
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||
JSHandle<JSTaggedValue> self = GetThis(argv);
|
||||
|
||||
|
||||
if (!self->IsJSAPIArrayList()) {
|
||||
if (self->IsJSProxy() && JSHandle<JSProxy>::Cast(self)->GetTarget().IsJSAPIArrayList()) {
|
||||
self = JSHandle<JSTaggedValue>(thread, JSHandle<JSProxy>::Cast(self)->GetTarget());
|
||||
@ -180,7 +180,7 @@ JSTaggedValue ContainersArrayList::GetCapacity(EcmaRuntimeCallInfo *argv)
|
||||
|
||||
BUILTINS_API_TRACE(argv->GetThread(), ArrayList, GetCapacity);
|
||||
JSThread *thread = argv->GetThread();
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> self = GetThis(argv);
|
||||
if (!self->IsJSAPIArrayList()) {
|
||||
if (self->IsJSProxy() && JSHandle<JSProxy>::Cast(self)->GetTarget().IsJSAPIArrayList()) {
|
||||
@ -204,7 +204,7 @@ JSTaggedValue ContainersArrayList::IncreaseCapacityTo(EcmaRuntimeCallInfo *argv)
|
||||
JSThread *thread = argv->GetThread();
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||
JSHandle<JSTaggedValue> self = GetThis(argv);
|
||||
|
||||
|
||||
if (!self->IsJSAPIArrayList()) {
|
||||
if (self->IsJSProxy() && JSHandle<JSProxy>::Cast(self)->GetTarget().IsJSAPIArrayList()) {
|
||||
self = JSHandle<JSTaggedValue>(thread, JSHandle<JSProxy>::Cast(self)->GetTarget());
|
||||
@ -260,7 +260,7 @@ JSTaggedValue ContainersArrayList::Get(EcmaRuntimeCallInfo *argv)
|
||||
JSThread *thread = argv->GetThread();
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||
JSHandle<JSTaggedValue> self = GetThis(argv);
|
||||
|
||||
|
||||
if (!self->IsJSAPIArrayList()) {
|
||||
if (self->IsJSProxy() && JSHandle<JSProxy>::Cast(self)->GetTarget().IsJSAPIArrayList()) {
|
||||
self = JSHandle<JSTaggedValue>(thread, JSHandle<JSProxy>::Cast(self)->GetTarget());
|
||||
@ -272,7 +272,7 @@ JSTaggedValue ContainersArrayList::Get(EcmaRuntimeCallInfo *argv)
|
||||
}
|
||||
|
||||
JSHandle<JSTaggedValue> value = GetCallArg(argv, 0);
|
||||
|
||||
|
||||
JSTaggedValue element = JSHandle<JSAPIArrayList>::Cast(self)->Get(thread, JSTaggedValue::ToUint32(thread, value));
|
||||
|
||||
return element;
|
||||
@ -285,7 +285,7 @@ JSTaggedValue ContainersArrayList::GetIndexOf(EcmaRuntimeCallInfo *argv)
|
||||
JSThread *thread = argv->GetThread();
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||
JSHandle<JSTaggedValue> self = GetThis(argv);
|
||||
|
||||
|
||||
if (!self->IsJSAPIArrayList()) {
|
||||
if (self->IsJSProxy() && JSHandle<JSProxy>::Cast(self)->GetTarget().IsJSAPIArrayList()) {
|
||||
self = JSHandle<JSTaggedValue>(thread, JSHandle<JSProxy>::Cast(self)->GetTarget());
|
||||
@ -308,7 +308,7 @@ JSTaggedValue ContainersArrayList::IsEmpty(EcmaRuntimeCallInfo *argv)
|
||||
JSThread *thread = argv->GetThread();
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||
JSHandle<JSTaggedValue> self = GetThis(argv);
|
||||
|
||||
|
||||
if (!self->IsJSAPIArrayList()) {
|
||||
if (self->IsJSProxy() && JSHandle<JSProxy>::Cast(self)->GetTarget().IsJSAPIArrayList()) {
|
||||
self = JSHandle<JSTaggedValue>(thread, JSHandle<JSProxy>::Cast(self)->GetTarget());
|
||||
@ -329,7 +329,7 @@ JSTaggedValue ContainersArrayList::GetLastIndexOf(EcmaRuntimeCallInfo *argv)
|
||||
JSThread *thread = argv->GetThread();
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||
JSHandle<JSTaggedValue> self = GetThis(argv);
|
||||
|
||||
|
||||
if (!self->IsJSAPIArrayList()) {
|
||||
if (self->IsJSProxy() && JSHandle<JSProxy>::Cast(self)->GetTarget().IsJSAPIArrayList()) {
|
||||
self = JSHandle<JSTaggedValue>(thread, JSHandle<JSProxy>::Cast(self)->GetTarget());
|
||||
@ -352,7 +352,7 @@ JSTaggedValue ContainersArrayList::RemoveByIndex(EcmaRuntimeCallInfo *argv)
|
||||
JSThread *thread = argv->GetThread();
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||
JSHandle<JSTaggedValue> self = GetThis(argv);
|
||||
|
||||
|
||||
if (!self->IsJSAPIArrayList()) {
|
||||
if (self->IsJSProxy() && JSHandle<JSProxy>::Cast(self)->GetTarget().IsJSAPIArrayList()) {
|
||||
self = JSHandle<JSTaggedValue>(thread, JSHandle<JSProxy>::Cast(self)->GetTarget());
|
||||
@ -385,7 +385,7 @@ JSTaggedValue ContainersArrayList::Remove(EcmaRuntimeCallInfo *argv)
|
||||
JSThread *thread = argv->GetThread();
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||
JSHandle<JSTaggedValue> self = GetThis(argv);
|
||||
|
||||
|
||||
if (!self->IsJSAPIArrayList()) {
|
||||
if (self->IsJSProxy() && JSHandle<JSProxy>::Cast(self)->GetTarget().IsJSAPIArrayList()) {
|
||||
self = JSHandle<JSTaggedValue>(thread, JSHandle<JSProxy>::Cast(self)->GetTarget());
|
||||
@ -411,7 +411,7 @@ JSTaggedValue ContainersArrayList::RemoveByRange(EcmaRuntimeCallInfo *argv)
|
||||
JSThread *thread = argv->GetThread();
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||
JSHandle<JSTaggedValue> self = GetThis(argv);
|
||||
|
||||
|
||||
if (!self->IsJSAPIArrayList()) {
|
||||
if (self->IsJSProxy() && JSHandle<JSProxy>::Cast(self)->GetTarget().IsJSAPIArrayList()) {
|
||||
self = JSHandle<JSTaggedValue>(thread, JSHandle<JSProxy>::Cast(self)->GetTarget());
|
||||
@ -484,7 +484,7 @@ JSTaggedValue ContainersArrayList::Set(EcmaRuntimeCallInfo *argv)
|
||||
JSThread *thread = argv->GetThread();
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||
JSHandle<JSTaggedValue> self = GetThis(argv);
|
||||
|
||||
|
||||
if (!self->IsJSAPIArrayList()) {
|
||||
if (self->IsJSProxy() && JSHandle<JSProxy>::Cast(self)->GetTarget().IsJSAPIArrayList()) {
|
||||
self = JSHandle<JSTaggedValue>(thread, JSHandle<JSProxy>::Cast(self)->GetTarget());
|
||||
@ -510,7 +510,7 @@ JSTaggedValue ContainersArrayList::SubArrayList(EcmaRuntimeCallInfo *argv)
|
||||
JSThread *thread = argv->GetThread();
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||
JSHandle<JSTaggedValue> self = GetThis(argv);
|
||||
|
||||
|
||||
if (!self->IsJSAPIArrayList()) {
|
||||
if (self->IsJSProxy() && JSHandle<JSProxy>::Cast(self)->GetTarget().IsJSAPIArrayList()) {
|
||||
self = JSHandle<JSTaggedValue>(thread, JSHandle<JSProxy>::Cast(self)->GetTarget());
|
||||
@ -608,7 +608,7 @@ JSTaggedValue ContainersArrayList::GetSize(EcmaRuntimeCallInfo *argv)
|
||||
JSThread *thread = argv->GetThread();
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||
JSHandle<JSTaggedValue> self = GetThis(argv);
|
||||
|
||||
|
||||
if (!self->IsJSAPIArrayList()) {
|
||||
if (self->IsJSProxy() && JSHandle<JSProxy>::Cast(self)->GetTarget().IsJSAPIArrayList()) {
|
||||
self = JSHandle<JSTaggedValue>(thread, JSHandle<JSProxy>::Cast(self)->GetTarget());
|
||||
|
@ -12,7 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#include "ecmascript/containers/containers_lightweightset.h"
|
||||
|
||||
#include "ecmascript/containers/containers_errors.h"
|
||||
@ -42,7 +42,7 @@ JSTaggedValue ContainersLightWeightSet::LightWeightSetConstructor(EcmaRuntimeCal
|
||||
JSHandle<JSObject> obj = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(constructor), newTarget);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
JSHandle<JSAPILightWeightSet> lightweightSet = JSHandle<JSAPILightWeightSet>::Cast(obj);
|
||||
|
||||
|
||||
JSHandle<TaggedArray> hashes =
|
||||
JSAPILightWeightSet::CreateSlot(thread, JSAPILightWeightSet::DEFAULT_CAPACITY_LENGTH);
|
||||
JSHandle<TaggedArray> values =
|
||||
@ -102,7 +102,7 @@ JSTaggedValue ContainersLightWeightSet::AddAll(EcmaRuntimeCallInfo *argv)
|
||||
THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return JSTaggedValue(JSAPILightWeightSet::AddAll(thread, JSHandle<JSAPILightWeightSet>::Cast(self), value));
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ JSTaggedValue ContainersLinkedList::Insert(EcmaRuntimeCallInfo *argv)
|
||||
|
||||
JSHandle<JSTaggedValue> value = GetCallArg(argv, 1);
|
||||
JSHandle<JSTaggedValue> index = GetCallArg(argv, 0);
|
||||
|
||||
|
||||
if (!index->IsInteger()) {
|
||||
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, index.GetTaggedValue());
|
||||
CString errorMsg =
|
||||
@ -416,7 +416,7 @@ JSTaggedValue ContainersLinkedList::RemoveFirstFound(EcmaRuntimeCallInfo *argv)
|
||||
}
|
||||
}
|
||||
JSHandle<JSTaggedValue> element = GetCallArg(argv, 0);
|
||||
|
||||
|
||||
JSHandle<JSAPILinkedList> jsAPILinkedList = JSHandle<JSAPILinkedList>::Cast(self);
|
||||
JSTaggedValue result = JSAPILinkedList::RemoveFirstFound(thread, jsAPILinkedList, element.GetTaggedValue());
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
|
@ -12,7 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#include "ecmascript/containers/containers_plainarray.h"
|
||||
|
||||
#include "ecmascript/containers/containers_errors.h"
|
||||
|
@ -676,12 +676,12 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializePlainArray(JSThread *thread
|
||||
FuncLength::ZERO);
|
||||
SetFrozenFunction(thread, plainArrayFuncPrototype, "getValueAt", ContainersPlainArray::GetValueAt,
|
||||
FuncLength::ZERO);
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> lengthGetter = CreateGetter(thread, ContainersPlainArray::GetSize, "length",
|
||||
FuncLength::ZERO);
|
||||
JSHandle<JSTaggedValue> lengthKey = globalConst->GetHandledLengthString();
|
||||
SetGetter(thread, plainArrayFuncPrototype, lengthKey, lengthGetter);
|
||||
|
||||
|
||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
SetFunctionAtSymbol(thread, env, plainArrayFuncPrototype, env->GetIteratorSymbol(), "[Symbol.iterator]",
|
||||
ContainersPlainArray::GetIteratorObj, FuncLength::ONE);
|
||||
@ -814,7 +814,7 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeVector(JSThread *thread)
|
||||
SetFrozenFunction(thread, prototype, "getFirstElement", ContainersVector::GetFirstElement, FuncLength::ZERO);
|
||||
SetFrozenFunction(thread, prototype, "trimToCurrentLength",
|
||||
ContainersVector::TrimToCurrentLength, FuncLength::ZERO);
|
||||
|
||||
|
||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
SetStringTagSymbol(thread, env, prototype, "Vector");
|
||||
|
||||
@ -1163,7 +1163,7 @@ void ContainersPrivate::InitializeHashMapIterator(JSThread *thread)
|
||||
// HashMapIterator.prototype.next()
|
||||
SetFrozenFunction(thread, hashMapIteratorPrototype, "next", JSAPIHashMapIterator::Next, FuncLength::ZERO);
|
||||
SetStringTagSymbol(thread, env, hashMapIteratorPrototype, "HashMap Iterator");
|
||||
|
||||
|
||||
globalConst->SetConstant(ConstantIndex::HASHMAP_ITERATOR_PROTOTYPE_INDEX,
|
||||
hashMapIteratorPrototype.GetTaggedValue());
|
||||
}
|
||||
@ -1197,7 +1197,7 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeHashSet(JSThread *thread)
|
||||
SetFrozenFunction(thread, hashSetFuncPrototype, "entries", ContainersHashSet::Entries, FuncLength::ZERO);
|
||||
SetFrozenFunction(thread, hashSetFuncPrototype, "forEach", ContainersHashSet::ForEach, FuncLength::TWO,
|
||||
BUILTINS_STUB_ID(HashSetForEach));
|
||||
|
||||
|
||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
// @@ToStringTag
|
||||
SetStringTagSymbol(thread, env, hashSetFuncPrototype, "HashSet");
|
||||
|
@ -184,7 +184,7 @@ JSTaggedValue ContainersStack::ForEach(EcmaRuntimeCallInfo *argv)
|
||||
THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JSHandle<JSAPIStack> stack = JSHandle<JSAPIStack>::Cast(thisHandle);
|
||||
int len = stack->GetSize();
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
@ -197,7 +197,7 @@ JSTaggedValue ContainersStack::ForEach(EcmaRuntimeCallInfo *argv)
|
||||
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
|
||||
THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
|
||||
}
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> thisArgHandle = GetCallArg(argv, 1);
|
||||
JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
|
||||
int k = 0;
|
||||
|
@ -76,7 +76,7 @@ JSTaggedValue ContainersVector::Insert(EcmaRuntimeCallInfo *argv)
|
||||
JSThread *thread = argv->GetThread();
|
||||
BUILTINS_API_TRACE(thread, Vector, Insert);
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> self = GetThis(argv);
|
||||
if (!self->IsJSAPIVector()) {
|
||||
if (self->IsJSProxy() && JSHandle<JSProxy>::Cast(self)->GetTarget().IsJSAPIVector()) {
|
||||
@ -194,7 +194,7 @@ JSTaggedValue ContainersVector::Get(EcmaRuntimeCallInfo *argv)
|
||||
int32_t indexInt = JSTaggedValue::ToInt32(thread, index);
|
||||
JSTaggedValue value = JSAPIVector::Get(thread, JSHandle<JSAPIVector>::Cast(self), indexInt);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ protected:
|
||||
callInfo->SetThis(arrayList.GetTaggedValue());
|
||||
callInfo->SetCallArg(0, startIndex);
|
||||
callInfo->SetCallArg(1, endIndex);
|
||||
|
||||
|
||||
[[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, callInfo);
|
||||
JSTaggedValue result = ContainersArrayList::SubArrayList(callInfo);
|
||||
TestHelper::TearDownFrame(thread, prev);
|
||||
@ -180,7 +180,7 @@ HWTEST_F_L0(ContainersArrayListTest, ArrayListConstructor)
|
||||
ASSERT_EQ(resultProto, funcProto);
|
||||
int length = arrayList->GetLength().GetInt();
|
||||
ASSERT_EQ(length, 0); // 0 means the value
|
||||
|
||||
|
||||
// test ArrayListConstructor exception
|
||||
objCallInfo->SetNewTarget(JSTaggedValue::Undefined());
|
||||
CONTAINERS_API_EXCEPTION_TEST(ContainersArrayList, ArrayListConstructor, objCallInfo);
|
||||
@ -236,7 +236,7 @@ HWTEST_F_L0(ContainersArrayListTest, SubArrayList)
|
||||
EXPECT_EQ(result, JSTaggedValue::True());
|
||||
EXPECT_EQ(arrayList->GetSize(), static_cast<int>(i + 1));
|
||||
}
|
||||
|
||||
|
||||
// input startIndex type error
|
||||
{
|
||||
JSTaggedValue result = ArrayListSubArrayList(arrayList, JSTaggedValue::Undefined(), JSTaggedValue(2));
|
||||
@ -252,7 +252,7 @@ HWTEST_F_L0(ContainersArrayListTest, SubArrayList)
|
||||
EXPECT_EQ(result, JSTaggedValue::Exception());
|
||||
thread->ClearException();
|
||||
}
|
||||
|
||||
|
||||
// success
|
||||
{
|
||||
JSTaggedValue newArrayList = ArrayListSubArrayList(arrayList, JSTaggedValue(1), JSTaggedValue(3));
|
||||
@ -284,7 +284,7 @@ HWTEST_F_L0(ContainersArrayListTest, GetAndSet)
|
||||
TestHelper::TearDownFrame(thread, prev);
|
||||
EXPECT_EQ(retult, JSTaggedValue(i));
|
||||
}
|
||||
|
||||
|
||||
for (uint32_t i = 0; i < NODE_NUMBERS; i++) {
|
||||
callInfo->SetCallArg(0, JSTaggedValue(i));
|
||||
callInfo->SetCallArg(1, JSTaggedValue(-i - 1));
|
||||
@ -317,7 +317,7 @@ HWTEST_F_L0(ContainersArrayListTest, ProxyOfGetSetAndGetSize)
|
||||
[[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, callInfo);
|
||||
ContainersArrayList::Add(callInfo);
|
||||
TestHelper::TearDownFrame(thread, prev);
|
||||
|
||||
|
||||
[[maybe_unused]] auto prev1 = TestHelper::SetupFrame(thread, callInfo);
|
||||
JSTaggedValue retult = ContainersArrayList::GetSize(callInfo);
|
||||
TestHelper::TearDownFrame(thread, prev1);
|
||||
@ -407,4 +407,4 @@ HWTEST_F_L0(ContainersArrayListTest, ExceptionReturn3)
|
||||
CONTAINERS_API_EXCEPTION_TEST(ContainersArrayList, Sort, callInfo);
|
||||
}
|
||||
}
|
||||
} // namespace panda::test
|
||||
} // namespace panda::test
|
||||
|
@ -133,7 +133,7 @@ HWTEST_F_L0(ContainersDequeTest, DequeConstructor)
|
||||
JSTaggedValue resultProto = JSTaggedValue::GetPrototype(thread, JSHandle<JSTaggedValue>(deque));
|
||||
JSTaggedValue funcProto = newTarget->GetFunctionPrototype();
|
||||
ASSERT_EQ(resultProto, funcProto);
|
||||
|
||||
|
||||
// test DequeConstructor exception
|
||||
objCallInfo->SetNewTarget(JSTaggedValue::Undefined());
|
||||
CONTAINERS_API_EXCEPTION_TEST(ContainersDeque, DequeConstructor, objCallInfo);
|
||||
|
@ -135,7 +135,7 @@ HWTEST_F_L0(ContainersHashMapTest, HashMapConstructor)
|
||||
ASSERT_EQ(resultProto, funcProto);
|
||||
int size = mapHandle->GetSize();
|
||||
ASSERT_EQ(size, 0);
|
||||
|
||||
|
||||
// test HashMapConstructor exception
|
||||
objCallInfo->SetNewTarget(JSTaggedValue::Undefined());
|
||||
CONTAINERS_API_EXCEPTION_TEST(ContainersHashMap, HashMapConstructor, objCallInfo);
|
||||
|
@ -114,7 +114,7 @@ HWTEST_F_L0(ContainersHashSetTest, HashSetConstructor)
|
||||
ASSERT_EQ(resultProto, funcProto);
|
||||
int size = setHandle->GetSize();
|
||||
ASSERT_EQ(size, 0);
|
||||
|
||||
|
||||
// test HashSetConstructor exception
|
||||
objCallInfo->SetNewTarget(JSTaggedValue::Undefined());
|
||||
CONTAINERS_API_EXCEPTION_TEST(ContainersHashSet, HashSetConstructor, objCallInfo);
|
||||
@ -447,4 +447,4 @@ HWTEST_F_L0(ContainersHashSetTest, ExceptionReturn)
|
||||
CONTAINERS_API_TYPE_MISMATCH_EXCEPTION_TEST(ContainersHashSet, IsEmpty);
|
||||
CONTAINERS_API_TYPE_MISMATCH_EXCEPTION_TEST(ContainersHashSet, ForEach);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
JSHandle<JSTaggedValue> value = GetCallArg(argv, 0);
|
||||
JSHandle<JSTaggedValue> key = GetCallArg(argv, 1);
|
||||
[[maybe_unused]] JSHandle<JSTaggedValue> map = GetCallArg(argv, 2); // 2 means the secode arg
|
||||
|
||||
|
||||
JSHandle<JSAPILightWeightMap> jsTreeMap(GetThis(argv));
|
||||
JSAPILightWeightMap::Set(thread, jsTreeMap, key, value);
|
||||
return JSTaggedValue::Undefined();
|
||||
|
@ -129,7 +129,7 @@ HWTEST_F_L0(ContainersLightWeightSetTest, LightWeightSetConstructor)
|
||||
ASSERT_EQ(resultProto, funcProto);
|
||||
int length = mapHandle->GetLength();
|
||||
ASSERT_EQ(length, 0); // 0 means the value
|
||||
|
||||
|
||||
// test LightWeightSetConstructor exception
|
||||
objCallInfo->SetNewTarget(JSTaggedValue::Undefined());
|
||||
CONTAINERS_API_EXCEPTION_TEST(ContainersLightWeightSet, LightWeightSetConstructor, objCallInfo);
|
||||
@ -283,7 +283,7 @@ HWTEST_F_L0(ContainersLightWeightSetTest, HasAllAndHas)
|
||||
TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); // 6 means the value
|
||||
callInfo->SetFunction(JSTaggedValue::Undefined());
|
||||
callInfo->SetThis(lwsFalse.GetTaggedValue());
|
||||
|
||||
|
||||
if (i == 2) {
|
||||
callInfo->SetCallArg(0, JSTaggedValue(i + 1 + 10));
|
||||
[[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, callInfo);
|
||||
@ -529,7 +529,7 @@ HWTEST_F_L0(ContainersLightWeightSetTest, ForEach)
|
||||
[[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, callInfo);
|
||||
JSTaggedValue result = ContainersLightWeightSet::GetValueAt(callInfo);
|
||||
TestHelper::TearDownFrame(thread, prev);
|
||||
|
||||
|
||||
callInfo =
|
||||
TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); // 6 means the value
|
||||
callInfo->SetFunction(JSTaggedValue::Undefined());
|
||||
@ -631,4 +631,4 @@ HWTEST_F_L0(ContainersLightWeightSetTest, ExceptionReturn2)
|
||||
CONTAINERS_API_EXCEPTION_TEST(ContainersLightWeightSet, RemoveAt, callInfo);
|
||||
}
|
||||
}
|
||||
} // namespace panda::test
|
||||
} // namespace panda::test
|
||||
|
@ -174,7 +174,7 @@ HWTEST_F_L0(ContainersLinkedListTest, LinkedListConstructor)
|
||||
ASSERT_EQ(resultProto, funcProto);
|
||||
int size = list->Length();
|
||||
ASSERT_EQ(size, 0);
|
||||
|
||||
|
||||
// test PlainArrayConstructor exception
|
||||
objCallInfo->SetNewTarget(JSTaggedValue::Undefined());
|
||||
CONTAINERS_API_EXCEPTION_TEST(ContainersLinkedList, LinkedListConstructor, objCallInfo);
|
||||
@ -204,7 +204,7 @@ HWTEST_F_L0(ContainersLinkedListTest, InsertAndGet)
|
||||
result = LinkedListInsert(linkedlist, JSTaggedValue(NODE_NUMBERS + 2), JSTaggedValue(10));
|
||||
EXPECT_EQ(result, JSTaggedValue::True());
|
||||
EXPECT_EQ(linkedlist->Length(), static_cast<int>(NODE_NUMBERS + 3));
|
||||
|
||||
|
||||
uint32_t length = static_cast<uint32_t>(linkedlist->Length());
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
if (i == 0) {
|
||||
|
@ -111,7 +111,7 @@ protected:
|
||||
JSHandle<JSAPIList> list(thread, result);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
JSTaggedValue ListAdd(JSHandle<JSAPIList> list, JSTaggedValue value)
|
||||
{
|
||||
auto callInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6);
|
||||
@ -274,7 +274,7 @@ HWTEST_F_L0(ContainersListTest, Equal)
|
||||
}
|
||||
result = ListEqual(list, list1);
|
||||
EXPECT_EQ(result, JSTaggedValue::True());
|
||||
|
||||
|
||||
// Length Not Equal
|
||||
JSHandle<JSAPIList> list2 = CreateJSAPIList();
|
||||
for (uint32_t i = 0; i < NODE_NUMBERS / 2; i++) {
|
||||
|
@ -12,7 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#include "ecmascript/containers/containers_plainarray.h"
|
||||
#include "ecmascript/containers/containers_private.h"
|
||||
#include "ecmascript/ecma_runtime_call_info.h"
|
||||
@ -68,7 +68,7 @@ public:
|
||||
JSHandle<JSTaggedValue> newValue(thread, JSTaggedValue(value->GetInt() * 2)); // 2 means the value
|
||||
JSAPIPlainArray::Add(thread, plainArray, key, newValue);
|
||||
}
|
||||
|
||||
|
||||
return JSTaggedValue::True();
|
||||
}
|
||||
};
|
||||
@ -164,7 +164,7 @@ HWTEST_F_L0(ContainersPlainArrayTest, PlainArrayConstructor)
|
||||
ASSERT_EQ(resultProto, funcProto);
|
||||
int size = arrayHandle->GetSize();
|
||||
ASSERT_EQ(size, 0);
|
||||
|
||||
|
||||
// test PlainArrayConstructor exception
|
||||
objCallInfo->SetNewTarget(JSTaggedValue::Undefined());
|
||||
CONTAINERS_API_EXCEPTION_TEST(ContainersPlainArray, PlainArrayConstructor, objCallInfo);
|
||||
@ -173,7 +173,7 @@ HWTEST_F_L0(ContainersPlainArrayTest, PlainArrayConstructor)
|
||||
HWTEST_F_L0(ContainersPlainArrayTest, AddAndHas)
|
||||
{
|
||||
constexpr uint32_t NODE_NUMBERS = 8; // 8 means the value
|
||||
|
||||
|
||||
JSHandle<JSAPIPlainArray> tArray1 = CreateJSAPIPlainArray();
|
||||
for (uint32_t i = 0; i < NODE_NUMBERS; i++) {
|
||||
auto callInfo =
|
||||
|
@ -79,5 +79,5 @@ using panda::ecmascript::EcmaRuntimeCallInfo;
|
||||
return callInfo;
|
||||
}
|
||||
} // namespace panda::test
|
||||
|
||||
#endif // ECMASCRIPT_TESTS_CONTAINERS_TEST_HELPER_H
|
||||
|
||||
#endif // ECMASCRIPT_TESTS_CONTAINERS_TEST_HELPER_H
|
||||
|
@ -176,7 +176,7 @@ HWTEST_F_L0(ContainersTreeMapTest, TreeMapConstructor)
|
||||
ASSERT_EQ(resultProto, funcProto);
|
||||
int size = mapHandle->GetSize();
|
||||
ASSERT_EQ(size, 0);
|
||||
|
||||
|
||||
// test TreeMapConstructor exception
|
||||
objCallInfo->SetCallArg(0, JSTaggedValue(0));
|
||||
CONTAINERS_API_EXCEPTION_TEST(ContainersTreeMap, TreeMapConstructor, objCallInfo);
|
||||
|
@ -112,7 +112,7 @@ public:
|
||||
{
|
||||
return defaultReadOnlySpaceSize_;
|
||||
}
|
||||
|
||||
|
||||
size_t GetDefaultNonMovableSpaceSize() const
|
||||
{
|
||||
return defaultNonMovableSpaceSize_;
|
||||
|
@ -42,7 +42,7 @@ EcmaString *EcmaString::Concat(const EcmaVM *vm,
|
||||
}
|
||||
|
||||
bool compressed = (strLeft->IsUtf8() && strRight->IsUtf8());
|
||||
|
||||
|
||||
// if the result string is small, make a LineString
|
||||
if (newLength < TreeEcmaString::MIN_TREE_ECMASTRING_LENGTH) {
|
||||
ASSERT(strLeft->IsLineString());
|
||||
|
@ -285,7 +285,7 @@ public:
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static inline JSTaggedValue ShlWithTSType(JSThread *thread, JSTaggedValue left,
|
||||
JSTaggedValue right, JSTaggedValue argType)
|
||||
{
|
||||
@ -373,4 +373,4 @@ public:
|
||||
};
|
||||
} // namespace panda::ecmascript
|
||||
|
||||
#endif // ECMASCRIPT_IC_IC_BINARY_OP_H_
|
||||
#endif // ECMASCRIPT_IC_IC_BINARY_OP_H_
|
||||
|
@ -285,7 +285,7 @@ HWTEST_F_L0(ProfileTypeInfoTest, AddGlobalHandlerKey)
|
||||
EXPECT_EQ(resultArr1->GetLength(), 2U);
|
||||
EXPECT_TRUE(resultArr1->Get(0).IsWeak());
|
||||
EXPECT_EQ(resultArr1->Get(1).GetInt(), 222);
|
||||
|
||||
|
||||
slotId = 1;
|
||||
ProfileTypeAccessor handleProfileTypeAccessor1(thread, handleProfileTypeInfo, slotId, ICKind::StoreIC);
|
||||
handleProfileTypeAccessor1.AddGlobalHandlerKey(arrayKey, HandlerValue);
|
||||
@ -312,7 +312,7 @@ HWTEST_F_L0(ProfileTypeInfoTest, AddGlobalRecordHandler)
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSTaggedValue> HandlerValue1(thread, JSTaggedValue(232));
|
||||
JSHandle<JSTaggedValue> HandlerValue2(thread, JSTaggedValue(5));
|
||||
|
||||
|
||||
JSHandle<TaggedArray> handleDetailsArray = factory->NewTaggedArray(2);
|
||||
JSHandle<ProfileTypeInfo> handleProfileTypeInfo = JSHandle<ProfileTypeInfo>::Cast(handleDetailsArray);
|
||||
uint32_t slotId = 0;
|
||||
@ -391,7 +391,7 @@ HWTEST_F_L0(ProfileTypeInfoTest, GetRefFromWeak)
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
JSHandle<JSTaggedValue> objFun = env->GetObjectFunction();
|
||||
|
||||
|
||||
JSHandle<JSObject> handleProfileTypeValue = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(objFun), objFun);
|
||||
JSTaggedValue handleProfileType(handleProfileTypeValue.GetTaggedValue());
|
||||
handleProfileType.CreateWeakRef();
|
||||
|
@ -95,7 +95,7 @@ HWTEST_F_L0(PropertiesCacheTest, Clear)
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> handleKey(factory->NewFromASCII("10"));
|
||||
JSHandle<JSTaggedValue> handleFunction(factory->NewJSFunction(env));
|
||||
JSHClass *FuncHClass = JSObject::Cast(handleFunction->GetTaggedObject())->GetJSHClass();
|
||||
|
@ -95,7 +95,7 @@ HWTEST_F_L0(ProtoChangeDetailsTest, SetChangeListener)
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSTaggedValue> handleValue(thread, JSTaggedValue(1));
|
||||
|
||||
|
||||
uint32_t weakVectorCapacity = 100;
|
||||
JSHandle<WeakVector> weakVector = WeakVector::Create(thread, weakVectorCapacity);
|
||||
JSHandle<ChangeListener> handleChangeListener = JSHandle<ChangeListener>::Cast(weakVector);
|
||||
@ -270,4 +270,4 @@ HWTEST_F_L0(ProtoChangeDetailsTest, Get)
|
||||
EXPECT_EQ(handleChangeListenerArr->Get(1).GetTaggedObject(), objValue.GetTaggedWeakRef());
|
||||
EXPECT_TRUE(handleChangeListenerArr->Get(2).IsUndefined());
|
||||
}
|
||||
} // namespace panda::test
|
||||
} // namespace panda::test
|
||||
|
@ -184,7 +184,7 @@ HWTEST_F_L0(MicroJobQueueTest, ExecutePendingJob_001)
|
||||
auto env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
JSHandle<JSFunction> promiseReactionsJob(env->GetPromiseReactionJob());
|
||||
JSHandle<MicroJobQueue> handleMicrojob = thread->GetEcmaVM()->GetMicroJobQueue();
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> promiseFunc = env->GetPromiseFunction();
|
||||
JSHandle<PromiseCapability> capbility = JSPromise::NewPromiseCapability(thread, promiseFunc);
|
||||
JSHandle<JSTaggedValue> resolve(thread, capbility->GetResolve());
|
||||
@ -227,7 +227,7 @@ HWTEST_F_L0(MicroJobQueueTest, ExecutePendingJob_002)
|
||||
auto env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
JSHandle<JSFunction> promiseReactionsJob(env->GetPromiseReactionJob());
|
||||
JSHandle<MicroJobQueue> handleMicrojob = thread->GetEcmaVM()->GetMicroJobQueue();
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> promiseFunc = env->GetPromiseFunction();
|
||||
JSHandle<PromiseCapability> capbility1 = JSPromise::NewPromiseCapability(thread, promiseFunc);
|
||||
JSHandle<JSTaggedValue> resolve(thread, capbility1->GetResolve());
|
||||
@ -264,4 +264,4 @@ HWTEST_F_L0(MicroJobQueueTest, ExecutePendingJob_002)
|
||||
EXPECT_EQ(rejectPromise->GetPromiseState(), PromiseState::REJECTED);
|
||||
EXPECT_EQ(JSTaggedValue::SameValue(rejectPromise->GetPromiseResult(), JSTaggedValue(32)), true);
|
||||
}
|
||||
} // namespace panda::test
|
||||
} // namespace panda::test
|
||||
|
@ -119,7 +119,7 @@ HWTEST_F_L0(PendingJobTest, ExecutePendingJob_001)
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
JSHandle<JSTaggedValue> promiseFunc = env->GetPromiseFunction();
|
||||
|
||||
|
||||
JSHandle<PromiseCapability> capbility = JSPromise::NewPromiseCapability(thread, promiseFunc);
|
||||
JSHandle<JSTaggedValue> reject(thread, capbility->GetReject());
|
||||
|
||||
@ -155,7 +155,7 @@ HWTEST_F_L0(PendingJobTest, ExecutePendingJob_002)
|
||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
JSHandle<JSTaggedValue> promiseFunc = env->GetPromiseFunction();
|
||||
JSHandle<JSTaggedValue> paramMsg(factory->NewFromASCII("resolve"));
|
||||
|
||||
|
||||
JSHandle<PromiseCapability> capbility = JSPromise::NewPromiseCapability(thread, promiseFunc);
|
||||
JSHandle<JSTaggedValue> resolve(thread, capbility->GetResolve());
|
||||
|
||||
@ -191,7 +191,7 @@ HWTEST_F_L0(PendingJobTest, ExecutePendingJob_003)
|
||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
JSHandle<JSTaggedValue> promiseFunc = env->GetPromiseFunction();
|
||||
JSHandle<JSTaggedValue> paramMsg(factory->NewFromASCII("Thrower"));
|
||||
|
||||
|
||||
JSHandle<PromiseCapability> capbility = JSPromise::NewPromiseCapability(thread, promiseFunc);
|
||||
JSHandle<PromiseReaction> rejectReaction = factory->NewPromiseReaction();
|
||||
rejectReaction->SetPromiseCapability(thread, capbility.GetTaggedValue());
|
||||
@ -237,7 +237,7 @@ HWTEST_F_L0(PendingJobTest, ExecutePendingJob_004)
|
||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
JSHandle<JSTaggedValue> promiseFunc = env->GetPromiseFunction();
|
||||
JSHandle<JSTaggedValue> paramMsg(factory->NewFromASCII("after_resolve"));
|
||||
|
||||
|
||||
JSHandle<PromiseCapability> capbility = JSPromise::NewPromiseCapability(thread, promiseFunc);
|
||||
JSHandle<JSTaggedValue> resolve(thread, capbility->GetResolve());
|
||||
|
||||
|
@ -187,7 +187,7 @@ bool JSAPIArrayList::RemoveByIndex(JSThread *thread, const JSHandle<JSAPIArrayLi
|
||||
for (int i = index; i <= length - 2; i++) { // 2 : 2 get index of (lastElementIndex - 1)
|
||||
elements->Set(thread, i, elements->Get(i + 1));
|
||||
}
|
||||
|
||||
|
||||
arrayList->SetLength(thread, JSTaggedValue(--length));
|
||||
return true;
|
||||
}
|
||||
@ -243,7 +243,7 @@ JSTaggedValue JSAPIArrayList::RemoveByRange(JSThread *thread, const JSHandle<JSA
|
||||
for (int32_t i = 0; i <= numMoved; i++) {
|
||||
elements->Set(thread, startIndex + i, elements->Get(static_cast<uint32_t>(toIndex + i)));
|
||||
}
|
||||
|
||||
|
||||
int32_t newLength = length - (toIndex - startIndex);
|
||||
arrayList->SetLength(thread, JSTaggedValue(newLength));
|
||||
return JSTaggedValue::True();
|
||||
@ -271,7 +271,7 @@ JSTaggedValue JSAPIArrayList::ReplaceAllElements(JSThread *thread, const JSHandl
|
||||
|
||||
arrayList->Set(thread, k, funcResult);
|
||||
}
|
||||
|
||||
|
||||
return JSTaggedValue::Undefined();
|
||||
}
|
||||
|
||||
@ -323,7 +323,7 @@ JSTaggedValue JSAPIArrayList::SubArrayList(JSThread *thread, const JSHandle<JSAP
|
||||
JSHandle<TaggedArray> elements(thread, arrayList->GetElements());
|
||||
ASSERT(!elements->IsDictionaryMode());
|
||||
subArrayList->SetLength(thread, JSTaggedValue(newLength));
|
||||
|
||||
|
||||
for (int i = 0; i < newLength; i++) {
|
||||
subArrayList->Set(thread, i, elements->Get(fromIndex + i));
|
||||
}
|
||||
@ -382,7 +382,7 @@ bool JSAPIArrayList::Has(const JSTaggedValue value) const
|
||||
if (length == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
for (int32_t i = 0; i < length; i++) {
|
||||
if (JSTaggedValue::SameValue(elements->Get(i), value)) {
|
||||
return true;
|
||||
|
@ -77,7 +77,7 @@ JSTaggedValue JSAPIDeque::GetFront()
|
||||
if (JSAPIDeque::IsEmpty()) {
|
||||
return JSTaggedValue::Undefined();
|
||||
}
|
||||
|
||||
|
||||
TaggedArray *elements = TaggedArray::Cast(GetElements().GetTaggedObject());
|
||||
ASSERT(!elements->IsDictionaryMode());
|
||||
return elements->Get(GetFirst());
|
||||
@ -201,7 +201,7 @@ bool JSAPIDeque::Has(JSTaggedValue value) const
|
||||
JSHandle<TaggedArray> JSAPIDeque::OwnKeys(JSThread *thread, const JSHandle<JSAPIDeque> &deque)
|
||||
{
|
||||
uint32_t length = deque->GetSize();
|
||||
|
||||
|
||||
JSHandle<TaggedArray> oldElements(thread, deque->GetElements());
|
||||
ASSERT(!oldElements->IsDictionaryMode());
|
||||
uint32_t oldCapacity = oldElements->GetLength();
|
||||
@ -220,7 +220,7 @@ JSHandle<TaggedArray> JSAPIDeque::OwnKeys(JSThread *thread, const JSHandle<JSAPI
|
||||
JSHandle<TaggedArray> JSAPIDeque::OwnEnumKeys(JSThread *thread, const JSHandle<JSAPIDeque> &deque)
|
||||
{
|
||||
uint32_t length = deque->GetSize();
|
||||
|
||||
|
||||
JSHandle<TaggedArray> oldElements(thread, deque->GetElements());
|
||||
ASSERT(!oldElements->IsDictionaryMode());
|
||||
uint32_t oldCapacity = oldElements->GetLength();
|
||||
|
@ -40,13 +40,13 @@ public:
|
||||
}
|
||||
|
||||
static void InsertFront(JSThread *thread, const JSHandle<JSAPIDeque> &deque, const JSHandle<JSTaggedValue> &value);
|
||||
|
||||
|
||||
static void InsertEnd(JSThread *thread, const JSHandle<JSAPIDeque> &deque, const JSHandle<JSTaggedValue> &value);
|
||||
|
||||
static JSTaggedValue ForEach(JSThread *thread, const JSHandle<JSAPIDeque> &deque);
|
||||
|
||||
static JSTaggedValue GetIteratorObj(JSThread *thread, const JSHandle<JSAPIDeque> &deque);
|
||||
|
||||
|
||||
static JSHandle<TaggedArray> OwnKeys(JSThread *thread, const JSHandle<JSAPIDeque> &deque);
|
||||
|
||||
static JSHandle<TaggedArray> OwnEnumKeys(JSThread *thread, const JSHandle<JSAPIDeque> &deque);
|
||||
@ -68,7 +68,7 @@ public:
|
||||
JSTaggedValue Get(const uint32_t index);
|
||||
|
||||
JSTaggedValue Set(JSThread *thread, const uint32_t index, JSTaggedValue value);
|
||||
|
||||
|
||||
uint32_t GetSize() const;
|
||||
|
||||
bool Has(JSTaggedValue value) const;
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
ASSERT(JSTaggedValue(object).IsJSAPIHashMap());
|
||||
return static_cast<JSAPIHashMap *>(object);
|
||||
}
|
||||
|
||||
|
||||
static void Set(JSThread *thread, JSHandle<JSAPIHashMap> hashMap,
|
||||
JSHandle<JSTaggedValue> key, JSHandle<JSTaggedValue> value);
|
||||
static JSTaggedValue HasValue(JSThread *thread, JSHandle<JSAPIHashMap> hashMap,
|
||||
@ -45,7 +45,7 @@ public:
|
||||
{
|
||||
return JSTaggedValue(GetSize());
|
||||
}
|
||||
|
||||
|
||||
static constexpr size_t HASHMAP_TABLE_INDEX = JSObject::SIZE;
|
||||
ACCESSORS(Table, HASHMAP_TABLE_INDEX, HASHMAP_SIZE_OFFSET);
|
||||
ACCESSORS_PRIMITIVE_FIELD(Size, uint32_t, HASHMAP_SIZE_OFFSET, LAST_OFFSET)
|
||||
@ -61,4 +61,4 @@ private:
|
||||
static bool HasValueRBTreeNode(JSTaggedValue node, JSTaggedValue value);
|
||||
};
|
||||
} // namespace panda::ecmascript
|
||||
#endif // ECMASCRIPT_JS_API_HASHMAP_H
|
||||
#endif // ECMASCRIPT_JS_API_HASHMAP_H
|
||||
|
@ -12,7 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#include "ecmascript/js_api/js_api_lightweightset.h"
|
||||
|
||||
#include "ecmascript/containers/containers_errors.h"
|
||||
@ -163,7 +163,7 @@ void JSAPILightWeightSet::SizeCopy(const JSThread *thread, const JSHandle<JSAPIL
|
||||
JSHandle<TaggedArray> valueArray(thread, obj->GetValues());
|
||||
hashArray = thread->GetEcmaVM()->GetFactory()->CopyArray(hashArray, capacity, newCapacity);
|
||||
valueArray = thread->GetEcmaVM()->GetFactory()->CopyArray(valueArray, capacity, newCapacity);
|
||||
|
||||
|
||||
obj->SetValues(thread, hashArray);
|
||||
obj->SetHashes(thread, valueArray);
|
||||
}
|
||||
@ -398,7 +398,7 @@ JSTaggedValue JSAPILightWeightSet::ToString(JSThread *thread, const JSHandle<JSA
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
std::u16string sepStr = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> {}.from_bytes(",");
|
||||
|
||||
|
||||
uint32_t length = obj->GetSize();
|
||||
JSHandle<TaggedArray> valueArray(thread, obj->GetValues());
|
||||
std::u16string concatStr;
|
||||
@ -465,4 +465,4 @@ uint32_t JSAPILightWeightSet::Hash(JSTaggedValue key)
|
||||
uint64_t keyValue = key.GetRawData();
|
||||
return GetHash32(reinterpret_cast<uint8_t *>(&keyValue), sizeof(keyValue) / sizeof(uint8_t));
|
||||
}
|
||||
} // namespace panda::ecmascript
|
||||
} // namespace panda::ecmascript
|
||||
|
@ -12,7 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#include "ecmascript/js_api/js_api_lightweightset_iterator.h"
|
||||
|
||||
#include "ecmascript/base/typed_array_helper-inl.h"
|
||||
@ -73,4 +73,4 @@ JSTaggedValue JSAPILightWeightSetIterator::Next(EcmaRuntimeCallInfo *argv)
|
||||
JSHandle<JSTaggedValue> keyAndValue(JSArray::CreateArrayFromList(thread, array));
|
||||
return JSIterator::CreateIterResultObject(thread, keyAndValue, false).GetTaggedValue();
|
||||
}
|
||||
} // namespace panda::ecmascript
|
||||
} // namespace panda::ecmascript
|
||||
|
@ -270,7 +270,7 @@ OperationResult JSAPILinkedList::GetProperty(JSThread *thread, const JSHandle<JS
|
||||
JSTaggedValue::Exception(),
|
||||
PropertyMetaData(false)));
|
||||
}
|
||||
|
||||
|
||||
return OperationResult(thread, doubleList->Get(index), PropertyMetaData(false));
|
||||
}
|
||||
|
||||
|
@ -253,7 +253,7 @@ OperationResult JSAPIList::GetProperty(JSThread *thread, const JSHandle<JSAPILis
|
||||
JSTaggedValue::Exception(),
|
||||
PropertyMetaData(false)));
|
||||
}
|
||||
|
||||
|
||||
return OperationResult(thread, singleList->Get(index), PropertyMetaData(false));
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#include "ecmascript/js_api/js_api_plain_array.h"
|
||||
|
||||
#include "ecmascript/containers/containers_errors.h"
|
||||
@ -197,7 +197,7 @@ OperationResult JSAPIPlainArray::GetProperty(JSThread *thread, const JSHandle<JS
|
||||
JSTaggedValue::Exception(),
|
||||
PropertyMetaData(false)));
|
||||
}
|
||||
|
||||
|
||||
return OperationResult(thread, obj->Get(JSTaggedValue(index)), PropertyMetaData(false));
|
||||
}
|
||||
|
||||
@ -227,7 +227,7 @@ JSHandle<JSAPIPlainArray> JSAPIPlainArray::Clone(JSThread *thread, const JSHandl
|
||||
newPlainArray->SetLength(length);
|
||||
JSHandle<TaggedArray> srcKeyArray(thread, obj->GetKeys());
|
||||
JSHandle<TaggedArray> srcValueArray(thread, obj->GetValues());
|
||||
|
||||
|
||||
JSHandle<TaggedArray> dstKeyArray = factory->NewAndCopyTaggedArray(srcKeyArray, length, length);
|
||||
JSHandle<TaggedArray> dstValueArray = factory->NewAndCopyTaggedArray(srcValueArray, length, length);
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#include "ecmascript/js_api/js_api_plain_array_iterator.h"
|
||||
|
||||
#include "ecmascript/base/typed_array_helper.h"
|
||||
@ -45,7 +45,7 @@ JSTaggedValue JSAPIPlainArrayIterator::Next(EcmaRuntimeCallInfo *argv)
|
||||
if (plainArray->IsUndefined()) {
|
||||
return JSIterator::CreateIterResultObject(thread, undefinedHandle, true).GetTaggedValue();
|
||||
}
|
||||
|
||||
|
||||
JSHandle<JSAPIPlainArray> apiPlainArray(plainArray);
|
||||
ASSERT(plainArray->IsJSAPIPlainArray());
|
||||
|
||||
|
@ -31,7 +31,7 @@ void JSAPIQueue::Add(JSThread *thread, const JSHandle<JSAPIQueue> &queue, const
|
||||
|
||||
ASSERT(!elements->IsDictionaryMode());
|
||||
uint32_t tail = queue->GetTail();
|
||||
|
||||
|
||||
elements->Set(thread, tail, value);
|
||||
queue->SetLength(thread, JSTaggedValue(++length));
|
||||
|
||||
@ -157,7 +157,7 @@ bool JSAPIQueue::Has(JSTaggedValue value) const
|
||||
JSHandle<TaggedArray> JSAPIQueue::OwnKeys(JSThread *thread, const JSHandle<JSAPIQueue> &obj)
|
||||
{
|
||||
uint32_t length = obj->GetLength().GetArrayLength();
|
||||
|
||||
|
||||
JSHandle<TaggedArray> oldElements(thread, obj->GetElements());
|
||||
ASSERT(!oldElements->IsDictionaryMode());
|
||||
uint32_t oldCapacity = oldElements->GetLength();
|
||||
@ -176,7 +176,7 @@ JSHandle<TaggedArray> JSAPIQueue::OwnKeys(JSThread *thread, const JSHandle<JSAPI
|
||||
JSHandle<TaggedArray> JSAPIQueue::OwnEnumKeys(JSThread *thread, const JSHandle<JSAPIQueue> &obj)
|
||||
{
|
||||
uint32_t length = obj->GetLength().GetArrayLength();
|
||||
|
||||
|
||||
JSHandle<TaggedArray> oldElements(thread, obj->GetElements());
|
||||
ASSERT(!oldElements->IsDictionaryMode());
|
||||
uint32_t oldCapacity = oldElements->GetLength();
|
||||
@ -233,7 +233,7 @@ OperationResult JSAPIQueue::GetProperty(JSThread *thread, const JSHandle<JSAPIQu
|
||||
JSTaggedValue::Exception(),
|
||||
PropertyMetaData(false)));
|
||||
}
|
||||
|
||||
|
||||
return OperationResult(thread, obj->Get(thread, index), PropertyMetaData(false));
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ JSTaggedValue JSAPIQueueIterator::Next(EcmaRuntimeCallInfo *argv)
|
||||
if (queue->IsUndefined()) {
|
||||
return globalConst->GetUndefinedIterResult();
|
||||
}
|
||||
|
||||
|
||||
uint32_t index = iter->GetNextIndex();
|
||||
uint32_t length = JSAPIQueue::GetArrayLength(thread, JSHandle<JSAPIQueue>(queue));
|
||||
if (index >= length) {
|
||||
|
@ -117,7 +117,7 @@ bool JSAPIStack::Has(JSTaggedValue value) const
|
||||
if (top == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < top + 1; i++) {
|
||||
if (JSTaggedValue::SameValue(elements->Get(i), value)) {
|
||||
return true;
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
JSTaggedValue Get(const uint32_t index);
|
||||
|
||||
JSTaggedValue Set(JSThread *thread, const uint32_t index, JSTaggedValue value);
|
||||
|
||||
|
||||
static constexpr size_t TOP_OFFSET = JSObject::SIZE;
|
||||
ACCESSORS_PRIMITIVE_FIELD(Top, int, TOP_OFFSET, LAST_OFFSET)
|
||||
DEFINE_ALIGN_SIZE(LAST_OFFSET);
|
||||
|
@ -12,7 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ECMASCRIPT_JS_API_STACK_ITERATOR_H
|
||||
#define ECMASCRIPT_JS_API_STACK_ITERATOR_H
|
||||
|
||||
|
@ -215,7 +215,7 @@ JSTaggedValue JSAPIVector::RemoveByRange(JSThread *thread, const JSHandle<JSAPIV
|
||||
THROW_RANGE_ERROR_AND_RETURN(thread, "the fromIndex or the toIndex is out-of-bounds",
|
||||
JSTaggedValue::Exception());
|
||||
}
|
||||
|
||||
|
||||
int32_t endIndex = toIndex >= length ? length : toIndex;
|
||||
TaggedArray *elements = TaggedArray::Cast(vector->GetElements().GetTaggedObject());
|
||||
ASSERT(!elements->IsDictionaryMode());
|
||||
@ -223,7 +223,7 @@ JSTaggedValue JSAPIVector::RemoveByRange(JSThread *thread, const JSHandle<JSAPIV
|
||||
for (int32_t i = 0; i < numMoved; i++) {
|
||||
elements->Set(thread, fromIndex + i, elements->Get(endIndex + i));
|
||||
}
|
||||
|
||||
|
||||
int32_t newLength = length - (endIndex - fromIndex);
|
||||
vector->SetLength(newLength);
|
||||
return JSTaggedValue::True();
|
||||
@ -337,7 +337,7 @@ JSTaggedValue JSAPIVector::ReplaceAllElements(JSThread *thread, const JSHandle<J
|
||||
}
|
||||
vector->Set(thread, k, funcResult);
|
||||
}
|
||||
|
||||
|
||||
return JSTaggedValue::Undefined();
|
||||
}
|
||||
|
||||
@ -389,7 +389,7 @@ bool JSAPIVector::Has(const JSTaggedValue &value) const
|
||||
if (length == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
for (int32_t i = 0; i < length; i++) {
|
||||
if (JSTaggedValue::SameValue(elements->Get(i), value)) {
|
||||
return true;
|
||||
@ -506,4 +506,4 @@ bool JSAPIVector::SetProperty(JSThread *thread, const JSHandle<JSAPIVector> &obj
|
||||
obj->Set(thread, index, value.GetTaggedValue());
|
||||
return true;
|
||||
}
|
||||
} // namespace panda::ecmascript
|
||||
} // namespace panda::ecmascript
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
const JSHandle<JSTaggedValue> &value, int32_t index);
|
||||
|
||||
static void SetLength(JSThread *thread, const JSHandle<JSAPIVector> &vector, uint32_t newSize);
|
||||
|
||||
|
||||
uint32_t GetCapacity();
|
||||
|
||||
static void IncreaseCapacityTo(JSThread *thread, const JSHandle<JSAPIVector> &vector, int32_t newCapacity);
|
||||
@ -45,7 +45,7 @@ public:
|
||||
|
||||
static int32_t GetIndexFrom(JSThread *thread, const JSHandle<JSAPIVector> &vector,
|
||||
const JSHandle<JSTaggedValue> &obj, int32_t index);
|
||||
|
||||
|
||||
bool IsEmpty() const;
|
||||
|
||||
JSTaggedValue GetLastElement();
|
||||
@ -81,7 +81,7 @@ public:
|
||||
JSTaggedValue Set(JSThread *thread, int32_t index, const JSTaggedValue &value);
|
||||
|
||||
bool Has(const JSTaggedValue &value) const;
|
||||
|
||||
|
||||
static JSHandle<TaggedArray> OwnKeys(JSThread *thread, const JSHandle<JSAPIVector> &obj);
|
||||
static JSHandle<TaggedArray> OwnEnumKeys(JSThread *thread, const JSHandle<JSAPIVector> &obj);
|
||||
static bool GetOwnProperty(JSThread *thread, const JSHandle<JSAPIVector> &obj, const JSHandle<JSTaggedValue> &key);
|
||||
@ -119,4 +119,4 @@ private:
|
||||
};
|
||||
} // namespace panda::ecmascript
|
||||
|
||||
#endif // ECMASCRIPT_JSAPIVECTOR_H
|
||||
#endif // ECMASCRIPT_JSAPIVECTOR_H
|
||||
|
@ -274,7 +274,7 @@ JSTaggedValue JSAsyncGeneratorObject::AsyncGeneratorEnqueue(JSThread *thread, co
|
||||
// 5. Let request be AsyncGeneratorRequest { [[Completion]]: completion, [[Capability]]: promiseCapability }.
|
||||
ObjectFactory *fty = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<AsyncGeneratorRequest> asyncGeneratorRst = fty->NewAsyncGeneratorRequest();
|
||||
|
||||
|
||||
asyncGeneratorRst->SetCompletion(thread, completionRecord);
|
||||
asyncGeneratorRst->SetCapability(thread, pcap);
|
||||
// 6. Append request to the end of queue.
|
||||
@ -329,7 +329,7 @@ JSTaggedValue JSAsyncGeneratorObject::ProcessorFulfilledFunc(EcmaRuntimeCallInfo
|
||||
JSHandle<JSAsyncGeneratorResNextRetProRstFtn> asyncResNextRtnPro =
|
||||
JSHandle<JSAsyncGeneratorResNextRetProRstFtn>::Cast(base::BuiltinsBase::GetConstructor(argv));
|
||||
JSHandle<JSAsyncGeneratorObject> asyncGen(thread, asyncResNextRtnPro->GetAsyncGeneratorObject());
|
||||
|
||||
|
||||
// 2. Set F.[[Generator]].[[AsyncGeneratorState]] to completed.
|
||||
asyncGen->SetAsyncGeneratorState(JSAsyncGeneratorState::COMPLETED);
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ECMASCRIPT_JS_ASYNC_GENERATOR_OBJECT_H
|
||||
#define ECMASCRIPT_JS_ASYNC_GENERATOR_OBJECT_H
|
||||
|
||||
@ -97,7 +97,7 @@ public:
|
||||
static JSTaggedValue ProcessorFulfilledFunc(EcmaRuntimeCallInfo *argv);
|
||||
|
||||
static JSTaggedValue ProcessorRejectedFunc(EcmaRuntimeCallInfo *argv);
|
||||
|
||||
|
||||
inline bool IsSuspendYield() const
|
||||
{
|
||||
return GetAsyncGeneratorState() == JSAsyncGeneratorState::SUSPENDED_YIELD;
|
||||
|
@ -171,7 +171,7 @@ HWTEST_F_L0(JSPandaFileExecutorTest, NormalizePath)
|
||||
{
|
||||
CString res1 = "node_modules/0/moduleTest/index";
|
||||
CString moduleRecordName1 = "node_modules///0//moduleTest/index";
|
||||
|
||||
|
||||
CString res2 = "./node_modules/0/moduleTest/index";
|
||||
CString moduleRecordName2 = "./node_modules///0//moduleTest/index";
|
||||
|
||||
|
@ -253,7 +253,7 @@ HWTEST_F_L0(DFXJSNApiTests, Start_Stop_RuntimeStat)
|
||||
|
||||
DFXJSNApi::StartRuntimeStat(vm_);
|
||||
EXPECT_TRUE(ecmaRuntimeStat->IsRuntimeStatEnabled());
|
||||
|
||||
|
||||
DFXJSNApi::StopRuntimeStat(vm_);
|
||||
EXPECT_TRUE(!ecmaRuntimeStat->IsRuntimeStatEnabled());
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ public:
|
||||
JSHandle<JSArguments> NewJSArguments();
|
||||
|
||||
JSHandle<JSPrimitiveRef> NewJSString(const JSHandle<JSTaggedValue> &str);
|
||||
|
||||
|
||||
template <typename Derived>
|
||||
JSHandle<TaggedArray> ConvertListToArray(const JSThread *thread, const JSHandle<Derived> &list,
|
||||
uint32_t numberOfNodes)
|
||||
|
@ -122,7 +122,7 @@ public:
|
||||
{
|
||||
return groupNames_.size_;
|
||||
}
|
||||
|
||||
|
||||
inline bool IsError() const
|
||||
{
|
||||
return isError_;
|
||||
|
@ -73,7 +73,7 @@ HWTEST_F_L0(CjsManagerTest, InitializeCommonJS)
|
||||
JSTaggedValue exportsVal =
|
||||
SlowRuntimeStub::LdObjByName(thread, module.GetTaggedValue(),
|
||||
exportsKey.GetTaggedValue(), false, JSTaggedValue::Undefined());
|
||||
|
||||
|
||||
EXPECT_EQ(JSTaggedValue::SameValue(exportsVal, JSTaggedValue::Hole()), false);
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
void Initialize();
|
||||
|
||||
void Iterate(const RootVisitor &v);
|
||||
|
||||
|
||||
void ClearEnvMap()
|
||||
{
|
||||
objectVector_.clear();
|
||||
@ -56,7 +56,7 @@ public:
|
||||
}
|
||||
|
||||
static constexpr size_t MAX_UINT_32 = 0xFFFFFFFF;
|
||||
|
||||
|
||||
private:
|
||||
NO_MOVE_SEMANTIC(SnapshotEnv);
|
||||
NO_COPY_SEMANTIC(SnapshotEnv);
|
||||
@ -71,4 +71,4 @@ private:
|
||||
CVector<uintptr_t> objectVector_;
|
||||
};
|
||||
} // namespace panda::ecmascript
|
||||
#endif // ECMASCRIPT_SNAPSHOT_MEM_SNAPSHOT_ENV_H
|
||||
#endif // ECMASCRIPT_SNAPSHOT_MEM_SNAPSHOT_ENV_H
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
{
|
||||
return !key.IsHole();
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
static void TreeingBin(JSThread *thread, const JSHandle<TaggedHashArray> &tab, int hash);
|
||||
static void NodeDisperse(JSThread *thread, const JSHandle<TaggedHashArray> &newTab,
|
||||
|
@ -83,7 +83,7 @@ JSTaggedValue TaggedList<Derived>::AddNode(const JSThread *thread, const JSHandl
|
||||
int deleteNodeLength = list->NumberOfDeletedNodes();
|
||||
int nodeLength = list->NumberOfNodes();
|
||||
int finalDataIndex = ELEMENTS_START_INDEX + (nodeLength + 1 + deleteNodeLength) * Derived::ENTRY_SIZE;
|
||||
|
||||
|
||||
list->InsertNode(thread, value, prevDataIndex, finalDataIndex);
|
||||
if (index == -1 || nodeLength == index) {
|
||||
list->SetElement(thread, TAIL_TABLE_INDEX, JSTaggedValue(finalDataIndex));
|
||||
@ -113,7 +113,7 @@ template <typename Derived>
|
||||
JSTaggedValue TaggedList<Derived>::TaggedListToArray(const JSThread *thread, const JSHandle<Derived> &list)
|
||||
{
|
||||
uint32_t numberOfNodes = static_cast<uint32_t>(list->NumberOfNodes());
|
||||
|
||||
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSArray> array = factory->NewJSArray();
|
||||
array->SetArrayLength(thread, numberOfNodes);
|
||||
@ -414,7 +414,7 @@ JSTaggedValue TaggedSingleList::Sort(JSThread *thread, const JSHandle<JSTaggedVa
|
||||
// create index map
|
||||
std::vector<int> nodeIndexMapToDataIndex(length, 0);
|
||||
taggedList->MapNodeIndexToDataIndex(nodeIndexMapToDataIndex, length);
|
||||
|
||||
|
||||
int beginIndex = 0;
|
||||
int endIndex = 0;
|
||||
int middleIndex = 0;
|
||||
@ -443,7 +443,7 @@ JSTaggedValue TaggedSingleList::Sort(JSThread *thread, const JSHandle<JSTaggedVa
|
||||
taggedList->SetElement(thread, nodeIndexMapToDataIndex[endIndex], presentValue.GetTaggedValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return JSTaggedValue::Undefined();
|
||||
}
|
||||
|
||||
@ -762,4 +762,4 @@ int TaggedDoubleList::FindPrevNodeByValueAtLast(const JSTaggedValue &element)
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
} // namespace panda::ecmascript
|
||||
} // namespace panda::ecmascript
|
||||
|
@ -128,7 +128,7 @@ public:
|
||||
{
|
||||
return static_cast<TaggedSingleList *>(obj);
|
||||
}
|
||||
|
||||
|
||||
static JSTaggedValue Create(const JSThread *thread, int numberOfElements = TaggedSingleList::DEFAULT_ARRAY_LENGHT);
|
||||
static JSTaggedValue Add(const JSThread *thread, const JSHandle<TaggedSingleList> &taggedList,
|
||||
const JSHandle<JSTaggedValue> &value);
|
||||
@ -205,4 +205,4 @@ protected:
|
||||
inline JSTaggedValue FindElementByIndexAtLast(int index) const;
|
||||
};
|
||||
} // namespace panda::ecmascript
|
||||
#endif // ECMASCRIPT_TAGGED_LIST_H
|
||||
#endif // ECMASCRIPT_TAGGED_LIST_H
|
||||
|
@ -113,7 +113,7 @@ public:
|
||||
{
|
||||
Set(thread, NUMBER_OF_ELEMENTS_INDEX, JSTaggedValue(num));
|
||||
}
|
||||
|
||||
|
||||
inline void SetNumberOfDeletedElements(const JSThread *thread, int num)
|
||||
{
|
||||
Set(thread, NUMBER_OF_HOLE_ENTRIES_INDEX, JSTaggedValue(num));
|
||||
|
@ -1725,7 +1725,7 @@ HWTEST_F_L0(EcmaStringAccessorTest, TryToLower)
|
||||
EXPECT_TRUE(EcmaStringAccessor(lowerEcmaString).IsUtf8());
|
||||
EXPECT_FALSE(EcmaStringAccessor(lowerEcmaString).IsUtf16());
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
JSHandle<EcmaString> lowerEcmaString(thread, EcmaStringAccessor::TryToLower(ecmaVMPtr, upperStr));
|
||||
EXPECT_TRUE(JSTaggedValue::SameValue(lowerStr.GetTaggedValue(), lowerEcmaString.GetTaggedValue()));
|
||||
@ -1750,4 +1750,4 @@ HWTEST_F_L0(EcmaStringAccessorTest, TryToLower)
|
||||
EXPECT_FALSE(EcmaStringAccessor(testEcmaString).IsUtf16());
|
||||
}
|
||||
}
|
||||
} // namespace panda::test
|
||||
} // namespace panda::test
|
||||
|
@ -186,7 +186,7 @@ HWTEST_F_L0(GCTest, NativeBindingCheckGCTest)
|
||||
size_t newNativeSize = heap->GetNativeBindingSize();
|
||||
{
|
||||
[[maybe_unused]] ecmascript::EcmaHandleScope baseScope(thread);
|
||||
|
||||
|
||||
auto newData = thread->GetEcmaVM()->GetNativeAreaAllocator()->AllocateBuffer(1 * 1024 * 1024);
|
||||
[[maybe_unused]] JSHandle<JSNativePointer> obj = factory->NewJSNativePointer(newData,
|
||||
NativeAreaAllocator::FreeBufferFunc, nullptr, false, 1 * 1024 * 1024);
|
||||
@ -196,7 +196,7 @@ HWTEST_F_L0(GCTest, NativeBindingCheckGCTest)
|
||||
auto newData1 = thread->GetEcmaVM()->GetNativeAreaAllocator()->AllocateBuffer(1 * 1024 * 1024);
|
||||
[[maybe_unused]] JSHandle<JSNativePointer> obj2 = factory->NewJSNativePointer(newData1,
|
||||
NativeAreaAllocator::FreeBufferFunc, nullptr, false, 1 * 1024 * 1024);
|
||||
|
||||
|
||||
EXPECT_TRUE(newNativeSize - oldNativeSize > 0);
|
||||
EXPECT_TRUE(newNativeSize - oldNativeSize <= 2 * 1024 *1024);
|
||||
for (int i = 0; i < 20; i++) {
|
||||
|
@ -157,7 +157,7 @@ HWTEST_F_L0(JSAPIArrayListTest, Insert)
|
||||
EXPECT_EQ(elements->Get(i), JSTaggedValue((i - insertNums) * 10));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// throw error
|
||||
// index < 0
|
||||
JSHandle<JSTaggedValue> zeroValue(thread, JSTaggedValue(0));
|
||||
@ -245,7 +245,7 @@ HWTEST_F_L0(JSAPIArrayListTest, GetCapacity_IncreaseCapacityTo)
|
||||
growCapacityTimes++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Expand capacity to a specified capacity value
|
||||
uint32_t newCapacity = JSAPIArrayList::GetCapacity(thread, arrayList);
|
||||
EXPECT_EQ(newCapacity, currentCapacity);
|
||||
@ -429,7 +429,7 @@ HWTEST_F_L0(JSAPIArrayListTest, RemoveByRange)
|
||||
// endIndex <= startIndex
|
||||
JSAPIArrayList::RemoveByRange(thread, arrayList, zeroIndexValue, zeroIndexValue);
|
||||
EXPECT_EXCEPTION();
|
||||
|
||||
|
||||
// endIndex < 0
|
||||
JSAPIArrayList::RemoveByRange(thread, arrayList, zeroIndexValue, smallIndexValue);
|
||||
EXPECT_EXCEPTION();
|
||||
@ -713,4 +713,4 @@ HWTEST_F_L0(JSAPIArrayListTest, SetProperty)
|
||||
JSHandle<JSTaggedValue> key1(thread, JSTaggedValue(elementsNums));
|
||||
EXPECT_FALSE(JSAPIArrayList::SetProperty(thread, arrayList, key1, value));
|
||||
}
|
||||
} // namespace panda::test
|
||||
} // namespace panda::test
|
||||
|
@ -133,7 +133,7 @@ HWTEST_F_L0(JSAPIDequeIteratorTest, SpecialReturnOfNext)
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSAPIDequeIterator> dequeIterator = factory->NewJSAPIDequeIterator(jsDeque);
|
||||
dequeIterator->SetIteratedDeque(thread, JSTaggedValue::Undefined());
|
||||
|
||||
|
||||
// test Next exception
|
||||
{
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4);
|
||||
@ -223,4 +223,4 @@ HWTEST_F_L0(JSAPIDequeIteratorTest, SetNextIndex)
|
||||
EXPECT_EQ(dequeIterator->GetNextIndex(), i);
|
||||
}
|
||||
}
|
||||
} // namespace panda::test
|
||||
} // namespace panda::test
|
||||
|
@ -272,7 +272,7 @@ HWTEST_F_L0(JSAPIDequeTest, OwnKeys)
|
||||
JSHandle<JSTaggedValue> value(thread, JSTaggedValue(i));
|
||||
JSAPIDeque::InsertEnd(thread, toor, value);
|
||||
}
|
||||
|
||||
|
||||
// test OwnKeys
|
||||
JSHandle<TaggedArray> keyArray = JSAPIDeque::OwnKeys(thread, toor);
|
||||
EXPECT_TRUE(keyArray->GetClass()->IsTaggedArray());
|
||||
|
@ -100,7 +100,7 @@ HWTEST_F_L0(JSAPIHashMapIteratorTest, SpecailReturnOfNextCreateHashMapIterator)
|
||||
JSHandle<JSAPIHashMapIterator> hashMapIterator = factory->NewJSAPIHashMapIterator(
|
||||
jsHashMap, IterationKind::KEY_AND_VALUE);
|
||||
hashMapIterator->SetIteratedHashMap(thread, JSTaggedValue::Undefined());
|
||||
|
||||
|
||||
// test Next exception
|
||||
{
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4);
|
||||
|
@ -109,7 +109,7 @@ HWTEST_F_L0(JSAPIHashMapTest, HashMapSetAndGet)
|
||||
key.Update(JSTaggedValue::Hole());
|
||||
JSAPIHashMap::Set(thread, hashMap, key, value);
|
||||
EXPECT_EXCEPTION();
|
||||
|
||||
|
||||
std::string myKey("mykey");
|
||||
std::string myValue("myvalue");
|
||||
for (uint32_t i = 0; i < NODE_NUMBERS; i++) {
|
||||
@ -120,7 +120,7 @@ HWTEST_F_L0(JSAPIHashMapTest, HashMapSetAndGet)
|
||||
JSAPIHashMap::Set(thread, hashMap, key, value);
|
||||
}
|
||||
EXPECT_EQ(hashMap->GetSize(), NODE_NUMBERS);
|
||||
|
||||
|
||||
// test isEmpty
|
||||
EXPECT_EQ(hashMap->IsEmpty(), JSTaggedValue::False());
|
||||
|
||||
@ -355,7 +355,7 @@ HWTEST_F_L0(JSAPIHashMapTest, JSAPIHashMapIteratorRBTreeTest)
|
||||
value.Update(JSTaggedValue(hashCollisionVector[i]));
|
||||
JSAPIHashMap::Set(thread, hashMap, key, value);
|
||||
}
|
||||
|
||||
|
||||
JSHandle<JSAPIHashMapIterator> hashmapIterator = factory->NewJSAPIHashMapIterator(hashMap, IterationKind::VALUE);
|
||||
for (uint32_t i = 0; i < NODE_NUMBERS; i++) {
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4);
|
||||
@ -386,7 +386,7 @@ HWTEST_F_L0(JSAPIHashMapTest, JSAPIHashMapRBTreeHasValueReplaceGet)
|
||||
value.Update(JSTaggedValue(hashCollisionVector[i]));
|
||||
JSAPIHashMap::Set(thread, hashMap, key, value);
|
||||
}
|
||||
|
||||
|
||||
// test RBTree HasValue
|
||||
for (uint32_t i = 0; i < NODE_NUMBERS - 1; i++) {
|
||||
value.Update(JSTaggedValue(hashCollisionVector[i]));
|
||||
@ -428,7 +428,7 @@ HWTEST_F_L0(JSAPIHashMapTest, JSAPIHashMapRBTreeSetAllRemove)
|
||||
JSAPIHashMap::Set(thread, dstHashMap, key, dstValue);
|
||||
JSAPIHashMap::Set(thread, srcHashMap, key, srcValue);
|
||||
}
|
||||
|
||||
|
||||
// test SetAll and Get
|
||||
JSAPIHashMap::SetAll(thread, dstHashMap, srcHashMap);
|
||||
for (uint32_t i = 0; i < NODE_NUMBERS; i++) {
|
||||
@ -454,4 +454,4 @@ HWTEST_F_L0(JSAPIHashMapTest, JSAPIHashMapRBTreeSetAllRemove)
|
||||
EXPECT_EQ(getResult, JSTaggedValue(hashCollisionVector[i] * 2));
|
||||
}
|
||||
}
|
||||
} // namespace panda::test
|
||||
} // namespace panda::test
|
||||
|
@ -100,7 +100,7 @@ HWTEST_F_L0(JSAPIHashSetIteratorTest, SpecailReturnOfNextCreateHashSetIterator)
|
||||
JSHandle<JSAPIHashSetIterator> hashSetIterator = factory->NewJSAPIHashSetIterator(
|
||||
jsHashSet, IterationKind::KEY);
|
||||
hashSetIterator->SetIteratedHashSet(thread, JSTaggedValue::Undefined());
|
||||
|
||||
|
||||
// test Next exception
|
||||
{
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4);
|
||||
|
@ -192,7 +192,7 @@ HWTEST_F_L0(JSAPIHashSetTest, JSAPIHashSetRemoveRBTreeTest)
|
||||
value.Update(JSTaggedValue(hashCollisionVector[i]));
|
||||
JSAPIHashSet::Add(thread, hashSet, value);
|
||||
}
|
||||
|
||||
|
||||
// test Remove non-existent value
|
||||
JSTaggedValue nonExistentValue = JSAPIHashSet::Remove(thread, hashSet, JSTaggedValue(0));
|
||||
EXPECT_EQ(nonExistentValue, JSTaggedValue::False());
|
||||
@ -292,7 +292,7 @@ HWTEST_F_L0(JSAPIHashSetTest, JSAPIHashSetIteratorRBTreeTest)
|
||||
value.Update(JSTaggedValue(hashCollisionVector[i]));
|
||||
JSAPIHashSet::Add(thread, hashSet, value);
|
||||
}
|
||||
|
||||
|
||||
JSHandle<JSAPIHashSetIterator> hashsetIterator = factory->NewJSAPIHashSetIterator(hashSet, IterationKind::VALUE);
|
||||
for (uint32_t i = 0; i < NODE_NUMBERS; i++) {
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4);
|
||||
@ -309,4 +309,4 @@ HWTEST_F_L0(JSAPIHashSetTest, JSAPIHashSetIteratorRBTreeTest)
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace panda::test
|
||||
} // namespace panda::test
|
||||
|
@ -109,7 +109,7 @@ HWTEST_F_L0(JSAPILightWeightMapIteratorTest, SpecailReturnOfNextCreateLightWeigh
|
||||
JSHandle<JSAPILightWeightMapIterator> lightWeightMapIterator = factory->NewJSAPILightWeightMapIterator(
|
||||
jsLightWeightMap, IterationKind::KEY_AND_VALUE);
|
||||
lightWeightMapIterator->SetIteratedLightWeightMap(thread, JSTaggedValue::Undefined());
|
||||
|
||||
|
||||
// test Next exception
|
||||
{
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4);
|
||||
|
@ -227,7 +227,7 @@ HWTEST_F_L0(JSAPILightWeightMapTest, Remove)
|
||||
JSAPILightWeightMap::Set(thread, lwm, key2, value2);
|
||||
|
||||
JSHandle<JSTaggedValue> key3(thread, JSTaggedValue(4));
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> result =
|
||||
JSHandle<JSTaggedValue>(thread, JSAPILightWeightMap::Remove(thread, lwm, key2));
|
||||
JSHandle<JSTaggedValue> resultNoExist =
|
||||
@ -257,7 +257,7 @@ HWTEST_F_L0(JSAPILightWeightMapTest, RemoveAt)
|
||||
JSHandle<JSTaggedValue> key2(thread, JSTaggedValue(3));
|
||||
JSHandle<JSTaggedValue> value2(thread, JSTaggedValue(4));
|
||||
JSAPILightWeightMap::Set(thread, lwm, key2, value2);
|
||||
|
||||
|
||||
int32_t removeIndex = JSAPILightWeightMap::GetIndexOfKey(thread, lwm, key1);
|
||||
EXPECT_EQ(JSAPILightWeightMap::RemoveAt(thread, lwm, removeIndex), JSTaggedValue::True());
|
||||
JSHandle<JSTaggedValue> result(thread, JSAPILightWeightMap::Get(thread, lwm, key1));
|
||||
@ -282,7 +282,7 @@ HWTEST_F_L0(JSAPILightWeightMapTest, SetValueAt)
|
||||
JSAPILightWeightMap::Set(thread, lwm, key, value);
|
||||
EXPECT_TRUE(JSTaggedValue::Equal(thread, JSHandle<JSTaggedValue>(thread,
|
||||
JSAPILightWeightMap::Get(thread, lwm, key)), value));
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> key1(thread, JSTaggedValue(2));
|
||||
JSHandle<JSTaggedValue> value1(thread, JSTaggedValue(3));
|
||||
JSAPILightWeightMap::Set(thread, lwm, key1, value1);
|
||||
@ -321,7 +321,7 @@ HWTEST_F_L0(JSAPILightWeightMapTest, GetStateOfKey)
|
||||
JSHandle<JSTaggedValue> value3(thread, JSTaggedValue(setVector[i]));
|
||||
JSAPILightWeightMap::Set(thread, lwm, key3, value3);
|
||||
}
|
||||
|
||||
|
||||
// check
|
||||
for (uint32_t i = 0; i < setVector.size() - 1; i++) {
|
||||
JSHandle<JSTaggedValue> key4(thread, JSTaggedValue(setVector[i]));
|
||||
|
@ -12,7 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#include "ecmascript/js_api/js_api_lightweightset.h"
|
||||
#include "ecmascript/containers/containers_private.h"
|
||||
#include "ecmascript/ecma_string.h"
|
||||
@ -104,7 +104,7 @@ HWTEST_F_L0(JSAPILightWeightSetIteratorTest, SpecailReturnOfNextCreateLightWeigh
|
||||
JSHandle<JSAPILightWeightSetIterator> lightWeightSetIterator = factory->NewJSAPILightWeightSetIterator(
|
||||
jsLightWeightSet, IterationKind::KEY);
|
||||
lightWeightSetIterator->SetIteratedLightWeightSet(thread, JSTaggedValue::Undefined());
|
||||
|
||||
|
||||
// test Next exception
|
||||
{
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4);
|
||||
@ -130,4 +130,4 @@ HWTEST_F_L0(JSAPILightWeightSetIteratorTest, SpecailReturnOfNextCreateLightWeigh
|
||||
EXPECT_EQ(result, thread->GlobalConstants()->GetUndefinedIterResult());
|
||||
}
|
||||
}
|
||||
} // namespace panda::test
|
||||
} // namespace panda::test
|
||||
|
@ -12,7 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#include "ecmascript/js_api/js_api_lightweightset.h"
|
||||
#include "ecmascript/containers/containers_private.h"
|
||||
#include "ecmascript/ecma_string.h"
|
||||
@ -111,7 +111,7 @@ HWTEST_F_L0(JSAPILightWeightSetTest, AddIncreaseCapacityAddAll)
|
||||
EXPECT_TRUE(result);
|
||||
}
|
||||
EXPECT_EQ(lws->GetSize(), NODE_NUMBERS);
|
||||
|
||||
|
||||
uint32_t tmp = NODE_NUMBERS * 3; // 3 means the value
|
||||
JSAPILightWeightSet::IncreaseCapacityTo(thread, lws, static_cast<int32_t>(tmp));
|
||||
uint32_t capacity = TaggedArray::Cast(lws->GetValues().GetTaggedObject())->GetLength();
|
||||
@ -148,7 +148,7 @@ HWTEST_F_L0(JSAPILightWeightSetTest, EqualClearNotEqual)
|
||||
JSMutableHandle<JSTaggedValue> value1(thread, JSTaggedValue::Undefined());
|
||||
JSMutableHandle<JSTaggedValue> value2(thread, JSTaggedValue::Undefined());
|
||||
bool result = false;
|
||||
|
||||
|
||||
// test Equal of two empty lightweightset
|
||||
result = JSAPILightWeightSet::Equal(thread, lws, JSHandle<JSTaggedValue>::Cast(equalLws));
|
||||
EXPECT_FALSE(result);
|
||||
@ -264,7 +264,7 @@ HWTEST_F_L0(JSAPILightWeightSetTest, GetIndexOfRemoveRemoveAtGetValueAt)
|
||||
result = JSAPILightWeightSet::Add(thread, lws, value);
|
||||
}
|
||||
EXPECT_EQ(lws->GetSize(), NODE_NUMBERS);
|
||||
|
||||
|
||||
// test GetIndexOf
|
||||
std::string tValue("myvalue5");
|
||||
value.Update(factory->NewFromStdString(tValue).GetTaggedValue());
|
||||
@ -280,7 +280,7 @@ HWTEST_F_L0(JSAPILightWeightSetTest, GetIndexOfRemoveRemoveAtGetValueAt)
|
||||
EXPECT_EQ(value.GetTaggedValue(), jsValue);
|
||||
jsValue = lws->Remove(thread, value);
|
||||
EXPECT_EQ(jsValue, JSTaggedValue::Undefined());
|
||||
|
||||
|
||||
// test RemoveAt
|
||||
result = lws->RemoveAt(thread, 4); // 4 means the value
|
||||
EXPECT_EQ(lws->GetSize(), NODE_NUMBERS - 2); // 2 means the value
|
||||
@ -296,7 +296,7 @@ HWTEST_F_L0(JSAPILightWeightSetTest, Iterator)
|
||||
constexpr uint32_t NODE_NUMBERS = 8; // 8 means the value
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSAPILightWeightSet> lws(thread, CreateLightWeightSet());
|
||||
|
||||
|
||||
JSMutableHandle<JSTaggedValue> value(thread, JSTaggedValue::Undefined());
|
||||
for (uint32_t i = 0; i < NODE_NUMBERS; i++) {
|
||||
value.Update(JSTaggedValue(i));
|
||||
@ -317,7 +317,7 @@ HWTEST_F_L0(JSAPILightWeightSetTest, RBTreeGetHashIndex)
|
||||
std::vector<int> hashCollisionVector = {4307, 5135, 5903, 6603, 6780, 8416, 1224, 1285, 1463, 9401, 9740};
|
||||
uint32_t NODE_NUMBERS = static_cast<uint32_t>(hashCollisionVector.size());
|
||||
JSHandle<JSAPILightWeightSet> lws(thread, CreateLightWeightSet());
|
||||
|
||||
|
||||
JSMutableHandle<JSTaggedValue> value(thread, JSTaggedValue::Undefined());
|
||||
for (uint32_t i = 0; i < NODE_NUMBERS; i++) {
|
||||
value.Update(JSTaggedValue(hashCollisionVector[i]));
|
||||
@ -335,7 +335,7 @@ HWTEST_F_L0(JSAPILightWeightSetTest, SpecialReturnTestEnsureCapacityGetValueAtGe
|
||||
{
|
||||
constexpr uint32_t NODE_NUMBERS = 8;
|
||||
JSHandle<JSAPILightWeightSet> lws(thread, CreateLightWeightSet());
|
||||
|
||||
|
||||
JSMutableHandle<JSTaggedValue> value(thread, JSTaggedValue::Undefined());
|
||||
for (uint32_t i = 0; i < NODE_NUMBERS; i++) {
|
||||
value.Update(JSTaggedValue(i));
|
||||
@ -365,7 +365,7 @@ HWTEST_F_L0(JSAPILightWeightSetTest, GetHashAtHasHash)
|
||||
{
|
||||
constexpr uint32_t NODE_NUMBERS = 8;
|
||||
JSHandle<JSAPILightWeightSet> lws(thread, CreateLightWeightSet());
|
||||
|
||||
|
||||
JSMutableHandle<JSTaggedValue> value(thread, JSTaggedValue::Undefined());
|
||||
JSMutableHandle<JSTaggedValue> hash(thread, JSTaggedValue::Undefined());
|
||||
for (uint32_t i = 0; i < NODE_NUMBERS; i++) {
|
||||
@ -410,4 +410,4 @@ HWTEST_F_L0(JSAPILightWeightSetTest, ToString)
|
||||
JSHandle<EcmaString> resultHandle(thread, result);
|
||||
ASSERT_EQ(EcmaStringAccessor::Compare(instance, resultHandle, str), 0);
|
||||
}
|
||||
} // namespace panda::test
|
||||
} // namespace panda::test
|
||||
|
@ -114,7 +114,7 @@ HWTEST_F_L0(JSAPILinkedListTest, AddAndHas)
|
||||
for (int i = 0; i < NODE_NUMBERS; i++) {
|
||||
std::string ivalue = myValue + std::to_string(i);
|
||||
value.Update(factory->NewFromStdString(ivalue).GetTaggedValue());
|
||||
|
||||
|
||||
JSTaggedValue gValue = toor->Get(i);
|
||||
EXPECT_EQ(gValue, value.GetTaggedValue());
|
||||
}
|
||||
@ -281,7 +281,7 @@ HWTEST_F_L0(JSAPILinkedListTest, SpecialReturnOfRemove)
|
||||
JSHandle<TaggedDoubleList> doubleList(thread, linkedList->GetDoubleList());
|
||||
doubleList->SetNumberOfNodes(thread, -1);
|
||||
EXPECT_EQ(linkedList->Remove(thread, value.GetTaggedValue()), JSTaggedValue::False());
|
||||
|
||||
|
||||
JSAPILinkedList::RemoveFirstFound(thread, linkedList, value.GetTaggedValue());
|
||||
EXPECT_EXCEPTION();
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ HWTEST_F_L0(JSAPIListTest, AddHasAndIsEmpty)
|
||||
for (int i = 0; i < NODE_NUMBERS; i++) {
|
||||
std::string ivalue = myValue + std::to_string(i);
|
||||
value.Update(factory->NewFromStdString(ivalue).GetTaggedValue());
|
||||
|
||||
|
||||
JSTaggedValue gValue = toor->Get(i);
|
||||
EXPECT_EQ(gValue, value.GetTaggedValue());
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#include "ecmascript/js_api/js_api_plain_array.h"
|
||||
#include "ecmascript/containers/containers_private.h"
|
||||
#include "ecmascript/ecma_string.h"
|
||||
@ -103,7 +103,7 @@ HWTEST_F_L0(JSAPIPlainArrayIteratorTest, SpecailReturnOfNextCreatePlainArrayIter
|
||||
JSHandle<JSAPIPlainArrayIterator> plainArrayIterator = factory->NewJSAPIPlainArrayIterator(
|
||||
jsPlainArray, IterationKind::KEY);
|
||||
plainArrayIterator->SetIteratedPlainArray(thread, JSTaggedValue::Undefined());
|
||||
|
||||
|
||||
// test Next exception
|
||||
{
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4);
|
||||
@ -117,4 +117,4 @@ HWTEST_F_L0(JSAPIPlainArrayIteratorTest, SpecailReturnOfNextCreatePlainArrayIter
|
||||
EXPECT_EXCEPTION();
|
||||
}
|
||||
}
|
||||
} // namespace panda::test
|
||||
} // namespace panda::test
|
||||
|
@ -12,7 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#include "ecmascript/js_api/js_api_plain_array.h"
|
||||
#include "ecmascript/containers/containers_private.h"
|
||||
#include "ecmascript/ecma_string.h"
|
||||
@ -109,19 +109,19 @@ HWTEST_F_L0(JSAPIPlainArrayTest, PA_AddAndGetKeyAtAndClear)
|
||||
for (uint32_t i = 0; i < NODE_NUMBERS; i = i + 2) {
|
||||
uint32_t ikey = 100 + i;
|
||||
std::string ivalue = myValue + std::to_string(i);
|
||||
|
||||
|
||||
key.Update(JSTaggedValue(ikey));
|
||||
value.Update(factory->NewFromStdString(ivalue).GetTaggedValue());
|
||||
|
||||
|
||||
JSAPIPlainArray::Add(thread, array, key, value);
|
||||
}
|
||||
for (uint32_t i = 1; i < NODE_NUMBERS; i = i + 2) {
|
||||
uint32_t ikey = 100 + i;
|
||||
std::string ivalue = myValue + std::to_string(i);
|
||||
|
||||
|
||||
key.Update(JSTaggedValue(ikey));
|
||||
value.Update(factory->NewFromStdString(ivalue).GetTaggedValue());
|
||||
|
||||
|
||||
JSAPIPlainArray::Add(thread, array, key, value);
|
||||
}
|
||||
EXPECT_EQ(array->GetSize(), static_cast<int>(NODE_NUMBERS));
|
||||
@ -219,7 +219,7 @@ HWTEST_F_L0(JSAPIPlainArrayTest, PA_GetIndexOfKeyAndGeIndexOfValueAndIsEmptyAndR
|
||||
value3 = array->RemoveRangeFrom(thread, lvalue, batchSize);
|
||||
EXPECT_EQ(value3.GetNumber(), 3); // 3 means the value
|
||||
EXPECT_EQ(array->GetSize(), static_cast<int>(NODE_NUMBERS - 3));
|
||||
|
||||
|
||||
// test RemoveRangeFrom exception
|
||||
array->RemoveRangeFrom(thread, lvalue, -1);
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ HWTEST_F_L0(JSAPIQueueIteratorTest, SpecialReturnOfNext)
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSAPIQueueIterator> queueIterator = factory->NewJSAPIQueueIterator(jsQueue);
|
||||
queueIterator->SetIteratedQueue(thread, JSTaggedValue::Undefined());
|
||||
|
||||
|
||||
// test Next exception
|
||||
{
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4);
|
||||
@ -230,4 +230,4 @@ HWTEST_F_L0(JSAPIQueueIteratorTest, SetNextIndex)
|
||||
EXPECT_EQ(queueIterator->GetNextIndex(), i);
|
||||
}
|
||||
}
|
||||
} // namespace panda::test
|
||||
} // namespace panda::test
|
||||
|
@ -132,7 +132,7 @@ HWTEST_F_L0(JSAPIStackIteratorTest, SpecialReturnOfNext)
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSAPIStackIterator> stackIterator = factory->NewJSAPIStackIterator(jsStack);
|
||||
stackIterator->SetIteratedStack(thread, JSTaggedValue::Undefined());
|
||||
|
||||
|
||||
// test Next exception
|
||||
{
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4);
|
||||
@ -225,10 +225,10 @@ HWTEST_F_L0(JSAPIStackIteratorTest, SetNextIndex)
|
||||
}
|
||||
JSHandle<JSAPIStackIterator> stackIterator = factory->NewJSAPIStackIterator(jsStack);
|
||||
EXPECT_EQ(stackIterator->GetNextIndex(), 0U);
|
||||
|
||||
|
||||
for (uint32_t i = 0; i < DEFAULT_LENGTH; i++) {
|
||||
stackIterator->SetNextIndex(i);
|
||||
EXPECT_EQ(stackIterator->GetNextIndex(), i);
|
||||
}
|
||||
}
|
||||
} // namespace panda::ecmascript
|
||||
} // namespace panda::ecmascript
|
||||
|
@ -157,7 +157,7 @@ HWTEST_F_L0(JSAPITreeMapIteratorTest, SetNextIndex)
|
||||
JSHandle<JSAPITreeMapIterator> treeMapIterator =
|
||||
factory->NewJSAPITreeMapIterator(jsTreeMap, IterationKind::KEY_AND_VALUE);
|
||||
EXPECT_EQ(treeMapIterator->GetNextIndex(), 0U);
|
||||
|
||||
|
||||
for (uint32_t i = 0; i < DEFAULT_LENGTH; i++) {
|
||||
treeMapIterator->SetNextIndex(i);
|
||||
EXPECT_EQ(treeMapIterator->GetNextIndex(), i);
|
||||
@ -309,7 +309,7 @@ HWTEST_F_L0(JSAPITreeMapIteratorTest, KEY_AND_VALUE_Next)
|
||||
JSHandle<JSObject> resultObj(thread, result);
|
||||
std::string resultKeyAndValue = mapKey + std::to_string(i + 1U);
|
||||
value.Update(factory->NewFromStdString(resultKeyAndValue).GetTaggedValue());
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> keyValueArr(JSObject::GetProperty(thread, resultObj, valueStr).GetValue());
|
||||
for (int index = 0; index < 2; index++) {
|
||||
JSHandle<JSTaggedValue> indexValue(thread, JSTaggedValue(index));
|
||||
@ -336,7 +336,7 @@ HWTEST_F_L0(JSAPITreeMapIteratorTest, SpecailReturnOfNextCreateTreeMapIterator)
|
||||
JSHandle<JSAPITreeMapIterator> treeMapIterator = factory->NewJSAPITreeMapIterator(
|
||||
jsTreeMap, IterationKind::KEY_AND_VALUE);
|
||||
treeMapIterator->SetIteratedMap(thread, JSTaggedValue::Undefined());
|
||||
|
||||
|
||||
// test Next exception
|
||||
{
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4);
|
||||
@ -371,4 +371,4 @@ HWTEST_F_L0(JSAPITreeMapIteratorTest, SpecailReturnOfNextCreateTreeMapIterator)
|
||||
EXPECT_EXCEPTION();
|
||||
}
|
||||
}
|
||||
} // namespace panda::ecmascript
|
||||
} // namespace panda::ecmascript
|
||||
|
@ -149,7 +149,7 @@ HWTEST_F_L0(JSAPITreeSetIteratorTest, SetNextIndex)
|
||||
JSHandle<JSAPITreeSetIterator> treeSetIterator =
|
||||
factory->NewJSAPITreeSetIterator(jsTreeSet, IterationKind::KEY_AND_VALUE);
|
||||
EXPECT_EQ(treeSetIterator->GetNextIndex(), 0U);
|
||||
|
||||
|
||||
for (uint32_t i = 0; i < DEFAULT_LENGTH; i++) {
|
||||
treeSetIterator->SetNextIndex(i);
|
||||
EXPECT_EQ(treeSetIterator->GetNextIndex(), i);
|
||||
@ -237,7 +237,7 @@ HWTEST_F_L0(JSAPITreeSetIteratorTest, SpecialReturnOfNext)
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSAPITreeSetIterator> treeSetIterator = factory->NewJSAPITreeSetIterator(jsTreeSet, IterationKind::KEY);
|
||||
treeSetIterator->SetIteratedSet(thread, JSTaggedValue::Undefined());
|
||||
|
||||
|
||||
// test Next exception
|
||||
{
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4);
|
||||
@ -293,7 +293,7 @@ HWTEST_F_L0(JSAPITreeSetIteratorTest, KEY_AND_VALUE_Next)
|
||||
JSHandle<JSObject> resultObj(thread, result);
|
||||
std::string resultKeyAndValue = setKey + std::to_string(i + 1U);
|
||||
key.Update(factory->NewFromStdString(resultKeyAndValue).GetTaggedValue());
|
||||
|
||||
|
||||
JSHandle<JSTaggedValue> keyValueArr(JSObject::GetProperty(thread, resultObj, valueStr).GetValue());
|
||||
for (int index = 0; index < 2; index++) {
|
||||
JSHandle<JSTaggedValue> indexValue(thread, JSTaggedValue(index));
|
||||
@ -303,4 +303,4 @@ HWTEST_F_L0(JSAPITreeSetIteratorTest, KEY_AND_VALUE_Next)
|
||||
EXPECT_EQ(treeSetIterator->GetNextIndex(), (i + 1U));
|
||||
}
|
||||
}
|
||||
} // namespace panda::ecmascript
|
||||
} // namespace panda::ecmascript
|
||||
|
@ -126,7 +126,7 @@ HWTEST_F_L0(JSAPIVectorIteratorTest, SetNextIndex)
|
||||
EXPECT_TRUE(*jsVector != nullptr);
|
||||
JSHandle<JSAPIVectorIterator> vectorIterator = factory->NewJSAPIVectorIterator(jsVector);
|
||||
EXPECT_EQ(vectorIterator->GetNextIndex(), 0U);
|
||||
|
||||
|
||||
for (uint32_t i = 0; i < DEFAULT_LENGTH; i++) {
|
||||
vectorIterator->SetNextIndex(i);
|
||||
EXPECT_EQ(vectorIterator->GetNextIndex(), i);
|
||||
@ -190,7 +190,7 @@ HWTEST_F_L0(JSAPIVectorIteratorTest, SpecialReturnOfNext)
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSAPIVectorIterator> vectorIterator = factory->NewJSAPIVectorIterator(jsVector);
|
||||
vectorIterator->SetIteratedVector(thread, JSTaggedValue::Undefined());
|
||||
|
||||
|
||||
// test Next exception
|
||||
{
|
||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4);
|
||||
@ -216,4 +216,4 @@ HWTEST_F_L0(JSAPIVectorIteratorTest, SpecialReturnOfNext)
|
||||
EXPECT_EQ(result, thread->GlobalConstants()->GetUndefinedIterResult());
|
||||
}
|
||||
}
|
||||
} // namespace panda::ecmascript
|
||||
} // namespace panda::ecmascript
|
||||
|
@ -123,7 +123,7 @@ HWTEST_F_L0(JSAPIVectorTest, AddGetHas)
|
||||
EXPECT_EXCEPTION();
|
||||
JSAPIVector::Get(thread, toor, static_cast<int32_t>(NODE_NUMBERS));
|
||||
EXPECT_EXCEPTION();
|
||||
|
||||
|
||||
toor->Dump();
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ HWTEST_F_L0(JSAPIVectorTest, RemoveByIndexAndRemove)
|
||||
JSTaggedValue result1 = JSAPIVector::RemoveByIndex(thread, toor, NODE_NUMBERS);
|
||||
EXPECT_EQ(result1, JSTaggedValue::Exception());
|
||||
EXPECT_EXCEPTION();
|
||||
|
||||
|
||||
toor->Dump();
|
||||
}
|
||||
|
||||
@ -364,7 +364,7 @@ HWTEST_F_L0(JSAPIVectorTest, SetLengthGetIndexFromGetLastElementGetLastIndexOf)
|
||||
uint32_t elementsNums = 20;
|
||||
JSHandle<JSTaggedValue> obj(thread, JSTaggedValue(elementsNums - 1));
|
||||
EXPECT_EQ(JSAPIVector::GetLastIndexOf(thread, toor, obj), -1);
|
||||
|
||||
|
||||
for (uint32_t i = 0; i < elementsNums; i++) {
|
||||
JSHandle<JSTaggedValue> value(thread, JSTaggedValue(i));
|
||||
JSAPIVector::Add(thread, toor, value);
|
||||
@ -372,7 +372,7 @@ HWTEST_F_L0(JSAPIVectorTest, SetLengthGetIndexFromGetLastElementGetLastIndexOf)
|
||||
|
||||
// test GetIndexFrom
|
||||
EXPECT_EQ(JSAPIVector::GetIndexFrom(thread, toor, obj, -1), static_cast<int32_t>(elementsNums - 1));
|
||||
|
||||
|
||||
EXPECT_EQ(JSAPIVector::GetIndexFrom(thread, toor, obj, elementsNums), -1);
|
||||
EXPECT_EXCEPTION();
|
||||
|
||||
@ -385,13 +385,13 @@ HWTEST_F_L0(JSAPIVectorTest, SetLengthGetIndexFromGetLastElementGetLastIndexOf)
|
||||
// test GetLastIndexFrom
|
||||
EXPECT_EQ(JSAPIVector::GetLastIndexFrom(
|
||||
thread, toor, obj, elementsNums - 1), static_cast<int32_t>(elementsNums - 1));
|
||||
|
||||
|
||||
EXPECT_EQ(JSAPIVector::GetLastIndexFrom(thread, toor, obj, elementsNums), -1);
|
||||
EXPECT_EXCEPTION();
|
||||
|
||||
JSHandle<JSTaggedValue> obj1(thread, JSTaggedValue(-elementsNums));
|
||||
EXPECT_EQ(JSAPIVector::GetLastIndexFrom(thread, toor, obj1, -1), -1);
|
||||
|
||||
|
||||
// test SetLength
|
||||
JSAPIVector::SetLength(thread, toor, elementsNums * 3);
|
||||
EXPECT_EQ(toor->GetLength(), static_cast<int32_t>(elementsNums * 3));
|
||||
@ -448,7 +448,7 @@ HWTEST_F_L0(JSAPIVectorTest, ExceptionOfSubVector)
|
||||
// from < 0
|
||||
JSAPIVector::SubVector(thread, toor, -1, 0);
|
||||
EXPECT_EXCEPTION();
|
||||
|
||||
|
||||
// toIndex < 0
|
||||
JSAPIVector::SubVector(thread, toor, 0, -1);
|
||||
EXPECT_EXCEPTION();
|
||||
|
@ -73,7 +73,7 @@ HWTEST_F_L0(JSDisplayNamesTest, GetIcuLocaleDisplayNames)
|
||||
JSHandle<JSTaggedValue> ctor = env->GetDisplayNamesFunction();
|
||||
JSHandle<JSDisplayNames> displayNames =
|
||||
JSHandle<JSDisplayNames>::Cast(factory->NewJSObjectByConstructor(JSHandle<JSFunction>(ctor), ctor));
|
||||
|
||||
|
||||
icu::Locale icuLocale("en");
|
||||
UDisplayContext display_context[] = {UDISPCTX_LENGTH_SHORT};
|
||||
icu::LocaleDisplayNames* iculocaledisplaynames =
|
||||
@ -235,7 +235,7 @@ HWTEST_F_L0(JSDisplayNamesTest, ResolvedOptions)
|
||||
JSHandle<JSTaggedValue> objFun = env->GetObjectFunction();
|
||||
JSHandle<JSObject> displayOptions = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(objFun), objFun);
|
||||
JSHandle<JSTaggedValue> locale(factory->NewFromASCII("zh-Hant"));
|
||||
|
||||
|
||||
std::map<std::string, std::string> displayOptionsProperty {
|
||||
{ "style", "short" },
|
||||
{ "type", "region" },
|
||||
@ -247,7 +247,7 @@ HWTEST_F_L0(JSDisplayNamesTest, ResolvedOptions)
|
||||
SetOptionProperties(thread, displayOptions, displayOptionsProperty);
|
||||
JSHandle<JSDisplayNames> initDisplayNames =
|
||||
JSDisplayNames::InitializeDisplayNames(thread, displayNames, locale, JSHandle<JSTaggedValue>(displayOptions));
|
||||
|
||||
|
||||
JSDisplayNames::ResolvedOptions(thread, initDisplayNames, displayOptions);
|
||||
EXPECT_EQ(JSTaggedValue::SameValue(
|
||||
JSObject::GetProperty(thread, displayOptions, styleKey).GetValue(), styleValue), true);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user