mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-06 23:54:03 +00:00
Fix code style
Issue: #I67JM7 Signed-off-by: Gymee <yumeijie@huawei.com>
This commit is contained in:
parent
94b01d742c
commit
29777fc3ab
@ -66,7 +66,7 @@ static constexpr size_t INT8_BITS = 8;
|
|||||||
static constexpr size_t JS_DTOA_BUF_SIZE = 128;
|
static constexpr size_t JS_DTOA_BUF_SIZE = 128;
|
||||||
|
|
||||||
// help defines for random
|
// help defines for random
|
||||||
static constexpr int LEFT52 = 52 ;
|
static constexpr int LEFT52 = 52;
|
||||||
static constexpr int RIGHT12 = 12;
|
static constexpr int RIGHT12 = 12;
|
||||||
static constexpr uint32_t USE_LEFT = 0x3ff;
|
static constexpr uint32_t USE_LEFT = 0x3ff;
|
||||||
static constexpr int SECONDS_TO_SUBTLE = 1000000;
|
static constexpr int SECONDS_TO_SUBTLE = 1000000;
|
||||||
|
@ -191,7 +191,7 @@ public:
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
int l = 0;
|
int l = 0;
|
||||||
if (c >= UICODE_FROM_UTF8[1] && c <= UICODE_FROM_UTF8[2]) { // 1 - 2: 0000 0080 - 0000 07FF
|
if (c >= UICODE_FROM_UTF8[1] && c <= UICODE_FROM_UTF8[2]) { // 1 - 2: 0000 0080 - 0000 07FF
|
||||||
l = 1; // 1: 0000 0080 - 0000 07FF Unicode
|
l = 1; // 1: 0000 0080 - 0000 07FF Unicode
|
||||||
} else if (c >= UICODE_FROM_UTF8[3] && c <= UICODE_FROM_UTF8[4]) { // 3 - 4: 0000 0800 - 0000 FFFF
|
} else if (c >= UICODE_FROM_UTF8[3] && c <= UICODE_FROM_UTF8[4]) { // 3 - 4: 0000 0800 - 0000 FFFF
|
||||||
l = 2; // 2: 0000 0800 - 0000 FFFF Unicode
|
l = 2; // 2: 0000 0800 - 0000 FFFF Unicode
|
||||||
|
@ -60,7 +60,7 @@ HWTEST_F_L0(GCRingBufferTest, Push)
|
|||||||
constexpr int LENGTH = 10;
|
constexpr int LENGTH = 10;
|
||||||
GCRingBuffer<int, LENGTH> gcBuffer;
|
GCRingBuffer<int, LENGTH> gcBuffer;
|
||||||
EXPECT_EQ(gcBuffer.Count(), 0);
|
EXPECT_EQ(gcBuffer.Count(), 0);
|
||||||
for (int i = 0 ; i < 2 * LENGTH ; i++) {
|
for (int i = 0; i < 2 * LENGTH; i++) {
|
||||||
gcBuffer.Push(i);
|
gcBuffer.Push(i);
|
||||||
}
|
}
|
||||||
EXPECT_EQ(gcBuffer.Count(), LENGTH);
|
EXPECT_EQ(gcBuffer.Count(), LENGTH);
|
||||||
@ -82,12 +82,12 @@ HWTEST_F_L0(GCRingBufferTest, Sum)
|
|||||||
constexpr int LENGTH = 10;
|
constexpr int LENGTH = 10;
|
||||||
GCRingBuffer<int, LENGTH> gcBuffer;
|
GCRingBuffer<int, LENGTH> gcBuffer;
|
||||||
|
|
||||||
for (int i = 0 ; i < LENGTH ; i++) {
|
for (int i = 0; i < LENGTH; i++) {
|
||||||
gcBuffer.Push(i);
|
gcBuffer.Push(i);
|
||||||
}
|
}
|
||||||
EXPECT_EQ(gcBuffer.Sum(SumCallback, 0), 45);
|
EXPECT_EQ(gcBuffer.Sum(SumCallback, 0), 45);
|
||||||
|
|
||||||
for (int i = 0 ; i < LENGTH ; i++) {
|
for (int i = 0; i < LENGTH; i++) {
|
||||||
gcBuffer.Push(1);
|
gcBuffer.Push(1);
|
||||||
}
|
}
|
||||||
EXPECT_EQ(gcBuffer.Count(), LENGTH);
|
EXPECT_EQ(gcBuffer.Count(), LENGTH);
|
||||||
@ -107,7 +107,7 @@ HWTEST_F_L0(GCRingBufferTest, Reset)
|
|||||||
constexpr int LENGTH = 10;
|
constexpr int LENGTH = 10;
|
||||||
GCRingBuffer<int, LENGTH> gcBuffer;
|
GCRingBuffer<int, LENGTH> gcBuffer;
|
||||||
|
|
||||||
for (int i = 0 ; i < LENGTH ; i++) {
|
for (int i = 0; i < LENGTH; i++) {
|
||||||
gcBuffer.Reset();
|
gcBuffer.Reset();
|
||||||
gcBuffer.Push(i);
|
gcBuffer.Push(i);
|
||||||
}
|
}
|
||||||
@ -116,4 +116,4 @@ HWTEST_F_L0(GCRingBufferTest, Reset)
|
|||||||
gcBuffer.Reset();
|
gcBuffer.Reset();
|
||||||
EXPECT_EQ(gcBuffer.Count(), 0);
|
EXPECT_EQ(gcBuffer.Count(), 0);
|
||||||
}
|
}
|
||||||
} // namespace panda::ecmascript
|
} // namespace panda::ecmascript
|
||||||
|
@ -952,11 +952,11 @@ void Builtins::InitializeAsyncFunction(const JSHandle<GlobalEnv> &env, const JSH
|
|||||||
// AsyncFunction.prototype
|
// AsyncFunction.prototype
|
||||||
JSHandle<JSObject> asyncFuncPrototype = factory_->NewJSObjectWithInit(objFuncClass);
|
JSHandle<JSObject> asyncFuncPrototype = factory_->NewJSObjectWithInit(objFuncClass);
|
||||||
JSObject::SetPrototype(thread_, asyncFuncPrototype, env->GetFunctionPrototype());
|
JSObject::SetPrototype(thread_, asyncFuncPrototype, env->GetFunctionPrototype());
|
||||||
JSHandle<JSTaggedValue> async_func_prototype_value(asyncFuncPrototype);
|
JSHandle<JSTaggedValue> asyncFuncPrototypeValue(asyncFuncPrototype);
|
||||||
|
|
||||||
// AsyncFunction.prototype_or_hclass
|
// AsyncFunction.prototype_or_hclass
|
||||||
JSHandle<JSHClass> asyncFuncInstanceHClass =
|
JSHandle<JSHClass> asyncFuncInstanceHClass =
|
||||||
factory_->NewEcmaHClass(JSAsyncFunction::SIZE, JSType::JS_ASYNC_FUNCTION, async_func_prototype_value);
|
factory_->NewEcmaHClass(JSAsyncFunction::SIZE, JSType::JS_ASYNC_FUNCTION, asyncFuncPrototypeValue);
|
||||||
|
|
||||||
// AsyncFunction = new Function()
|
// AsyncFunction = new Function()
|
||||||
JSHandle<JSFunction> asyncFunction = NewBuiltinConstructor(
|
JSHandle<JSFunction> asyncFunction = NewBuiltinConstructor(
|
||||||
@ -1950,10 +1950,10 @@ void Builtins::InitializeArray(const JSHandle<GlobalEnv> &env, const JSHandle<JS
|
|||||||
SetGetter(JSHandle<JSObject>(arrayFunction), speciesSymbol, speciesGetter);
|
SetGetter(JSHandle<JSObject>(arrayFunction), speciesSymbol, speciesGetter);
|
||||||
|
|
||||||
constexpr int arrProtoLen = 0;
|
constexpr int arrProtoLen = 0;
|
||||||
JSHandle<JSTaggedValue> key_string = thread_->GlobalConstants()->GetHandledLengthString();
|
JSHandle<JSTaggedValue> keyString = thread_->GlobalConstants()->GetHandledLengthString();
|
||||||
PropertyDescriptor descriptor(thread_, JSHandle<JSTaggedValue>(thread_, JSTaggedValue(arrProtoLen)), true, false,
|
PropertyDescriptor descriptor(thread_, JSHandle<JSTaggedValue>(thread_, JSTaggedValue(arrProtoLen)), true, false,
|
||||||
false);
|
false);
|
||||||
JSObject::DefineOwnProperty(thread_, arrFuncPrototype, key_string, descriptor);
|
JSObject::DefineOwnProperty(thread_, arrFuncPrototype, keyString, descriptor);
|
||||||
|
|
||||||
JSHandle<JSTaggedValue> valuesKey(factory_->NewFromASCII("values"));
|
JSHandle<JSTaggedValue> valuesKey(factory_->NewFromASCII("values"));
|
||||||
PropertyDescriptor desc(thread_);
|
PropertyDescriptor desc(thread_);
|
||||||
|
@ -501,7 +501,7 @@ template <typename T>
|
|||||||
WaitResult BuiltinsAtomics::DoWait(JSThread *thread, JSHandle<JSTaggedValue> &arrayBuffer,
|
WaitResult BuiltinsAtomics::DoWait(JSThread *thread, JSHandle<JSTaggedValue> &arrayBuffer,
|
||||||
size_t index, T execpt, double timeout)
|
size_t index, T execpt, double timeout)
|
||||||
{
|
{
|
||||||
MutexGuard lock_guard(g_mutex);
|
MutexGuard lockGuard(g_mutex);
|
||||||
void *buffer = BuiltinsArrayBuffer::GetDataPointFromBuffer(arrayBuffer.GetTaggedValue());
|
void *buffer = BuiltinsArrayBuffer::GetDataPointFromBuffer(arrayBuffer.GetTaggedValue());
|
||||||
ASSERT(buffer != nullptr);
|
ASSERT(buffer != nullptr);
|
||||||
WaiterListNode *node = thread->GetEcmaVM()->GetWaiterListNode();
|
WaiterListNode *node = thread->GetEcmaVM()->GetWaiterListNode();
|
||||||
@ -551,7 +551,7 @@ uint32_t BuiltinsAtomics::Signal(JSHandle<JSTaggedValue> &arrayBuffer, const siz
|
|||||||
{
|
{
|
||||||
void *buffer = BuiltinsArrayBuffer::GetDataPointFromBuffer(arrayBuffer.GetTaggedValue());
|
void *buffer = BuiltinsArrayBuffer::GetDataPointFromBuffer(arrayBuffer.GetTaggedValue());
|
||||||
ASSERT(buffer != nullptr);
|
ASSERT(buffer != nullptr);
|
||||||
MutexGuard lock_guard(g_mutex);
|
MutexGuard lockGuard(g_mutex);
|
||||||
auto &locationListMap = g_waitLists->locationListMap_;
|
auto &locationListMap = g_waitLists->locationListMap_;
|
||||||
auto iter = locationListMap.find(reinterpret_cast<int8_t *>(buffer) + index);
|
auto iter = locationListMap.find(reinterpret_cast<int8_t *>(buffer) + index);
|
||||||
if (iter == locationListMap.end()) {
|
if (iter == locationListMap.end()) {
|
||||||
|
@ -144,12 +144,12 @@ JSTaggedValue BuiltinsDate::SetTime(EcmaRuntimeCallInfo *argv)
|
|||||||
if (!msg->IsDate()) {
|
if (!msg->IsDate()) {
|
||||||
THROW_TYPE_ERROR_AND_RETURN(thread, "Not a Date Object", JSTaggedValue::Exception());
|
THROW_TYPE_ERROR_AND_RETURN(thread, "Not a Date Object", JSTaggedValue::Exception());
|
||||||
}
|
}
|
||||||
JSHandle<JSDate> js_data(thread, JSDate::Cast(msg->GetTaggedObject()));
|
JSHandle<JSDate> jsDate(thread, JSDate::Cast(msg->GetTaggedObject()));
|
||||||
JSTaggedNumber res = JSTaggedValue::ToNumber(thread, GetCallArg(argv, 0));
|
JSTaggedNumber res = JSTaggedValue::ToNumber(thread, GetCallArg(argv, 0));
|
||||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(argv->GetThread());
|
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(argv->GetThread());
|
||||||
double number = res.GetNumber();
|
double number = res.GetNumber();
|
||||||
double value = JSDate::TimeClip(number);
|
double value = JSDate::TimeClip(number);
|
||||||
js_data->SetTimeValue(thread, JSTaggedValue(value));
|
jsDate->SetTimeValue(thread, JSTaggedValue(value));
|
||||||
return GetTaggedDouble(value);
|
return GetTaggedDouble(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ JSTaggedValue BuiltinsTypeError::ToString(EcmaRuntimeCallInfo *argv)
|
|||||||
JSTaggedValue BuiltinsTypeError::ThrowTypeError(EcmaRuntimeCallInfo *argv)
|
JSTaggedValue BuiltinsTypeError::ThrowTypeError(EcmaRuntimeCallInfo *argv)
|
||||||
{
|
{
|
||||||
JSThread *thread = argv->GetThread();
|
JSThread *thread = argv->GetThread();
|
||||||
[[maybe_unused]] EcmaHandleScope handle_scope(thread);
|
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||||
THROW_TYPE_ERROR_AND_RETURN(thread, "type error", JSTaggedValue::Exception());
|
THROW_TYPE_ERROR_AND_RETURN(thread, "type error", JSTaggedValue::Exception());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,11 +85,11 @@ JSTaggedValue BuiltinsProxy::InvalidateProxyFunction(EcmaRuntimeCallInfo *argv)
|
|||||||
JSThread *thread = argv->GetThread();
|
JSThread *thread = argv->GetThread();
|
||||||
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||||
|
|
||||||
JSHandle<JSObject> revoke_obj(GetThis(argv));
|
JSHandle<JSObject> revokeObj(GetThis(argv));
|
||||||
JSHandle<JSTaggedValue> revokeKey = thread->GlobalConstants()->GetHandledRevokeString();
|
JSHandle<JSTaggedValue> revokeKey = thread->GlobalConstants()->GetHandledRevokeString();
|
||||||
|
|
||||||
PropertyDescriptor desc(thread);
|
PropertyDescriptor desc(thread);
|
||||||
JSObject::GetOwnProperty(thread, revoke_obj, revokeKey, desc);
|
JSObject::GetOwnProperty(thread, revokeObj, revokeKey, desc);
|
||||||
JSProxyRevocFunction::ProxyRevocFunctions(thread, JSHandle<JSProxyRevocFunction>(desc.GetValue()));
|
JSProxyRevocFunction::ProxyRevocFunctions(thread, JSHandle<JSProxyRevocFunction>(desc.GetValue()));
|
||||||
return JSTaggedValue::Undefined();
|
return JSTaggedValue::Undefined();
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ JSTaggedValue BuiltinsRegExp::RegExpConstructor(EcmaRuntimeCallInfo *argv)
|
|||||||
auto ecmaVm = thread->GetEcmaVM();
|
auto ecmaVm = thread->GetEcmaVM();
|
||||||
JSHandle<GlobalEnv> env = ecmaVm->GetGlobalEnv();
|
JSHandle<GlobalEnv> env = ecmaVm->GetGlobalEnv();
|
||||||
// disable gc
|
// disable gc
|
||||||
[[maybe_unused]] DisallowGarbageCollection no_gc;
|
[[maybe_unused]] DisallowGarbageCollection noGc;
|
||||||
// 4.a Let newTarget be the active function object.
|
// 4.a Let newTarget be the active function object.
|
||||||
newTarget = env->GetRegExpFunction();
|
newTarget = env->GetRegExpFunction();
|
||||||
JSHandle<JSTaggedValue> constructorString = globalConst->GetHandledConstructorString();
|
JSHandle<JSTaggedValue> constructorString = globalConst->GetHandledConstructorString();
|
||||||
|
@ -519,11 +519,11 @@ JSTaggedValue BuiltinsString::LocaleCompare(EcmaRuntimeCallInfo *argv)
|
|||||||
BUILTINS_API_TRACE(argv->GetThread(), String, LocaleCompare);
|
BUILTINS_API_TRACE(argv->GetThread(), String, LocaleCompare);
|
||||||
JSThread *thread = argv->GetThread();
|
JSThread *thread = argv->GetThread();
|
||||||
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||||
JSHandle<JSTaggedValue> that_tag = BuiltinsString::GetCallArg(argv, 0);
|
JSHandle<JSTaggedValue> thatTag = BuiltinsString::GetCallArg(argv, 0);
|
||||||
JSHandle<JSTaggedValue> thisTag(JSTaggedValue::RequireObjectCoercible(thread, GetThis(argv)));
|
JSHandle<JSTaggedValue> thisTag(JSTaggedValue::RequireObjectCoercible(thread, GetThis(argv)));
|
||||||
JSHandle<EcmaString> thisHandle = JSTaggedValue::ToString(thread, thisTag);
|
JSHandle<EcmaString> thisHandle = JSTaggedValue::ToString(thread, thisTag);
|
||||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||||
JSHandle<EcmaString> thatHandle = JSTaggedValue::ToString(thread, that_tag);
|
JSHandle<EcmaString> thatHandle = JSTaggedValue::ToString(thread, thatTag);
|
||||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||||
|
|
||||||
JSHandle<JSTaggedValue> locales = GetCallArg(argv, 1);
|
JSHandle<JSTaggedValue> locales = GetCallArg(argv, 1);
|
||||||
|
@ -117,10 +117,10 @@ HWTEST_F_L0(BuiltinsMapTest, CreateAndGetSize)
|
|||||||
}
|
}
|
||||||
JSHandle<TaggedArray> array(factory->NewTaggedArray(5));
|
JSHandle<TaggedArray> array(factory->NewTaggedArray(5));
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
JSHandle<TaggedArray> internal_array(factory->NewTaggedArray(2));
|
JSHandle<TaggedArray> internalArray(factory->NewTaggedArray(2));
|
||||||
internal_array->Set(thread, 0, JSTaggedValue(i));
|
internalArray->Set(thread, 0, JSTaggedValue(i));
|
||||||
internal_array->Set(thread, 1, JSTaggedValue(i));
|
internalArray->Set(thread, 1, JSTaggedValue(i));
|
||||||
auto arr = JSArray::CreateArrayFromList(thread, internal_array);
|
auto arr = JSArray::CreateArrayFromList(thread, internalArray);
|
||||||
array->Set(thread, i, arr);
|
array->Set(thread, i, arr);
|
||||||
}
|
}
|
||||||
JSHandle<JSArray> values = JSArray::CreateArrayFromList(thread, array);
|
JSHandle<JSArray> values = JSArray::CreateArrayFromList(thread, array);
|
||||||
|
@ -572,18 +572,18 @@ HWTEST_F_L0(BuiltinsStringTest, toLocaleLowerCase2)
|
|||||||
{
|
{
|
||||||
ASSERT_NE(thread, nullptr);
|
ASSERT_NE(thread, nullptr);
|
||||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||||
JSHandle<EcmaString> this_str = factory->NewFromUtf8("有ABC");
|
JSHandle<EcmaString> thisStr = factory->NewFromUtf8("有ABC");
|
||||||
|
|
||||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4);
|
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4);
|
||||||
ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
|
ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
|
||||||
ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue());
|
ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue());
|
||||||
|
|
||||||
[[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo);
|
[[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo);
|
||||||
JSTaggedValue result = BuiltinsString::ToLocaleLowerCase(ecmaRuntimeCallInfo);
|
JSTaggedValue result = BuiltinsString::ToLocaleLowerCase(ecmaRuntimeCallInfo);
|
||||||
ASSERT_TRUE(result.IsString());
|
ASSERT_TRUE(result.IsString());
|
||||||
JSHandle<EcmaString> result_handle(thread, reinterpret_cast<EcmaString *>(result.GetRawData()));
|
JSHandle<EcmaString> resultHandle(thread, reinterpret_cast<EcmaString *>(result.GetRawData()));
|
||||||
JSHandle<EcmaString> test = factory->NewFromUtf8("有abc");
|
JSHandle<EcmaString> test = factory->NewFromUtf8("有abc");
|
||||||
ASSERT_EQ(EcmaStringAccessor::Compare(instance, result_handle, test), 0);
|
ASSERT_EQ(EcmaStringAccessor::Compare(instance, resultHandle, test), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// "ABC".toLowerCase()
|
// "ABC".toLowerCase()
|
||||||
@ -737,20 +737,20 @@ HWTEST_F_L0(BuiltinsStringTest, normalize1)
|
|||||||
{
|
{
|
||||||
ASSERT_NE(thread, nullptr);
|
ASSERT_NE(thread, nullptr);
|
||||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||||
JSHandle<EcmaString> this_str = factory->NewFromASCII("abc");
|
JSHandle<EcmaString> thisStr = factory->NewFromASCII("abc");
|
||||||
JSHandle<EcmaString> val = factory->NewFromASCII("NFC");
|
JSHandle<EcmaString> val = factory->NewFromASCII("NFC");
|
||||||
|
|
||||||
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6);
|
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6);
|
||||||
ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
|
ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
|
||||||
ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue());
|
ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue());
|
||||||
ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue());
|
ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue());
|
||||||
|
|
||||||
[[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo);
|
[[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo);
|
||||||
JSTaggedValue result = BuiltinsString::Normalize(ecmaRuntimeCallInfo);
|
JSTaggedValue result = BuiltinsString::Normalize(ecmaRuntimeCallInfo);
|
||||||
ASSERT_TRUE(result.IsString());
|
ASSERT_TRUE(result.IsString());
|
||||||
JSHandle<EcmaString> result_handle(thread, reinterpret_cast<EcmaString *>(result.GetRawData()));
|
JSHandle<EcmaString> resultHandle(thread, reinterpret_cast<EcmaString *>(result.GetRawData()));
|
||||||
JSHandle<EcmaString> test = factory->NewFromASCII("abc");
|
JSHandle<EcmaString> test = factory->NewFromASCII("abc");
|
||||||
ASSERT_EQ(EcmaStringAccessor::Compare(instance, result_handle, test), 0);
|
ASSERT_EQ(EcmaStringAccessor::Compare(instance, resultHandle, test), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// "abc".repeat(5)
|
// "abc".repeat(5)
|
||||||
|
@ -102,11 +102,11 @@ HWTEST_F_L0(BuiltinsWeakMapTest, CreateAndGetSize)
|
|||||||
JSHandle<JSWeakMap> map(thread, CreateBuiltinsWeakMap(thread));
|
JSHandle<JSWeakMap> map(thread, CreateBuiltinsWeakMap(thread));
|
||||||
|
|
||||||
JSHandle<TaggedArray> array(factory->NewTaggedArray(1));
|
JSHandle<TaggedArray> array(factory->NewTaggedArray(1));
|
||||||
JSHandle<TaggedArray> internal_array(factory->NewTaggedArray(2));
|
JSHandle<TaggedArray> internalArray(factory->NewTaggedArray(2));
|
||||||
JSTaggedValue value(JSObjectTestCreate(thread));
|
JSTaggedValue value(JSObjectTestCreate(thread));
|
||||||
internal_array->Set(thread, 0, value);
|
internalArray->Set(thread, 0, value);
|
||||||
internal_array->Set(thread, 1, JSTaggedValue(0));
|
internalArray->Set(thread, 1, JSTaggedValue(0));
|
||||||
auto result = JSArray::CreateArrayFromList(thread, internal_array);
|
auto result = JSArray::CreateArrayFromList(thread, internalArray);
|
||||||
array->Set(thread, 0, result);
|
array->Set(thread, 0, result);
|
||||||
|
|
||||||
JSHandle<JSArray> values = JSArray::CreateArrayFromList(thread, array);
|
JSHandle<JSArray> values = JSArray::CreateArrayFromList(thread, array);
|
||||||
|
@ -200,7 +200,7 @@ void AsyncFunctionLowering::UpdateValueSelector(GateRef prevLoopBeginGate,
|
|||||||
|
|
||||||
bool AsyncFunctionLowering::IsAsyncRelated() const
|
bool AsyncFunctionLowering::IsAsyncRelated() const
|
||||||
{
|
{
|
||||||
return bcBuilder_->GetAsyncRelatedGates().size() > 0;
|
return bcBuilder_->GetAsyncRelatedGates().size() > 0;
|
||||||
}
|
}
|
||||||
} // panda::ecmascript::kungfu
|
} // panda::ecmascript::kungfu
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ void Circuit::PrintAllGatesWithBytecode() const
|
|||||||
for (const auto &gate : gateList) {
|
for (const auto &gate : gateList) {
|
||||||
if (GetOpCode(gate) == OpCode::JS_BYTECODE) {
|
if (GetOpCode(gate) == OpCode::JS_BYTECODE) {
|
||||||
const Gate *gatePtr = LoadGatePtrConst(gate);
|
const Gate *gatePtr = LoadGatePtrConst(gate);
|
||||||
auto opcode = gatePtr->GetJSBytecodeMetaData()->GetByteCodeOpcode();
|
auto opcode = gatePtr->GetJSBytecodeMetaData()->GetByteCodeOpcode();
|
||||||
std::string bytecodeStr = GetEcmaOpcodeStr(opcode);
|
std::string bytecodeStr = GetEcmaOpcodeStr(opcode);
|
||||||
LoadGatePtrConst(gate)->PrintByteCode(bytecodeStr);
|
LoadGatePtrConst(gate)->PrintByteCode(bytecodeStr);
|
||||||
} else {
|
} else {
|
||||||
|
@ -724,7 +724,7 @@ GateRef CircuitBuilder::GetObjectFromConstPool(GateRef glue, GateRef constPool,
|
|||||||
{ constPool, Int32ToTaggedInt(index), module });
|
{ constPool, Int32ToTaggedInt(index), module });
|
||||||
Jump(&exit);
|
Jump(&exit);
|
||||||
}
|
}
|
||||||
} else if (type == ConstPoolType::OBJECT_LITERAL) {
|
} else if (type == ConstPoolType::OBJECT_LITERAL) {
|
||||||
Label isAOTLiteralInfo(env_);
|
Label isAOTLiteralInfo(env_);
|
||||||
Branch(IsAOTLiteralInfo(*result), &isAOTLiteralInfo, &exit);
|
Branch(IsAOTLiteralInfo(*result), &isAOTLiteralInfo, &exit);
|
||||||
Bind(&isAOTLiteralInfo);
|
Bind(&isAOTLiteralInfo);
|
||||||
|
@ -47,7 +47,7 @@ std::string MachineTypeToStr(MachineType machineType)
|
|||||||
std::string GateMetaData::Str(OpCode opcode)
|
std::string GateMetaData::Str(OpCode opcode)
|
||||||
{
|
{
|
||||||
const std::map<OpCode, const char *> strMap = {
|
const std::map<OpCode, const char *> strMap = {
|
||||||
#define GATE_NAME_MAP(NAME, OP, R, S, D, V) { OpCode::OP, #OP },
|
#define GATE_NAME_MAP(NAME, OP, R, S, D, V) { OpCode::OP, #OP },
|
||||||
IMMUTABLE_META_DATA_CACHE_LIST(GATE_NAME_MAP)
|
IMMUTABLE_META_DATA_CACHE_LIST(GATE_NAME_MAP)
|
||||||
GATE_META_DATA_LIST_WITH_SIZE(GATE_NAME_MAP)
|
GATE_META_DATA_LIST_WITH_SIZE(GATE_NAME_MAP)
|
||||||
GATE_META_DATA_LIST_WITH_ONE_PARAMETER(GATE_NAME_MAP)
|
GATE_META_DATA_LIST_WITH_ONE_PARAMETER(GATE_NAME_MAP)
|
||||||
|
@ -40,8 +40,8 @@ void TypeRecorder::LoadTypes(const JSPandaFile *jsPandaFile, const MethodLiteral
|
|||||||
const panda_file::File *pf = jsPandaFile->GetPandaFile();
|
const panda_file::File *pf = jsPandaFile->GetPandaFile();
|
||||||
panda_file::File::EntityId fieldId = methodLiteral->GetMethodId();
|
panda_file::File::EntityId fieldId = methodLiteral->GetMethodId();
|
||||||
panda_file::MethodDataAccessor mda(*pf, fieldId);
|
panda_file::MethodDataAccessor mda(*pf, fieldId);
|
||||||
mda.EnumerateAnnotations([&](panda_file::File::EntityId annotation_id) {
|
mda.EnumerateAnnotations([&](panda_file::File::EntityId annotationId) {
|
||||||
panda_file::AnnotationDataAccessor ada(*pf, annotation_id);
|
panda_file::AnnotationDataAccessor ada(*pf, annotationId);
|
||||||
auto *annotationName = reinterpret_cast<const char *>(pf->GetStringData(ada.GetClassId()).data);
|
auto *annotationName = reinterpret_cast<const char *>(pf->GetStringData(ada.GetClassId()).data);
|
||||||
ASSERT(annotationName != nullptr);
|
ASSERT(annotationName != nullptr);
|
||||||
if (::strcmp("L_ESTypeAnnotation;", annotationName) != 0) {
|
if (::strcmp("L_ESTypeAnnotation;", annotationName) != 0) {
|
||||||
|
@ -138,7 +138,7 @@ JSTaggedValue ContainersLightWeightSet::GetValueAt(EcmaRuntimeCallInfo *argv)
|
|||||||
self = JSHandle<JSTaggedValue>(thread, JSHandle<JSProxy>::Cast(self)->GetTarget());
|
self = JSHandle<JSTaggedValue>(thread, JSHandle<JSProxy>::Cast(self)->GetTarget());
|
||||||
} else {
|
} else {
|
||||||
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::BIND_ERROR,
|
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::BIND_ERROR,
|
||||||
"The getValueAt method cannot be bound");;
|
"The getValueAt method cannot be bound");
|
||||||
THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
|
THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -534,4 +534,4 @@ JSTaggedValue ContainersLightWeightSet::GetSize(EcmaRuntimeCallInfo *argv)
|
|||||||
}
|
}
|
||||||
return JSTaggedValue(JSHandle<JSAPILightWeightSet>::Cast(self)->GetSize());
|
return JSTaggedValue(JSHandle<JSAPILightWeightSet>::Cast(self)->GetSize());
|
||||||
}
|
}
|
||||||
} // namespace panda::ecmascript::containers
|
} // namespace panda::ecmascript::containers
|
||||||
|
@ -277,7 +277,7 @@ HWTEST_F_L0(ContainersListTest, Equal)
|
|||||||
|
|
||||||
// Length Not Equal
|
// Length Not Equal
|
||||||
JSHandle<JSAPIList> list2 = CreateJSAPIList();
|
JSHandle<JSAPIList> list2 = CreateJSAPIList();
|
||||||
for (uint32_t i = 0; i < NODE_NUMBERS / 2 ; i++) {
|
for (uint32_t i = 0; i < NODE_NUMBERS / 2; i++) {
|
||||||
result = ListAdd(list2, JSTaggedValue(i));
|
result = ListAdd(list2, JSTaggedValue(i));
|
||||||
EXPECT_EQ(result, JSTaggedValue::True());
|
EXPECT_EQ(result, JSTaggedValue::True());
|
||||||
EXPECT_EQ(result, JSTaggedValue::True());
|
EXPECT_EQ(result, JSTaggedValue::True());
|
||||||
@ -593,4 +593,4 @@ HWTEST_F_L0(ContainersListTest, SpecialReturn)
|
|||||||
EXPECT_EQ(result, JSTaggedValue::False());
|
EXPECT_EQ(result, JSTaggedValue::False());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace panda::test
|
} // namespace panda::test
|
||||||
|
@ -89,7 +89,7 @@ struct AsmStackContext : public base::AlignedStruct<base::AlignedPointer::Size()
|
|||||||
class FrameWriter;
|
class FrameWriter;
|
||||||
class Deoptimizier {
|
class Deoptimizier {
|
||||||
public:
|
public:
|
||||||
explicit Deoptimizier(JSThread * thread) : thread_(thread)
|
explicit Deoptimizier(JSThread *thread) : thread_(thread)
|
||||||
{
|
{
|
||||||
kungfu::CalleeReg callreg;
|
kungfu::CalleeReg callreg;
|
||||||
numCalleeRegs_ = static_cast<size_t>(callreg.GetCallRegNum());
|
numCalleeRegs_ = static_cast<size_t>(callreg.GetCallRegNum());
|
||||||
|
@ -328,7 +328,7 @@ inline size_t EcmaStringAccessor::GetUtf8Length() const
|
|||||||
return string_->GetUtf8Length();
|
return string_->GetUtf8Length();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void EcmaStringAccessor::ReadData(EcmaString * dst, EcmaString *src,
|
inline void EcmaStringAccessor::ReadData(EcmaString *dst, EcmaString *src,
|
||||||
uint32_t start, uint32_t destSize, uint32_t length)
|
uint32_t start, uint32_t destSize, uint32_t length)
|
||||||
{
|
{
|
||||||
dst->WriteData(src, start, destSize, length);
|
dst->WriteData(src, start, destSize, length);
|
||||||
|
@ -221,8 +221,8 @@ JSHandle<JSDisplayNames> JSDisplayNames::InitializeDisplayNames(JSThread *thread
|
|||||||
LOG_ECMA(FATAL) << "this branch is unreachable";
|
LOG_ECMA(FATAL) << "this branch is unreachable";
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
UDisplayContext display_context[] = {uStyle};
|
UDisplayContext displayContext[] = {uStyle};
|
||||||
icu::LocaleDisplayNames *icudisplaynames(icu::LocaleDisplayNames::createInstance(icuLocale, display_context, 1));
|
icu::LocaleDisplayNames *icudisplaynames(icu::LocaleDisplayNames::createInstance(icuLocale, displayContext, 1));
|
||||||
SetIcuLocaleDisplayNames(thread, displayNames, icudisplaynames, JSDisplayNames::FreeIcuLocaleDisplayNames);
|
SetIcuLocaleDisplayNames(thread, displayNames, icudisplaynames, JSDisplayNames::FreeIcuLocaleDisplayNames);
|
||||||
return displayNames;
|
return displayNames;
|
||||||
}
|
}
|
||||||
|
@ -716,7 +716,7 @@ std::string JSLocale::UnicodeExtensionValue(const std::string extension, const s
|
|||||||
size_t e = extension.find("-", k);
|
size_t e = extension.find("-", k);
|
||||||
size_t len;
|
size_t len;
|
||||||
// ii. If e = -1, let len be size - k; else let len be e - k.
|
// ii. If e = -1, let len be size - k; else let len be e - k.
|
||||||
if (e == std::string::npos) {
|
if (e == std::string::npos) {
|
||||||
len = size - k;
|
len = size - k;
|
||||||
} else {
|
} else {
|
||||||
len = e - k;
|
len = e - k;
|
||||||
@ -820,7 +820,7 @@ ResolvedLocale JSLocale::ResolveLocale(JSThread *thread, const JSHandle<TaggedAr
|
|||||||
|
|
||||||
// g. Let supportedExtensionAddition be "".
|
// g. Let supportedExtensionAddition be "".
|
||||||
// h. If r has an [[extension]] field, then
|
// h. If r has an [[extension]] field, then
|
||||||
std::string supportedExtensionAddition;
|
std::string supportedExtensionAddition;
|
||||||
size_t found = foundLocale.find("-u-");
|
size_t found = foundLocale.find("-u-");
|
||||||
if (found != std::string::npos) {
|
if (found != std::string::npos) {
|
||||||
std::string extension = foundLocale.substr(found + INTL_INDEX_ONE);
|
std::string extension = foundLocale.substr(found + INTL_INDEX_ONE);
|
||||||
|
@ -359,8 +359,8 @@ public:
|
|||||||
|
|
||||||
static bool IsWellCollation(const icu::Locale &locale, const std::string &value)
|
static bool IsWellCollation(const icu::Locale &locale, const std::string &value)
|
||||||
{
|
{
|
||||||
std::set<std::string> irregularList = {"standard", "search"};
|
std::set<std::string> irregularList = {"standard", "search"};
|
||||||
if (irregularList.find(value) != irregularList.end()) {
|
if (irregularList.find(value) != irregularList.end()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return IsWellExtension<icu::Collator>(locale, "collation", value);
|
return IsWellExtension<icu::Collator>(locale, "collation", value);
|
||||||
@ -435,7 +435,7 @@ public:
|
|||||||
if (value.length() < 3) {
|
if (value.length() < 3) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
char lastChar = value[value.length() - 1];
|
char lastChar = value[value.length() - 1];
|
||||||
if (lastChar == '-') {
|
if (lastChar == '-') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -745,13 +745,13 @@ JSHandle<TaggedArray> JSProxy::OwnPropertyKeys(JSThread *thread, const JSHandle<
|
|||||||
info->SetCallArg(targetHandle.GetTaggedValue());
|
info->SetCallArg(targetHandle.GetTaggedValue());
|
||||||
JSTaggedValue res = JSFunction::Call(info);
|
JSTaggedValue res = JSFunction::Call(info);
|
||||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(TaggedArray, thread);
|
RETURN_HANDLE_IF_ABRUPT_COMPLETION(TaggedArray, thread);
|
||||||
JSHandle<JSTaggedValue> trap_res_arr(thread, res);
|
JSHandle<JSTaggedValue> trapResArr(thread, res);
|
||||||
|
|
||||||
// 9.Let trapResult be CreateListFromArrayLike(trapResultArray, «String, Symbol»).
|
// 9.Let trapResult be CreateListFromArrayLike(trapResultArray, «String, Symbol»).
|
||||||
// 10.ReturnIfAbrupt(trapResult)
|
// 10.ReturnIfAbrupt(trapResult)
|
||||||
// If trapResult contains any duplicate entries, throw a TypeError exception.
|
// If trapResult contains any duplicate entries, throw a TypeError exception.
|
||||||
JSHandle<TaggedArray> trapRes(
|
JSHandle<TaggedArray> trapRes(
|
||||||
JSObject::CreateListFromArrayLike<ElementTypes::STRING_AND_SYMBOL>(thread, trap_res_arr));
|
JSObject::CreateListFromArrayLike<ElementTypes::STRING_AND_SYMBOL>(thread, trapResArr));
|
||||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(TaggedArray, thread);
|
RETURN_HANDLE_IF_ABRUPT_COMPLETION(TaggedArray, thread);
|
||||||
|
|
||||||
if (trapRes->HasDuplicateEntry()) {
|
if (trapRes->HasDuplicateEntry()) {
|
||||||
|
@ -379,7 +379,7 @@ public:
|
|||||||
if (pos != std::string::npos) {
|
if (pos != std::string::npos) {
|
||||||
std::string strStart = strAsmOpcodeDisableRange.substr(0, pos);
|
std::string strStart = strAsmOpcodeDisableRange.substr(0, pos);
|
||||||
std::string strEnd = strAsmOpcodeDisableRange.substr(pos + 1);
|
std::string strEnd = strAsmOpcodeDisableRange.substr(pos + 1);
|
||||||
int start = strStart.empty() ? 0 : std::stoi(strStart);
|
int start = strStart.empty() ? 0 : std::stoi(strStart);
|
||||||
int end = strEnd.empty() ? kungfu::BYTECODE_STUB_END_ID : std::stoi(strEnd);
|
int end = strEnd.empty() ? kungfu::BYTECODE_STUB_END_ID : std::stoi(strEnd);
|
||||||
if (start >= 0 && start < kungfu::BytecodeStubCSigns::NUM_OF_ALL_NORMAL_STUBS &&
|
if (start >= 0 && start < kungfu::BytecodeStubCSigns::NUM_OF_ALL_NORMAL_STUBS &&
|
||||||
end >= 0 && end < kungfu::BytecodeStubCSigns::NUM_OF_ALL_NORMAL_STUBS &&
|
end >= 0 && end < kungfu::BytecodeStubCSigns::NUM_OF_ALL_NORMAL_STUBS &&
|
||||||
|
@ -241,9 +241,9 @@ bool JSTaggedValue::Equal(JSThread *thread, const JSHandle<JSTaggedValue> &x, co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (y->IsNumber() || y->IsStringOrSymbol() || y->IsBoolean() || y->IsBigInt()) {
|
if (y->IsNumber() || y->IsStringOrSymbol() || y->IsBoolean() || y->IsBigInt()) {
|
||||||
JSHandle<JSTaggedValue> x_primitive(thread, ToPrimitive(thread, x));
|
JSHandle<JSTaggedValue> xPrimitive(thread, ToPrimitive(thread, x));
|
||||||
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false);
|
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false);
|
||||||
return Equal(thread, x_primitive, y);
|
return Equal(thread, xPrimitive, y);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -887,8 +887,8 @@ bool JSTaggedValue::HasProperty(JSThread *thread, const JSHandle<JSTaggedValue>
|
|||||||
return JSProxy::HasProperty(thread, JSHandle<JSProxy>(obj), keyHandle);
|
return JSProxy::HasProperty(thread, JSHandle<JSProxy>(obj), keyHandle);
|
||||||
}
|
}
|
||||||
if (obj->IsTypedArray()) {
|
if (obj->IsTypedArray()) {
|
||||||
JSHandle<JSTaggedValue> key_handle(thread, JSTaggedValue(key));
|
JSHandle<JSTaggedValue> keyHandle(thread, JSTaggedValue(key));
|
||||||
return JSTypedArray::HasProperty(thread, obj, key_handle);
|
return JSTypedArray::HasProperty(thread, obj, keyHandle);
|
||||||
}
|
}
|
||||||
if (obj->IsSpecialContainer()) {
|
if (obj->IsSpecialContainer()) {
|
||||||
return HasContainerProperty(thread, obj, JSHandle<JSTaggedValue>(thread, JSTaggedValue(key)));
|
return HasContainerProperty(thread, obj, JSHandle<JSTaggedValue>(thread, JSTaggedValue(key)));
|
||||||
|
@ -309,7 +309,7 @@ public:
|
|||||||
return DeoptCountBits::Decode(literalInfo);
|
return DeoptCountBits::Decode(literalInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char * PUBLIC_API GetMethodName(const JSPandaFile *jsPandaFile, EntityId methodId);
|
static const char PUBLIC_API *GetMethodName(const JSPandaFile *jsPandaFile, EntityId methodId);
|
||||||
static std::string PUBLIC_API ParseFunctionName(const JSPandaFile *jsPandaFile, EntityId methodId);
|
static std::string PUBLIC_API ParseFunctionName(const JSPandaFile *jsPandaFile, EntityId methodId);
|
||||||
static uint32_t GetCodeSize(const JSPandaFile *jsPandaFile, EntityId methodId);
|
static uint32_t GetCodeSize(const JSPandaFile *jsPandaFile, EntityId methodId);
|
||||||
static CString GetRecordName(const JSPandaFile *jsPandaFile, EntityId methodId);
|
static CString GetRecordName(const JSPandaFile *jsPandaFile, EntityId methodId);
|
||||||
|
@ -73,8 +73,8 @@ HWTEST_F_L0(JSPandaFileExecutorTest, Execute)
|
|||||||
JSPandaFile *pf = pfManager->NewJSPandaFile(pfPtr.release(), CString(fileName));
|
JSPandaFile *pf = pfManager->NewJSPandaFile(pfPtr.release(), CString(fileName));
|
||||||
const uint8_t *typeDesc = utf::CStringAsMutf8("L_GLOBAL;");
|
const uint8_t *typeDesc = utf::CStringAsMutf8("L_GLOBAL;");
|
||||||
const File *file = pf->GetPandaFile();
|
const File *file = pf->GetPandaFile();
|
||||||
File::EntityId class_id = file->GetClassId(typeDesc);
|
File::EntityId classId = file->GetClassId(typeDesc);
|
||||||
ClassDataAccessor cda(*file, class_id);
|
ClassDataAccessor cda(*file, classId);
|
||||||
std::vector<File::EntityId> methodId {};
|
std::vector<File::EntityId> methodId {};
|
||||||
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
|
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
|
||||||
methodId.push_back(mda.GetMethodId());
|
methodId.push_back(mda.GetMethodId());
|
||||||
@ -108,8 +108,8 @@ HWTEST_F_L0(JSPandaFileExecutorTest, ExecuteFromFile)
|
|||||||
JSPandaFile *pf = pfManager->NewJSPandaFile(pfPtr.release(), CString(fileName));
|
JSPandaFile *pf = pfManager->NewJSPandaFile(pfPtr.release(), CString(fileName));
|
||||||
const uint8_t *typeDesc = utf::CStringAsMutf8("L_GLOBAL;");
|
const uint8_t *typeDesc = utf::CStringAsMutf8("L_GLOBAL;");
|
||||||
const File *file = pf->GetPandaFile();
|
const File *file = pf->GetPandaFile();
|
||||||
File::EntityId class_id = file->GetClassId(typeDesc);
|
File::EntityId classId = file->GetClassId(typeDesc);
|
||||||
ClassDataAccessor cda(*file, class_id);
|
ClassDataAccessor cda(*file, classId);
|
||||||
std::vector<File::EntityId> methodId {};
|
std::vector<File::EntityId> methodId {};
|
||||||
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
|
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
|
||||||
methodId.push_back(mda.GetMethodId());
|
methodId.push_back(mda.GetMethodId());
|
||||||
@ -146,8 +146,8 @@ HWTEST_F_L0(JSPandaFileExecutorTest, ExecuteFromBuffer)
|
|||||||
JSPandaFile *pf = pfManager->NewJSPandaFile(pfPtr.release(), CString(fileName));
|
JSPandaFile *pf = pfManager->NewJSPandaFile(pfPtr.release(), CString(fileName));
|
||||||
const uint8_t *typeDesc = utf::CStringAsMutf8("L_GLOBAL;");
|
const uint8_t *typeDesc = utf::CStringAsMutf8("L_GLOBAL;");
|
||||||
const File *file = pf->GetPandaFile();
|
const File *file = pf->GetPandaFile();
|
||||||
File::EntityId class_id = file->GetClassId(typeDesc);
|
File::EntityId classId = file->GetClassId(typeDesc);
|
||||||
ClassDataAccessor cda(*file, class_id);
|
ClassDataAccessor cda(*file, classId);
|
||||||
std::vector<File::EntityId> methodId {};
|
std::vector<File::EntityId> methodId {};
|
||||||
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
|
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
|
||||||
methodId.push_back(mda.GetMethodId());
|
methodId.push_back(mda.GetMethodId());
|
||||||
|
@ -180,8 +180,8 @@ HWTEST_F_L0(JSPandaFileManagerTest, GenerateProgram)
|
|||||||
std::unique_ptr<const File> pfPtr = pandasm::AsmEmitter::Emit(res.Value());
|
std::unique_ptr<const File> pfPtr = pandasm::AsmEmitter::Emit(res.Value());
|
||||||
JSPandaFile *pf = pfManager->NewJSPandaFile(pfPtr.release(), CString(filename));
|
JSPandaFile *pf = pfManager->NewJSPandaFile(pfPtr.release(), CString(filename));
|
||||||
const File *file = pf->GetPandaFile();
|
const File *file = pf->GetPandaFile();
|
||||||
File::EntityId class_id = file->GetClassId(typeDesc);
|
File::EntityId classId = file->GetClassId(typeDesc);
|
||||||
ClassDataAccessor cda(*file, class_id);
|
ClassDataAccessor cda(*file, classId);
|
||||||
std::vector<File::EntityId> methodId {};
|
std::vector<File::EntityId> methodId {};
|
||||||
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
|
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
|
||||||
methodId.push_back(mda.GetMethodId());
|
methodId.push_back(mda.GetMethodId());
|
||||||
|
@ -131,10 +131,10 @@ HWTEST_F_L0(JSPandaFileTest, SetMethodLiteralToMap_FindMethodLiteral)
|
|||||||
JSPandaFile *pf = CreateJSPandaFile(source, fileName);
|
JSPandaFile *pf = CreateJSPandaFile(source, fileName);
|
||||||
const File *file = pf->GetPandaFile();
|
const File *file = pf->GetPandaFile();
|
||||||
const uint8_t *typeDesc = utf::CStringAsMutf8("L_GLOBAL;");
|
const uint8_t *typeDesc = utf::CStringAsMutf8("L_GLOBAL;");
|
||||||
File::EntityId class_id = file->GetClassId(typeDesc);
|
File::EntityId classId = file->GetClassId(typeDesc);
|
||||||
EXPECT_TRUE(class_id.IsValid());
|
EXPECT_TRUE(classId.IsValid());
|
||||||
|
|
||||||
ClassDataAccessor cda(*file, class_id);
|
ClassDataAccessor cda(*file, classId);
|
||||||
std::vector<File::EntityId> methodId {};
|
std::vector<File::EntityId> methodId {};
|
||||||
int count = 0;
|
int count = 0;
|
||||||
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
|
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
|
||||||
@ -166,10 +166,10 @@ HWTEST_F_L0(JSPandaFileTest, GetOrInsertConstantPool_GetConstpoolIndex_GetConstp
|
|||||||
JSPandaFile *pf = CreateJSPandaFile(source, fileName);
|
JSPandaFile *pf = CreateJSPandaFile(source, fileName);
|
||||||
const File *file = pf->GetPandaFile();
|
const File *file = pf->GetPandaFile();
|
||||||
const uint8_t *typeDesc = utf::CStringAsMutf8("L_GLOBAL;");
|
const uint8_t *typeDesc = utf::CStringAsMutf8("L_GLOBAL;");
|
||||||
File::EntityId class_id = file->GetClassId(typeDesc);
|
File::EntityId classId = file->GetClassId(typeDesc);
|
||||||
EXPECT_TRUE(class_id.IsValid());
|
EXPECT_TRUE(classId.IsValid());
|
||||||
|
|
||||||
ClassDataAccessor cda(*file, class_id);
|
ClassDataAccessor cda(*file, classId);
|
||||||
std::vector<File::EntityId> methodId {};
|
std::vector<File::EntityId> methodId {};
|
||||||
int count = 0;
|
int count = 0;
|
||||||
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
|
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
|
||||||
@ -217,10 +217,10 @@ HWTEST_F_L0(JSPandaFileTest, GetMainMethodIndex_UpdateMainMethodIndex)
|
|||||||
JSPandaFile *pf = CreateJSPandaFile(source, fileName);
|
JSPandaFile *pf = CreateJSPandaFile(source, fileName);
|
||||||
const File *file = pf->GetPandaFile();
|
const File *file = pf->GetPandaFile();
|
||||||
const uint8_t *typeDesc = utf::CStringAsMutf8("L_GLOBAL;");
|
const uint8_t *typeDesc = utf::CStringAsMutf8("L_GLOBAL;");
|
||||||
File::EntityId class_id = file->GetClassId(typeDesc);
|
File::EntityId classId = file->GetClassId(typeDesc);
|
||||||
EXPECT_TRUE(class_id.IsValid());
|
EXPECT_TRUE(classId.IsValid());
|
||||||
|
|
||||||
ClassDataAccessor cda(*file, class_id);
|
ClassDataAccessor cda(*file, classId);
|
||||||
std::vector<File::EntityId> methodId {};
|
std::vector<File::EntityId> methodId {};
|
||||||
int count = 0;
|
int count = 0;
|
||||||
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
|
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
|
||||||
@ -251,8 +251,8 @@ HWTEST_F_L0(JSPandaFileTest, GetClasses)
|
|||||||
JSPandaFile *pf = CreateJSPandaFile(source, fileName);
|
JSPandaFile *pf = CreateJSPandaFile(source, fileName);
|
||||||
const File *file = pf->GetPandaFile();
|
const File *file = pf->GetPandaFile();
|
||||||
const uint8_t *typeDesc = utf::CStringAsMutf8("L_GLOBAL;");
|
const uint8_t *typeDesc = utf::CStringAsMutf8("L_GLOBAL;");
|
||||||
File::EntityId class_id = file->GetClassId(typeDesc);
|
File::EntityId classId = file->GetClassId(typeDesc);
|
||||||
EXPECT_TRUE(class_id.IsValid());
|
EXPECT_TRUE(classId.IsValid());
|
||||||
|
|
||||||
const File::Header *header = file->GetHeader();
|
const File::Header *header = file->GetHeader();
|
||||||
Span fileData(file->GetBase(), header->file_size);
|
Span fileData(file->GetBase(), header->file_size);
|
||||||
|
@ -73,8 +73,8 @@ HWTEST_F_L0(PandaFileTranslatorTest, GenerateProgram)
|
|||||||
std::unique_ptr<const File> pfPtr = pandasm::AsmEmitter::Emit(res.Value());
|
std::unique_ptr<const File> pfPtr = pandasm::AsmEmitter::Emit(res.Value());
|
||||||
JSPandaFile *pf = pfManager->NewJSPandaFile(pfPtr.release(), CString(filename));
|
JSPandaFile *pf = pfManager->NewJSPandaFile(pfPtr.release(), CString(filename));
|
||||||
const File *file = pf->GetPandaFile();
|
const File *file = pf->GetPandaFile();
|
||||||
File::EntityId class_id = file->GetClassId(typeDesc);
|
File::EntityId classId = file->GetClassId(typeDesc);
|
||||||
ClassDataAccessor cda(*file, class_id);
|
ClassDataAccessor cda(*file, classId);
|
||||||
std::vector<File::EntityId> methodId {};
|
std::vector<File::EntityId> methodId {};
|
||||||
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
|
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
|
||||||
methodId.push_back(mda.GetMethodId());
|
methodId.push_back(mda.GetMethodId());
|
||||||
@ -118,8 +118,8 @@ HWTEST_F_L0(PandaFileTranslatorTest, TranslateClasses)
|
|||||||
std::unique_ptr<const File> pfPtr = pandasm::AsmEmitter::Emit(res.Value());
|
std::unique_ptr<const File> pfPtr = pandasm::AsmEmitter::Emit(res.Value());
|
||||||
JSPandaFile *pf = pfManager->NewJSPandaFile(pfPtr.release(), CString(filename));
|
JSPandaFile *pf = pfManager->NewJSPandaFile(pfPtr.release(), CString(filename));
|
||||||
const File *file = pf->GetPandaFile();
|
const File *file = pf->GetPandaFile();
|
||||||
File::EntityId class_id = file->GetClassId(typeDesc);
|
File::EntityId classId = file->GetClassId(typeDesc);
|
||||||
ClassDataAccessor cda(*file, class_id);
|
ClassDataAccessor cda(*file, classId);
|
||||||
std::vector<File::EntityId> methodId {};
|
std::vector<File::EntityId> methodId {};
|
||||||
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
|
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
|
||||||
methodId.push_back(mda.GetMethodId());
|
methodId.push_back(mda.GetMethodId());
|
||||||
|
@ -97,13 +97,13 @@ using AllowHeapAlloc = AssertScopeT<AssertType::HEAP_ALLOC_ASSERT, true, IS_ALLO
|
|||||||
|
|
||||||
#if (!defined NDEBUG) || (defined RUN_TEST)
|
#if (!defined NDEBUG) || (defined RUN_TEST)
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||||
#define DISALLOW_GARBAGE_COLLECTION [[maybe_unused]] DisallowGarbageCollection no_gc
|
#define DISALLOW_GARBAGE_COLLECTION [[maybe_unused]] DisallowGarbageCollection noGc
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||||
#define ALLOW_GARBAGE_COLLECTION [[maybe_unused]] AllowGarbageCollection allow_gc
|
#define ALLOW_GARBAGE_COLLECTION [[maybe_unused]] AllowGarbageCollection allowGc
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||||
#define DISALLOW_HEAP_ALLOC [[maybe_unused]] DisAllowHeapAlloc no_heap_alloc
|
#define DISALLOW_HEAP_ALLOC [[maybe_unused]] DisAllowHeapAlloc noHeapAlloc
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||||
#define ALLOW_HEAP_ALLOC [[maybe_unused]] AllowHeapAlloc allow_heap_alloc
|
#define ALLOW_HEAP_ALLOC [[maybe_unused]] AllowHeapAlloc allowHeapAlloc
|
||||||
#else
|
#else
|
||||||
#define DISALLOW_GARBAGE_COLLECTION
|
#define DISALLOW_GARBAGE_COLLECTION
|
||||||
#define ALLOW_GARBAGE_COLLECTION
|
#define ALLOW_GARBAGE_COLLECTION
|
||||||
|
@ -261,7 +261,7 @@ public:
|
|||||||
|
|
||||||
bool InNonMovableSpace() const
|
bool InNonMovableSpace() const
|
||||||
{
|
{
|
||||||
return packedData_.flags_.spaceFlag_ == RegionSpaceFlag::IN_NON_MOVABLE_SPACE;
|
return packedData_.flags_.spaceFlag_ == RegionSpaceFlag::IN_NON_MOVABLE_SPACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InSnapshotSpace() const
|
bool InSnapshotSpace() const
|
||||||
|
@ -284,7 +284,7 @@ bool DFXJSNApi::IsSuspended(const EcmaVM *vm)
|
|||||||
bool DFXJSNApi::CheckSafepoint(const EcmaVM *vm)
|
bool DFXJSNApi::CheckSafepoint(const EcmaVM *vm)
|
||||||
{
|
{
|
||||||
ecmascript::JSThread* thread = vm->GetJSThread();
|
ecmascript::JSThread* thread = vm->GetJSThread();
|
||||||
return thread->CheckSafepoint();
|
return thread->CheckSafepoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DFXJSNApi::BuildJsStackInfoList(const EcmaVM *hostVm, uint32_t tid, std::vector<JsFrameInfo>& jsFrames)
|
bool DFXJSNApi::BuildJsStackInfoList(const EcmaVM *hostVm, uint32_t tid, std::vector<JsFrameInfo>& jsFrames)
|
||||||
|
@ -120,7 +120,7 @@ public:
|
|||||||
|
|
||||||
inline size_t GetGroupNamesSize() const
|
inline size_t GetGroupNamesSize() const
|
||||||
{
|
{
|
||||||
return groupNames_.size_ ;
|
return groupNames_.size_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool IsError() const
|
inline bool IsError() const
|
||||||
|
@ -65,7 +65,7 @@ void LLVMStackMapParser::CalcCallSite()
|
|||||||
struct LocationTy loc = llvmStackMap_.StkMapRecord[recordNum + recordId].Locations[j];
|
struct LocationTy loc = llvmStackMap_.StkMapRecord[recordNum + recordId].Locations[j];
|
||||||
uint32_t instructionOffset = recordHead.InstructionOffset;
|
uint32_t instructionOffset = recordHead.InstructionOffset;
|
||||||
uintptr_t callsite = address + instructionOffset;
|
uintptr_t callsite = address + instructionOffset;
|
||||||
uint64_t patchPointID = recordHead.PatchPointID;
|
uint64_t patchPointID = recordHead.PatchPointID;
|
||||||
if (j == LocationTy::CONSTANT_DEOPT_CNT_INDEX) {
|
if (j == LocationTy::CONSTANT_DEOPT_CNT_INDEX) {
|
||||||
ASSERT(loc.location == LocationTy::Kind::CONSTANT);
|
ASSERT(loc.location == LocationTy::Kind::CONSTANT);
|
||||||
lastDeoptIndex = loc.OffsetOrSmallConstant + LocationTy::CONSTANT_DEOPT_CNT_INDEX;
|
lastDeoptIndex = loc.OffsetOrSmallConstant + LocationTy::CONSTANT_DEOPT_CNT_INDEX;
|
||||||
|
@ -86,7 +86,7 @@ struct StkMapRecordHeadTy {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LocationTy {
|
struct LocationTy {
|
||||||
enum class Kind: uint8_t {
|
enum class Kind: uint8_t {
|
||||||
REGISTER = 1,
|
REGISTER = 1,
|
||||||
DIRECT = 2,
|
DIRECT = 2,
|
||||||
|
@ -149,7 +149,7 @@ JSTaggedValue RuntimeStubs::RuntimeInstanceofByHandler(JSThread *thread, JSHandl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 6. Return ? OrdinaryHasInstance(target, object).
|
// 6. Return ? OrdinaryHasInstance(target, object).
|
||||||
bool res = JSFunction::OrdinaryHasInstance(thread, target, object);
|
bool res = JSFunction::OrdinaryHasInstance(thread, target, object);
|
||||||
return JSTaggedValue(res);
|
return JSTaggedValue(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2496,7 +2496,7 @@ OptimizedJSFunctionFrame *RuntimeStubs::GetOptimizedJSFunctionFrame(JSThread *th
|
|||||||
ASSERT(FrameHandler::GetFrameType(current) == FrameType::LEAVE_FRAME);
|
ASSERT(FrameHandler::GetFrameType(current) == FrameType::LEAVE_FRAME);
|
||||||
FrameIterator it(current, thread);
|
FrameIterator it(current, thread);
|
||||||
it.Advance();
|
it.Advance();
|
||||||
ASSERT(it.GetFrameType() == FrameType::OPTIMIZED_JS_FUNCTION_FRAME);
|
ASSERT(it.GetFrameType() == FrameType::OPTIMIZED_JS_FUNCTION_FRAME);
|
||||||
return it.GetFrame<OptimizedJSFunctionFrame>();
|
return it.GetFrame<OptimizedJSFunctionFrame>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -570,8 +570,8 @@ DEF_RUNTIME_STUBS(AsyncFunctionResolveOrReject)
|
|||||||
RUNTIME_STUBS_HEADER(AsyncFunctionResolveOrReject);
|
RUNTIME_STUBS_HEADER(AsyncFunctionResolveOrReject);
|
||||||
JSHandle<JSTaggedValue> asyncFuncObj = GetHArg<JSTaggedValue>(argv, argc, 0); // 0: means the zeroth parameter
|
JSHandle<JSTaggedValue> asyncFuncObj = GetHArg<JSTaggedValue>(argv, argc, 0); // 0: means the zeroth parameter
|
||||||
JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 1); // 1: means the first parameter
|
JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 1); // 1: means the first parameter
|
||||||
JSTaggedValue is_resolve = GetArg(argv, argc, 2); // 2: means the second parameter
|
JSTaggedValue isResolve = GetArg(argv, argc, 2); // 2: means the second parameter
|
||||||
return RuntimeAsyncFunctionResolveOrReject(thread, asyncFuncObj, value, is_resolve.IsTrue()).GetRawData();
|
return RuntimeAsyncFunctionResolveOrReject(thread, asyncFuncObj, value, isResolve.IsTrue()).GetRawData();
|
||||||
}
|
}
|
||||||
|
|
||||||
DEF_RUNTIME_STUBS(AsyncGeneratorResolve)
|
DEF_RUNTIME_STUBS(AsyncGeneratorResolve)
|
||||||
|
@ -199,8 +199,8 @@ void NumberDictionary::GetAllEnumKeys(const JSThread *thread, const JSHandle<Num
|
|||||||
}
|
}
|
||||||
std::sort(sortArr.begin(), sortArr.end(), CompKey);
|
std::sort(sortArr.begin(), sortArr.end(), CompKey);
|
||||||
for (auto entry : sortArr) {
|
for (auto entry : sortArr) {
|
||||||
JSHandle<JSTaggedValue> key_handle(thread, entry);
|
JSHandle<JSTaggedValue> keyHandle(thread, entry);
|
||||||
JSHandle<EcmaString> str = JSTaggedValue::ToString(const_cast<JSThread *>(thread), key_handle);
|
JSHandle<EcmaString> str = JSTaggedValue::ToString(const_cast<JSThread *>(thread), keyHandle);
|
||||||
ASSERT_NO_ABRUPT_COMPLETION(thread);
|
ASSERT_NO_ABRUPT_COMPLETION(thread);
|
||||||
keyArray->Set(thread, arrayIndex + static_cast<uint32_t>(offset), str.GetTaggedValue());
|
keyArray->Set(thread, arrayIndex + static_cast<uint32_t>(offset), str.GetTaggedValue());
|
||||||
arrayIndex++;
|
arrayIndex++;
|
||||||
|
@ -1023,7 +1023,7 @@ HWTEST_F_L0(EcmaDumpTest, HeapProfileDump)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case JSType::RB_TREENODE: {
|
case JSType::RB_TREENODE: {
|
||||||
CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), RBTreeNode::SIZE, 7U);;
|
CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), RBTreeNode::SIZE, 7U);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case JSType::JS_API_HASH_MAP: {
|
case JSType::JS_API_HASH_MAP: {
|
||||||
|
@ -165,7 +165,7 @@ HWTEST_F_L0(JSAPIStackTest, Empty)
|
|||||||
EXPECT_EQ(toor->Empty(), false);
|
EXPECT_EQ(toor->Empty(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
int num = 8 ;
|
int num = 8;
|
||||||
for (uint32_t i = 0; i < NODE_NUMBERS; i++) {
|
for (uint32_t i = 0; i < NODE_NUMBERS; i++) {
|
||||||
std::string ivalue = myValue + std::to_string(i);
|
std::string ivalue = myValue + std::to_string(i);
|
||||||
value.Update(factory->NewFromStdString(ivalue).GetTaggedValue());
|
value.Update(factory->NewFromStdString(ivalue).GetTaggedValue());
|
||||||
|
@ -85,7 +85,7 @@ HWTEST_F_L0(JSLocaleTest, JSIntlIteratorTest)
|
|||||||
uint32_t arrayDataLength = languageVector.size();
|
uint32_t arrayDataLength = languageVector.size();
|
||||||
JSHandle<TaggedArray> arrayData = factory->NewTaggedArray(arrayDataLength);
|
JSHandle<TaggedArray> arrayData = factory->NewTaggedArray(arrayDataLength);
|
||||||
|
|
||||||
for (uint32_t i = 0 ; i < arrayDataLength; i++) {
|
for (uint32_t i = 0; i < arrayDataLength; i++) {
|
||||||
JSHandle<JSTaggedValue> languageStr(factory->NewFromASCII(languageVector[i].c_str()));
|
JSHandle<JSTaggedValue> languageStr(factory->NewFromASCII(languageVector[i].c_str()));
|
||||||
arrayData->Set(thread, i, languageStr);
|
arrayData->Set(thread, i, languageStr);
|
||||||
}
|
}
|
||||||
@ -93,7 +93,7 @@ HWTEST_F_L0(JSLocaleTest, JSIntlIteratorTest)
|
|||||||
JSIntlIterator jsIntlIterator(arrayData, arrayDataLength);
|
JSIntlIterator jsIntlIterator(arrayData, arrayDataLength);
|
||||||
EXPECT_TRUE(jsIntlIterator.hasNext());
|
EXPECT_TRUE(jsIntlIterator.hasNext());
|
||||||
// call "next" function to traverse the container
|
// call "next" function to traverse the container
|
||||||
for (uint32_t i = 0 ; i < arrayDataLength; i++) {
|
for (uint32_t i = 0; i < arrayDataLength; i++) {
|
||||||
EXPECT_TRUE(jsIntlIterator.next() != nullptr);
|
EXPECT_TRUE(jsIntlIterator.next() != nullptr);
|
||||||
EXPECT_STREQ(jsIntlIterator[i].c_str(), languageVector[i].c_str());
|
EXPECT_STREQ(jsIntlIterator[i].c_str(), languageVector[i].c_str());
|
||||||
}
|
}
|
||||||
|
@ -86,10 +86,10 @@ HWTEST_F_L0(JSPromiseTest, NewPromiseCapability)
|
|||||||
EXPECT_EQ(resolve.GetTaggedValue().IsCallable(), true);
|
EXPECT_EQ(resolve.GetTaggedValue().IsCallable(), true);
|
||||||
EXPECT_EQ(resolve.GetTaggedValue().IsCallable(), true);
|
EXPECT_EQ(resolve.GetTaggedValue().IsCallable(), true);
|
||||||
|
|
||||||
JSHandle<JSPromise> resolve_promise(thread, resolve->GetPromise());
|
JSHandle<JSPromise> resolvedPromise(thread, resolve->GetPromise());
|
||||||
JSHandle<JSPromise> reject_promise(thread, reject->GetPromise());
|
JSHandle<JSPromise> rejectedPromise(thread, reject->GetPromise());
|
||||||
EXPECT_EQ(JSTaggedValue::SameValue(newPromise.GetTaggedValue(), resolve_promise.GetTaggedValue()), true);
|
EXPECT_EQ(JSTaggedValue::SameValue(newPromise.GetTaggedValue(), resolvedPromise.GetTaggedValue()), true);
|
||||||
EXPECT_EQ(JSTaggedValue::SameValue(newPromise.GetTaggedValue(), reject_promise.GetTaggedValue()), true);
|
EXPECT_EQ(JSTaggedValue::SameValue(newPromise.GetTaggedValue(), rejectedPromise.GetTaggedValue()), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F_L0(JSPromiseTest, FullFillPromise)
|
HWTEST_F_L0(JSPromiseTest, FullFillPromise)
|
||||||
|
@ -58,26 +58,26 @@ HWTEST_F_L0(MemMapAllocatorTest, GetMemFromList)
|
|||||||
{
|
{
|
||||||
MemMap memMap = PageMap(HUGE_OBJECT_CAPACITY, PAGE_PROT_NONE, DEFAULT_REGION_SIZE);
|
MemMap memMap = PageMap(HUGE_OBJECT_CAPACITY, PAGE_PROT_NONE, DEFAULT_REGION_SIZE);
|
||||||
PageRelease(memMap.GetMem(), memMap.GetSize());
|
PageRelease(memMap.GetMem(), memMap.GetSize());
|
||||||
MemMapFreeList memMapFreeList_;
|
MemMapFreeList memMapFreeList;
|
||||||
memMapFreeList_.Initialize(memMap);
|
memMapFreeList.Initialize(memMap);
|
||||||
|
|
||||||
// From FreeList
|
// From FreeList
|
||||||
size_t size1 = 256 * 1024;
|
size_t size1 = 256 * 1024;
|
||||||
auto mem1 = memMapFreeList_.GetMemFromList(size1);
|
auto mem1 = memMapFreeList.GetMemFromList(size1);
|
||||||
EXPECT_EQ(mem1.GetSize(), size1);
|
EXPECT_EQ(mem1.GetSize(), size1);
|
||||||
|
|
||||||
// From FreeList
|
// From FreeList
|
||||||
size_t size2 = 128 * 1024;
|
size_t size2 = 128 * 1024;
|
||||||
auto mem2 = memMapFreeList_.GetMemFromList(size2);
|
auto mem2 = memMapFreeList.GetMemFromList(size2);
|
||||||
EXPECT_EQ(mem2.GetSize(), size2);
|
EXPECT_EQ(mem2.GetSize(), size2);
|
||||||
|
|
||||||
// From PageMap
|
// From PageMap
|
||||||
size_t size3 = 128 * 1024;
|
size_t size3 = 128 * 1024;
|
||||||
auto mem3 = memMapFreeList_.GetMemFromList(size3);
|
auto mem3 = memMapFreeList.GetMemFromList(size3);
|
||||||
EXPECT_EQ(mem3.GetSize(), size3);
|
EXPECT_EQ(mem3.GetSize(), size3);
|
||||||
|
|
||||||
memMapFreeList_.AddMemToList(mem3);
|
memMapFreeList.AddMemToList(mem3);
|
||||||
memMapFreeList_.Finalize();
|
memMapFreeList.Finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace panda::test
|
} // namespace panda::test
|
||||||
|
@ -265,7 +265,7 @@ HWTEST_F_L0(TaggedDictionaryTest, NumberDictionary_GetAllKey)
|
|||||||
EXPECT_TRUE(*dictHandle != nullptr);
|
EXPECT_TRUE(*dictHandle != nullptr);
|
||||||
JSHandle<TaggedArray> storeKeyArray = factory->NewTaggedArray(keyNumbers);
|
JSHandle<TaggedArray> storeKeyArray = factory->NewTaggedArray(keyNumbers);
|
||||||
// create key and values
|
// create key and values
|
||||||
for (int i = keyNumbers - 2; i >= 0 ; i--) {
|
for (int i = keyNumbers - 2; i >= 0; i--) {
|
||||||
JSHandle<NumberDictionary> tempHandle = dictHandle;
|
JSHandle<NumberDictionary> tempHandle = dictHandle;
|
||||||
JSHandle<JSTaggedValue> keyHandle(thread, JSTaggedValue(i));
|
JSHandle<JSTaggedValue> keyHandle(thread, JSTaggedValue(i));
|
||||||
JSHandle<JSTaggedValue> valueHandle(JSTaggedValue::ToString(thread, keyHandle));
|
JSHandle<JSTaggedValue> valueHandle(JSTaggedValue::ToString(thread, keyHandle));
|
||||||
|
@ -414,8 +414,8 @@ JSHandle<TaggedArray> TSTypeParser::GetExportDataFromRecord(const JSPandaFile *j
|
|||||||
}
|
}
|
||||||
|
|
||||||
JSHandle<TaggedArray> typeOfExportedSymbols(thread_, thread_->GlobalConstants()->GetEmptyArray());
|
JSHandle<TaggedArray> typeOfExportedSymbols(thread_, thread_->GlobalConstants()->GetEmptyArray());
|
||||||
mda.EnumerateAnnotations([&](panda_file::File::EntityId annotation_id) {
|
mda.EnumerateAnnotations([&](panda_file::File::EntityId annotationId) {
|
||||||
panda_file::AnnotationDataAccessor ada(pf, annotation_id);
|
panda_file::AnnotationDataAccessor ada(pf, annotationId);
|
||||||
auto *annotationName = reinterpret_cast<const char *>(pf.GetStringData(ada.GetClassId()).data);
|
auto *annotationName = reinterpret_cast<const char *>(pf.GetStringData(ada.GetClassId()).data);
|
||||||
ASSERT(annotationName != nullptr);
|
ASSERT(annotationName != nullptr);
|
||||||
if (::strcmp("L_ESTypeAnnotation;", annotationName) != 0) {
|
if (::strcmp("L_ESTypeAnnotation;", annotationName) != 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user