Fix code style

Issue: #I67JM7
Signed-off-by: Gymee <yumeijie@huawei.com>
This commit is contained in:
Gymee 2022-12-26 18:40:19 +08:00
parent 94b01d742c
commit 29777fc3ab
49 changed files with 120 additions and 120 deletions

View File

@ -66,7 +66,7 @@ static constexpr size_t INT8_BITS = 8;
static constexpr size_t JS_DTOA_BUF_SIZE = 128;
// help defines for random
static constexpr int LEFT52 = 52 ;
static constexpr int LEFT52 = 52;
static constexpr int RIGHT12 = 12;
static constexpr uint32_t USE_LEFT = 0x3ff;
static constexpr int SECONDS_TO_SUBTLE = 1000000;

View File

@ -191,7 +191,7 @@ public:
return c;
}
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
} 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

View File

@ -60,7 +60,7 @@ HWTEST_F_L0(GCRingBufferTest, Push)
constexpr int LENGTH = 10;
GCRingBuffer<int, LENGTH> gcBuffer;
EXPECT_EQ(gcBuffer.Count(), 0);
for (int i = 0 ; i < 2 * LENGTH ; i++) {
for (int i = 0; i < 2 * LENGTH; i++) {
gcBuffer.Push(i);
}
EXPECT_EQ(gcBuffer.Count(), LENGTH);
@ -82,12 +82,12 @@ HWTEST_F_L0(GCRingBufferTest, Sum)
constexpr int LENGTH = 10;
GCRingBuffer<int, LENGTH> gcBuffer;
for (int i = 0 ; i < LENGTH ; i++) {
for (int i = 0; i < LENGTH; i++) {
gcBuffer.Push(i);
}
EXPECT_EQ(gcBuffer.Sum(SumCallback, 0), 45);
for (int i = 0 ; i < LENGTH ; i++) {
for (int i = 0; i < LENGTH; i++) {
gcBuffer.Push(1);
}
EXPECT_EQ(gcBuffer.Count(), LENGTH);
@ -107,7 +107,7 @@ HWTEST_F_L0(GCRingBufferTest, Reset)
constexpr int LENGTH = 10;
GCRingBuffer<int, LENGTH> gcBuffer;
for (int i = 0 ; i < LENGTH ; i++) {
for (int i = 0; i < LENGTH; i++) {
gcBuffer.Reset();
gcBuffer.Push(i);
}
@ -116,4 +116,4 @@ HWTEST_F_L0(GCRingBufferTest, Reset)
gcBuffer.Reset();
EXPECT_EQ(gcBuffer.Count(), 0);
}
} // namespace panda::ecmascript
} // namespace panda::ecmascript

View File

@ -952,11 +952,11 @@ void Builtins::InitializeAsyncFunction(const JSHandle<GlobalEnv> &env, const JSH
// AsyncFunction.prototype
JSHandle<JSObject> asyncFuncPrototype = factory_->NewJSObjectWithInit(objFuncClass);
JSObject::SetPrototype(thread_, asyncFuncPrototype, env->GetFunctionPrototype());
JSHandle<JSTaggedValue> async_func_prototype_value(asyncFuncPrototype);
JSHandle<JSTaggedValue> asyncFuncPrototypeValue(asyncFuncPrototype);
// AsyncFunction.prototype_or_hclass
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()
JSHandle<JSFunction> asyncFunction = NewBuiltinConstructor(
@ -1950,10 +1950,10 @@ void Builtins::InitializeArray(const JSHandle<GlobalEnv> &env, const JSHandle<JS
SetGetter(JSHandle<JSObject>(arrayFunction), speciesSymbol, speciesGetter);
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,
false);
JSObject::DefineOwnProperty(thread_, arrFuncPrototype, key_string, descriptor);
JSObject::DefineOwnProperty(thread_, arrFuncPrototype, keyString, descriptor);
JSHandle<JSTaggedValue> valuesKey(factory_->NewFromASCII("values"));
PropertyDescriptor desc(thread_);

View File

@ -501,7 +501,7 @@ template <typename T>
WaitResult BuiltinsAtomics::DoWait(JSThread *thread, JSHandle<JSTaggedValue> &arrayBuffer,
size_t index, T execpt, double timeout)
{
MutexGuard lock_guard(g_mutex);
MutexGuard lockGuard(g_mutex);
void *buffer = BuiltinsArrayBuffer::GetDataPointFromBuffer(arrayBuffer.GetTaggedValue());
ASSERT(buffer != nullptr);
WaiterListNode *node = thread->GetEcmaVM()->GetWaiterListNode();
@ -551,7 +551,7 @@ uint32_t BuiltinsAtomics::Signal(JSHandle<JSTaggedValue> &arrayBuffer, const siz
{
void *buffer = BuiltinsArrayBuffer::GetDataPointFromBuffer(arrayBuffer.GetTaggedValue());
ASSERT(buffer != nullptr);
MutexGuard lock_guard(g_mutex);
MutexGuard lockGuard(g_mutex);
auto &locationListMap = g_waitLists->locationListMap_;
auto iter = locationListMap.find(reinterpret_cast<int8_t *>(buffer) + index);
if (iter == locationListMap.end()) {

View File

@ -144,12 +144,12 @@ JSTaggedValue BuiltinsDate::SetTime(EcmaRuntimeCallInfo *argv)
if (!msg->IsDate()) {
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));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(argv->GetThread());
double number = res.GetNumber();
double value = JSDate::TimeClip(number);
js_data->SetTimeValue(thread, JSTaggedValue(value));
jsDate->SetTimeValue(thread, JSTaggedValue(value));
return GetTaggedDouble(value);
}

View File

@ -73,7 +73,7 @@ JSTaggedValue BuiltinsTypeError::ToString(EcmaRuntimeCallInfo *argv)
JSTaggedValue BuiltinsTypeError::ThrowTypeError(EcmaRuntimeCallInfo *argv)
{
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());
}

View File

@ -85,11 +85,11 @@ JSTaggedValue BuiltinsProxy::InvalidateProxyFunction(EcmaRuntimeCallInfo *argv)
JSThread *thread = argv->GetThread();
[[maybe_unused]] EcmaHandleScope handleScope(thread);
JSHandle<JSObject> revoke_obj(GetThis(argv));
JSHandle<JSObject> revokeObj(GetThis(argv));
JSHandle<JSTaggedValue> revokeKey = thread->GlobalConstants()->GetHandledRevokeString();
PropertyDescriptor desc(thread);
JSObject::GetOwnProperty(thread, revoke_obj, revokeKey, desc);
JSObject::GetOwnProperty(thread, revokeObj, revokeKey, desc);
JSProxyRevocFunction::ProxyRevocFunctions(thread, JSHandle<JSProxyRevocFunction>(desc.GetValue()));
return JSTaggedValue::Undefined();
}

View File

@ -59,7 +59,7 @@ JSTaggedValue BuiltinsRegExp::RegExpConstructor(EcmaRuntimeCallInfo *argv)
auto ecmaVm = thread->GetEcmaVM();
JSHandle<GlobalEnv> env = ecmaVm->GetGlobalEnv();
// disable gc
[[maybe_unused]] DisallowGarbageCollection no_gc;
[[maybe_unused]] DisallowGarbageCollection noGc;
// 4.a Let newTarget be the active function object.
newTarget = env->GetRegExpFunction();
JSHandle<JSTaggedValue> constructorString = globalConst->GetHandledConstructorString();

View File

@ -519,11 +519,11 @@ JSTaggedValue BuiltinsString::LocaleCompare(EcmaRuntimeCallInfo *argv)
BUILTINS_API_TRACE(argv->GetThread(), String, LocaleCompare);
JSThread *thread = argv->GetThread();
[[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<EcmaString> thisHandle = JSTaggedValue::ToString(thread, thisTag);
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);
JSHandle<JSTaggedValue> locales = GetCallArg(argv, 1);

View File

@ -117,10 +117,10 @@ HWTEST_F_L0(BuiltinsMapTest, CreateAndGetSize)
}
JSHandle<TaggedArray> array(factory->NewTaggedArray(5));
for (int i = 0; i < 5; i++) {
JSHandle<TaggedArray> internal_array(factory->NewTaggedArray(2));
internal_array->Set(thread, 0, JSTaggedValue(i));
internal_array->Set(thread, 1, JSTaggedValue(i));
auto arr = JSArray::CreateArrayFromList(thread, internal_array);
JSHandle<TaggedArray> internalArray(factory->NewTaggedArray(2));
internalArray->Set(thread, 0, JSTaggedValue(i));
internalArray->Set(thread, 1, JSTaggedValue(i));
auto arr = JSArray::CreateArrayFromList(thread, internalArray);
array->Set(thread, i, arr);
}
JSHandle<JSArray> values = JSArray::CreateArrayFromList(thread, array);

View File

@ -572,18 +572,18 @@ HWTEST_F_L0(BuiltinsStringTest, toLocaleLowerCase2)
{
ASSERT_NE(thread, nullptr);
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);
ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue());
ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue());
[[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo);
JSTaggedValue result = BuiltinsString::ToLocaleLowerCase(ecmaRuntimeCallInfo);
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");
ASSERT_EQ(EcmaStringAccessor::Compare(instance, result_handle, test), 0);
ASSERT_EQ(EcmaStringAccessor::Compare(instance, resultHandle, test), 0);
}
// "ABC".toLowerCase()
@ -737,20 +737,20 @@ HWTEST_F_L0(BuiltinsStringTest, normalize1)
{
ASSERT_NE(thread, nullptr);
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
JSHandle<EcmaString> this_str = factory->NewFromASCII("abc");
JSHandle<EcmaString> thisStr = factory->NewFromASCII("abc");
JSHandle<EcmaString> val = factory->NewFromASCII("NFC");
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6);
ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue());
ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue());
ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue());
[[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo);
JSTaggedValue result = BuiltinsString::Normalize(ecmaRuntimeCallInfo);
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");
ASSERT_EQ(EcmaStringAccessor::Compare(instance, result_handle, test), 0);
ASSERT_EQ(EcmaStringAccessor::Compare(instance, resultHandle, test), 0);
}
// "abc".repeat(5)

View File

@ -102,11 +102,11 @@ HWTEST_F_L0(BuiltinsWeakMapTest, CreateAndGetSize)
JSHandle<JSWeakMap> map(thread, CreateBuiltinsWeakMap(thread));
JSHandle<TaggedArray> array(factory->NewTaggedArray(1));
JSHandle<TaggedArray> internal_array(factory->NewTaggedArray(2));
JSHandle<TaggedArray> internalArray(factory->NewTaggedArray(2));
JSTaggedValue value(JSObjectTestCreate(thread));
internal_array->Set(thread, 0, value);
internal_array->Set(thread, 1, JSTaggedValue(0));
auto result = JSArray::CreateArrayFromList(thread, internal_array);
internalArray->Set(thread, 0, value);
internalArray->Set(thread, 1, JSTaggedValue(0));
auto result = JSArray::CreateArrayFromList(thread, internalArray);
array->Set(thread, 0, result);
JSHandle<JSArray> values = JSArray::CreateArrayFromList(thread, array);

View File

@ -200,7 +200,7 @@ void AsyncFunctionLowering::UpdateValueSelector(GateRef prevLoopBeginGate,
bool AsyncFunctionLowering::IsAsyncRelated() const
{
return bcBuilder_->GetAsyncRelatedGates().size() > 0;
return bcBuilder_->GetAsyncRelatedGates().size() > 0;
}
} // panda::ecmascript::kungfu

View File

@ -119,7 +119,7 @@ void Circuit::PrintAllGatesWithBytecode() const
for (const auto &gate : gateList) {
if (GetOpCode(gate) == OpCode::JS_BYTECODE) {
const Gate *gatePtr = LoadGatePtrConst(gate);
auto opcode = gatePtr->GetJSBytecodeMetaData()->GetByteCodeOpcode();
auto opcode = gatePtr->GetJSBytecodeMetaData()->GetByteCodeOpcode();
std::string bytecodeStr = GetEcmaOpcodeStr(opcode);
LoadGatePtrConst(gate)->PrintByteCode(bytecodeStr);
} else {

View File

@ -724,7 +724,7 @@ GateRef CircuitBuilder::GetObjectFromConstPool(GateRef glue, GateRef constPool,
{ constPool, Int32ToTaggedInt(index), module });
Jump(&exit);
}
} else if (type == ConstPoolType::OBJECT_LITERAL) {
} else if (type == ConstPoolType::OBJECT_LITERAL) {
Label isAOTLiteralInfo(env_);
Branch(IsAOTLiteralInfo(*result), &isAOTLiteralInfo, &exit);
Bind(&isAOTLiteralInfo);

View File

@ -47,7 +47,7 @@ std::string MachineTypeToStr(MachineType machineType)
std::string GateMetaData::Str(OpCode opcode)
{
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)
GATE_META_DATA_LIST_WITH_SIZE(GATE_NAME_MAP)
GATE_META_DATA_LIST_WITH_ONE_PARAMETER(GATE_NAME_MAP)

View File

@ -40,8 +40,8 @@ void TypeRecorder::LoadTypes(const JSPandaFile *jsPandaFile, const MethodLiteral
const panda_file::File *pf = jsPandaFile->GetPandaFile();
panda_file::File::EntityId fieldId = methodLiteral->GetMethodId();
panda_file::MethodDataAccessor mda(*pf, fieldId);
mda.EnumerateAnnotations([&](panda_file::File::EntityId annotation_id) {
panda_file::AnnotationDataAccessor ada(*pf, annotation_id);
mda.EnumerateAnnotations([&](panda_file::File::EntityId annotationId) {
panda_file::AnnotationDataAccessor ada(*pf, annotationId);
auto *annotationName = reinterpret_cast<const char *>(pf->GetStringData(ada.GetClassId()).data);
ASSERT(annotationName != nullptr);
if (::strcmp("L_ESTypeAnnotation;", annotationName) != 0) {

View File

@ -138,7 +138,7 @@ JSTaggedValue ContainersLightWeightSet::GetValueAt(EcmaRuntimeCallInfo *argv)
self = JSHandle<JSTaggedValue>(thread, JSHandle<JSProxy>::Cast(self)->GetTarget());
} else {
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());
}
}
@ -534,4 +534,4 @@ JSTaggedValue ContainersLightWeightSet::GetSize(EcmaRuntimeCallInfo *argv)
}
return JSTaggedValue(JSHandle<JSAPILightWeightSet>::Cast(self)->GetSize());
}
} // namespace panda::ecmascript::containers
} // namespace panda::ecmascript::containers

View File

@ -277,7 +277,7 @@ HWTEST_F_L0(ContainersListTest, Equal)
// Length Not Equal
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));
EXPECT_EQ(result, JSTaggedValue::True());
EXPECT_EQ(result, JSTaggedValue::True());
@ -593,4 +593,4 @@ HWTEST_F_L0(ContainersListTest, SpecialReturn)
EXPECT_EQ(result, JSTaggedValue::False());
}
}
} // namespace panda::test
} // namespace panda::test

View File

@ -89,7 +89,7 @@ struct AsmStackContext : public base::AlignedStruct<base::AlignedPointer::Size()
class FrameWriter;
class Deoptimizier {
public:
explicit Deoptimizier(JSThread * thread) : thread_(thread)
explicit Deoptimizier(JSThread *thread) : thread_(thread)
{
kungfu::CalleeReg callreg;
numCalleeRegs_ = static_cast<size_t>(callreg.GetCallRegNum());

View File

@ -328,7 +328,7 @@ inline size_t EcmaStringAccessor::GetUtf8Length() const
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)
{
dst->WriteData(src, start, destSize, length);

View File

@ -221,8 +221,8 @@ JSHandle<JSDisplayNames> JSDisplayNames::InitializeDisplayNames(JSThread *thread
LOG_ECMA(FATAL) << "this branch is unreachable";
UNREACHABLE();
}
UDisplayContext display_context[] = {uStyle};
icu::LocaleDisplayNames *icudisplaynames(icu::LocaleDisplayNames::createInstance(icuLocale, display_context, 1));
UDisplayContext displayContext[] = {uStyle};
icu::LocaleDisplayNames *icudisplaynames(icu::LocaleDisplayNames::createInstance(icuLocale, displayContext, 1));
SetIcuLocaleDisplayNames(thread, displayNames, icudisplaynames, JSDisplayNames::FreeIcuLocaleDisplayNames);
return displayNames;
}

View File

@ -716,7 +716,7 @@ std::string JSLocale::UnicodeExtensionValue(const std::string extension, const s
size_t e = extension.find("-", k);
size_t len;
// 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;
} else {
len = e - k;
@ -820,7 +820,7 @@ ResolvedLocale JSLocale::ResolveLocale(JSThread *thread, const JSHandle<TaggedAr
// g. Let supportedExtensionAddition be "".
// h. If r has an [[extension]] field, then
std::string supportedExtensionAddition;
std::string supportedExtensionAddition;
size_t found = foundLocale.find("-u-");
if (found != std::string::npos) {
std::string extension = foundLocale.substr(found + INTL_INDEX_ONE);

View File

@ -359,8 +359,8 @@ public:
static bool IsWellCollation(const icu::Locale &locale, const std::string &value)
{
std::set<std::string> irregularList = {"standard", "search"};
if (irregularList.find(value) != irregularList.end()) {
std::set<std::string> irregularList = {"standard", "search"};
if (irregularList.find(value) != irregularList.end()) {
return false;
}
return IsWellExtension<icu::Collator>(locale, "collation", value);
@ -435,7 +435,7 @@ public:
if (value.length() < 3) {
return false;
}
char lastChar = value[value.length() - 1];
char lastChar = value[value.length() - 1];
if (lastChar == '-') {
return false;
}

View File

@ -745,13 +745,13 @@ JSHandle<TaggedArray> JSProxy::OwnPropertyKeys(JSThread *thread, const JSHandle<
info->SetCallArg(targetHandle.GetTaggedValue());
JSTaggedValue res = JSFunction::Call(info);
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»).
// 10.ReturnIfAbrupt(trapResult)
// If trapResult contains any duplicate entries, throw a TypeError exception.
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);
if (trapRes->HasDuplicateEntry()) {

View File

@ -379,7 +379,7 @@ public:
if (pos != std::string::npos) {
std::string strStart = strAsmOpcodeDisableRange.substr(0, pos);
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);
if (start >= 0 && start < kungfu::BytecodeStubCSigns::NUM_OF_ALL_NORMAL_STUBS &&
end >= 0 && end < kungfu::BytecodeStubCSigns::NUM_OF_ALL_NORMAL_STUBS &&

View File

@ -241,9 +241,9 @@ bool JSTaggedValue::Equal(JSThread *thread, const JSHandle<JSTaggedValue> &x, co
}
}
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 Equal(thread, x_primitive, y);
return Equal(thread, xPrimitive, y);
}
return false;
}
@ -887,8 +887,8 @@ bool JSTaggedValue::HasProperty(JSThread *thread, const JSHandle<JSTaggedValue>
return JSProxy::HasProperty(thread, JSHandle<JSProxy>(obj), keyHandle);
}
if (obj->IsTypedArray()) {
JSHandle<JSTaggedValue> key_handle(thread, JSTaggedValue(key));
return JSTypedArray::HasProperty(thread, obj, key_handle);
JSHandle<JSTaggedValue> keyHandle(thread, JSTaggedValue(key));
return JSTypedArray::HasProperty(thread, obj, keyHandle);
}
if (obj->IsSpecialContainer()) {
return HasContainerProperty(thread, obj, JSHandle<JSTaggedValue>(thread, JSTaggedValue(key)));

View File

@ -309,7 +309,7 @@ public:
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 uint32_t GetCodeSize(const JSPandaFile *jsPandaFile, EntityId methodId);
static CString GetRecordName(const JSPandaFile *jsPandaFile, EntityId methodId);

View File

@ -73,8 +73,8 @@ HWTEST_F_L0(JSPandaFileExecutorTest, Execute)
JSPandaFile *pf = pfManager->NewJSPandaFile(pfPtr.release(), CString(fileName));
const uint8_t *typeDesc = utf::CStringAsMutf8("L_GLOBAL;");
const File *file = pf->GetPandaFile();
File::EntityId class_id = file->GetClassId(typeDesc);
ClassDataAccessor cda(*file, class_id);
File::EntityId classId = file->GetClassId(typeDesc);
ClassDataAccessor cda(*file, classId);
std::vector<File::EntityId> methodId {};
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
methodId.push_back(mda.GetMethodId());
@ -108,8 +108,8 @@ HWTEST_F_L0(JSPandaFileExecutorTest, ExecuteFromFile)
JSPandaFile *pf = pfManager->NewJSPandaFile(pfPtr.release(), CString(fileName));
const uint8_t *typeDesc = utf::CStringAsMutf8("L_GLOBAL;");
const File *file = pf->GetPandaFile();
File::EntityId class_id = file->GetClassId(typeDesc);
ClassDataAccessor cda(*file, class_id);
File::EntityId classId = file->GetClassId(typeDesc);
ClassDataAccessor cda(*file, classId);
std::vector<File::EntityId> methodId {};
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
methodId.push_back(mda.GetMethodId());
@ -146,8 +146,8 @@ HWTEST_F_L0(JSPandaFileExecutorTest, ExecuteFromBuffer)
JSPandaFile *pf = pfManager->NewJSPandaFile(pfPtr.release(), CString(fileName));
const uint8_t *typeDesc = utf::CStringAsMutf8("L_GLOBAL;");
const File *file = pf->GetPandaFile();
File::EntityId class_id = file->GetClassId(typeDesc);
ClassDataAccessor cda(*file, class_id);
File::EntityId classId = file->GetClassId(typeDesc);
ClassDataAccessor cda(*file, classId);
std::vector<File::EntityId> methodId {};
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
methodId.push_back(mda.GetMethodId());

View File

@ -180,8 +180,8 @@ HWTEST_F_L0(JSPandaFileManagerTest, GenerateProgram)
std::unique_ptr<const File> pfPtr = pandasm::AsmEmitter::Emit(res.Value());
JSPandaFile *pf = pfManager->NewJSPandaFile(pfPtr.release(), CString(filename));
const File *file = pf->GetPandaFile();
File::EntityId class_id = file->GetClassId(typeDesc);
ClassDataAccessor cda(*file, class_id);
File::EntityId classId = file->GetClassId(typeDesc);
ClassDataAccessor cda(*file, classId);
std::vector<File::EntityId> methodId {};
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
methodId.push_back(mda.GetMethodId());

View File

@ -131,10 +131,10 @@ HWTEST_F_L0(JSPandaFileTest, SetMethodLiteralToMap_FindMethodLiteral)
JSPandaFile *pf = CreateJSPandaFile(source, fileName);
const File *file = pf->GetPandaFile();
const uint8_t *typeDesc = utf::CStringAsMutf8("L_GLOBAL;");
File::EntityId class_id = file->GetClassId(typeDesc);
EXPECT_TRUE(class_id.IsValid());
File::EntityId classId = file->GetClassId(typeDesc);
EXPECT_TRUE(classId.IsValid());
ClassDataAccessor cda(*file, class_id);
ClassDataAccessor cda(*file, classId);
std::vector<File::EntityId> methodId {};
int count = 0;
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
@ -166,10 +166,10 @@ HWTEST_F_L0(JSPandaFileTest, GetOrInsertConstantPool_GetConstpoolIndex_GetConstp
JSPandaFile *pf = CreateJSPandaFile(source, fileName);
const File *file = pf->GetPandaFile();
const uint8_t *typeDesc = utf::CStringAsMutf8("L_GLOBAL;");
File::EntityId class_id = file->GetClassId(typeDesc);
EXPECT_TRUE(class_id.IsValid());
File::EntityId classId = file->GetClassId(typeDesc);
EXPECT_TRUE(classId.IsValid());
ClassDataAccessor cda(*file, class_id);
ClassDataAccessor cda(*file, classId);
std::vector<File::EntityId> methodId {};
int count = 0;
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
@ -217,10 +217,10 @@ HWTEST_F_L0(JSPandaFileTest, GetMainMethodIndex_UpdateMainMethodIndex)
JSPandaFile *pf = CreateJSPandaFile(source, fileName);
const File *file = pf->GetPandaFile();
const uint8_t *typeDesc = utf::CStringAsMutf8("L_GLOBAL;");
File::EntityId class_id = file->GetClassId(typeDesc);
EXPECT_TRUE(class_id.IsValid());
File::EntityId classId = file->GetClassId(typeDesc);
EXPECT_TRUE(classId.IsValid());
ClassDataAccessor cda(*file, class_id);
ClassDataAccessor cda(*file, classId);
std::vector<File::EntityId> methodId {};
int count = 0;
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
@ -251,8 +251,8 @@ HWTEST_F_L0(JSPandaFileTest, GetClasses)
JSPandaFile *pf = CreateJSPandaFile(source, fileName);
const File *file = pf->GetPandaFile();
const uint8_t *typeDesc = utf::CStringAsMutf8("L_GLOBAL;");
File::EntityId class_id = file->GetClassId(typeDesc);
EXPECT_TRUE(class_id.IsValid());
File::EntityId classId = file->GetClassId(typeDesc);
EXPECT_TRUE(classId.IsValid());
const File::Header *header = file->GetHeader();
Span fileData(file->GetBase(), header->file_size);

View File

@ -73,8 +73,8 @@ HWTEST_F_L0(PandaFileTranslatorTest, GenerateProgram)
std::unique_ptr<const File> pfPtr = pandasm::AsmEmitter::Emit(res.Value());
JSPandaFile *pf = pfManager->NewJSPandaFile(pfPtr.release(), CString(filename));
const File *file = pf->GetPandaFile();
File::EntityId class_id = file->GetClassId(typeDesc);
ClassDataAccessor cda(*file, class_id);
File::EntityId classId = file->GetClassId(typeDesc);
ClassDataAccessor cda(*file, classId);
std::vector<File::EntityId> methodId {};
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
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());
JSPandaFile *pf = pfManager->NewJSPandaFile(pfPtr.release(), CString(filename));
const File *file = pf->GetPandaFile();
File::EntityId class_id = file->GetClassId(typeDesc);
ClassDataAccessor cda(*file, class_id);
File::EntityId classId = file->GetClassId(typeDesc);
ClassDataAccessor cda(*file, classId);
std::vector<File::EntityId> methodId {};
cda.EnumerateMethods([&](panda_file::MethodDataAccessor &mda) {
methodId.push_back(mda.GetMethodId());

View File

@ -97,13 +97,13 @@ using AllowHeapAlloc = AssertScopeT<AssertType::HEAP_ALLOC_ASSERT, true, IS_ALLO
#if (!defined NDEBUG) || (defined RUN_TEST)
// 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)
#define ALLOW_GARBAGE_COLLECTION [[maybe_unused]] AllowGarbageCollection allow_gc
#define ALLOW_GARBAGE_COLLECTION [[maybe_unused]] AllowGarbageCollection allowGc
// 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)
#define ALLOW_HEAP_ALLOC [[maybe_unused]] AllowHeapAlloc allow_heap_alloc
#define ALLOW_HEAP_ALLOC [[maybe_unused]] AllowHeapAlloc allowHeapAlloc
#else
#define DISALLOW_GARBAGE_COLLECTION
#define ALLOW_GARBAGE_COLLECTION

View File

@ -261,7 +261,7 @@ public:
bool InNonMovableSpace() const
{
return packedData_.flags_.spaceFlag_ == RegionSpaceFlag::IN_NON_MOVABLE_SPACE;
return packedData_.flags_.spaceFlag_ == RegionSpaceFlag::IN_NON_MOVABLE_SPACE;
}
bool InSnapshotSpace() const

View File

@ -284,7 +284,7 @@ bool DFXJSNApi::IsSuspended(const EcmaVM *vm)
bool DFXJSNApi::CheckSafepoint(const EcmaVM *vm)
{
ecmascript::JSThread* thread = vm->GetJSThread();
return thread->CheckSafepoint();
return thread->CheckSafepoint();
}
bool DFXJSNApi::BuildJsStackInfoList(const EcmaVM *hostVm, uint32_t tid, std::vector<JsFrameInfo>& jsFrames)

View File

@ -120,7 +120,7 @@ public:
inline size_t GetGroupNamesSize() const
{
return groupNames_.size_ ;
return groupNames_.size_;
}
inline bool IsError() const

View File

@ -65,7 +65,7 @@ void LLVMStackMapParser::CalcCallSite()
struct LocationTy loc = llvmStackMap_.StkMapRecord[recordNum + recordId].Locations[j];
uint32_t instructionOffset = recordHead.InstructionOffset;
uintptr_t callsite = address + instructionOffset;
uint64_t patchPointID = recordHead.PatchPointID;
uint64_t patchPointID = recordHead.PatchPointID;
if (j == LocationTy::CONSTANT_DEOPT_CNT_INDEX) {
ASSERT(loc.location == LocationTy::Kind::CONSTANT);
lastDeoptIndex = loc.OffsetOrSmallConstant + LocationTy::CONSTANT_DEOPT_CNT_INDEX;

View File

@ -86,7 +86,7 @@ struct StkMapRecordHeadTy {
}
};
struct LocationTy {
struct LocationTy {
enum class Kind: uint8_t {
REGISTER = 1,
DIRECT = 2,

View File

@ -149,7 +149,7 @@ JSTaggedValue RuntimeStubs::RuntimeInstanceofByHandler(JSThread *thread, JSHandl
}
// 6. Return ? OrdinaryHasInstance(target, object).
bool res = JSFunction::OrdinaryHasInstance(thread, target, object);
bool res = JSFunction::OrdinaryHasInstance(thread, target, object);
return JSTaggedValue(res);
}
@ -2496,7 +2496,7 @@ OptimizedJSFunctionFrame *RuntimeStubs::GetOptimizedJSFunctionFrame(JSThread *th
ASSERT(FrameHandler::GetFrameType(current) == FrameType::LEAVE_FRAME);
FrameIterator it(current, thread);
it.Advance();
ASSERT(it.GetFrameType() == FrameType::OPTIMIZED_JS_FUNCTION_FRAME);
ASSERT(it.GetFrameType() == FrameType::OPTIMIZED_JS_FUNCTION_FRAME);
return it.GetFrame<OptimizedJSFunctionFrame>();
}

View File

@ -570,8 +570,8 @@ DEF_RUNTIME_STUBS(AsyncFunctionResolveOrReject)
RUNTIME_STUBS_HEADER(AsyncFunctionResolveOrReject);
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
JSTaggedValue is_resolve = GetArg(argv, argc, 2); // 2: means the second parameter
return RuntimeAsyncFunctionResolveOrReject(thread, asyncFuncObj, value, is_resolve.IsTrue()).GetRawData();
JSTaggedValue isResolve = GetArg(argv, argc, 2); // 2: means the second parameter
return RuntimeAsyncFunctionResolveOrReject(thread, asyncFuncObj, value, isResolve.IsTrue()).GetRawData();
}
DEF_RUNTIME_STUBS(AsyncGeneratorResolve)

View File

@ -199,8 +199,8 @@ void NumberDictionary::GetAllEnumKeys(const JSThread *thread, const JSHandle<Num
}
std::sort(sortArr.begin(), sortArr.end(), CompKey);
for (auto entry : sortArr) {
JSHandle<JSTaggedValue> key_handle(thread, entry);
JSHandle<EcmaString> str = JSTaggedValue::ToString(const_cast<JSThread *>(thread), key_handle);
JSHandle<JSTaggedValue> keyHandle(thread, entry);
JSHandle<EcmaString> str = JSTaggedValue::ToString(const_cast<JSThread *>(thread), keyHandle);
ASSERT_NO_ABRUPT_COMPLETION(thread);
keyArray->Set(thread, arrayIndex + static_cast<uint32_t>(offset), str.GetTaggedValue());
arrayIndex++;

View File

@ -1023,7 +1023,7 @@ HWTEST_F_L0(EcmaDumpTest, HeapProfileDump)
break;
}
case JSType::RB_TREENODE: {
CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), RBTreeNode::SIZE, 7U);;
CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), RBTreeNode::SIZE, 7U);
break;
}
case JSType::JS_API_HASH_MAP: {

View File

@ -165,7 +165,7 @@ HWTEST_F_L0(JSAPIStackTest, Empty)
EXPECT_EQ(toor->Empty(), false);
}
int num = 8 ;
int num = 8;
for (uint32_t i = 0; i < NODE_NUMBERS; i++) {
std::string ivalue = myValue + std::to_string(i);
value.Update(factory->NewFromStdString(ivalue).GetTaggedValue());

View File

@ -85,7 +85,7 @@ HWTEST_F_L0(JSLocaleTest, JSIntlIteratorTest)
uint32_t arrayDataLength = languageVector.size();
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()));
arrayData->Set(thread, i, languageStr);
}
@ -93,7 +93,7 @@ HWTEST_F_L0(JSLocaleTest, JSIntlIteratorTest)
JSIntlIterator jsIntlIterator(arrayData, arrayDataLength);
EXPECT_TRUE(jsIntlIterator.hasNext());
// 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_STREQ(jsIntlIterator[i].c_str(), languageVector[i].c_str());
}

View File

@ -86,10 +86,10 @@ HWTEST_F_L0(JSPromiseTest, NewPromiseCapability)
EXPECT_EQ(resolve.GetTaggedValue().IsCallable(), true);
EXPECT_EQ(resolve.GetTaggedValue().IsCallable(), true);
JSHandle<JSPromise> resolve_promise(thread, resolve->GetPromise());
JSHandle<JSPromise> reject_promise(thread, reject->GetPromise());
EXPECT_EQ(JSTaggedValue::SameValue(newPromise.GetTaggedValue(), resolve_promise.GetTaggedValue()), true);
EXPECT_EQ(JSTaggedValue::SameValue(newPromise.GetTaggedValue(), reject_promise.GetTaggedValue()), true);
JSHandle<JSPromise> resolvedPromise(thread, resolve->GetPromise());
JSHandle<JSPromise> rejectedPromise(thread, reject->GetPromise());
EXPECT_EQ(JSTaggedValue::SameValue(newPromise.GetTaggedValue(), resolvedPromise.GetTaggedValue()), true);
EXPECT_EQ(JSTaggedValue::SameValue(newPromise.GetTaggedValue(), rejectedPromise.GetTaggedValue()), true);
}
HWTEST_F_L0(JSPromiseTest, FullFillPromise)

View File

@ -58,26 +58,26 @@ HWTEST_F_L0(MemMapAllocatorTest, GetMemFromList)
{
MemMap memMap = PageMap(HUGE_OBJECT_CAPACITY, PAGE_PROT_NONE, DEFAULT_REGION_SIZE);
PageRelease(memMap.GetMem(), memMap.GetSize());
MemMapFreeList memMapFreeList_;
memMapFreeList_.Initialize(memMap);
MemMapFreeList memMapFreeList;
memMapFreeList.Initialize(memMap);
// From FreeList
size_t size1 = 256 * 1024;
auto mem1 = memMapFreeList_.GetMemFromList(size1);
auto mem1 = memMapFreeList.GetMemFromList(size1);
EXPECT_EQ(mem1.GetSize(), size1);
// From FreeList
size_t size2 = 128 * 1024;
auto mem2 = memMapFreeList_.GetMemFromList(size2);
auto mem2 = memMapFreeList.GetMemFromList(size2);
EXPECT_EQ(mem2.GetSize(), size2);
// From PageMap
size_t size3 = 128 * 1024;
auto mem3 = memMapFreeList_.GetMemFromList(size3);
auto mem3 = memMapFreeList.GetMemFromList(size3);
EXPECT_EQ(mem3.GetSize(), size3);
memMapFreeList_.AddMemToList(mem3);
memMapFreeList_.Finalize();
memMapFreeList.AddMemToList(mem3);
memMapFreeList.Finalize();
}
} // namespace panda::test

View File

@ -265,7 +265,7 @@ HWTEST_F_L0(TaggedDictionaryTest, NumberDictionary_GetAllKey)
EXPECT_TRUE(*dictHandle != nullptr);
JSHandle<TaggedArray> storeKeyArray = factory->NewTaggedArray(keyNumbers);
// 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<JSTaggedValue> keyHandle(thread, JSTaggedValue(i));
JSHandle<JSTaggedValue> valueHandle(JSTaggedValue::ToString(thread, keyHandle));

View File

@ -414,8 +414,8 @@ JSHandle<TaggedArray> TSTypeParser::GetExportDataFromRecord(const JSPandaFile *j
}
JSHandle<TaggedArray> typeOfExportedSymbols(thread_, thread_->GlobalConstants()->GetEmptyArray());
mda.EnumerateAnnotations([&](panda_file::File::EntityId annotation_id) {
panda_file::AnnotationDataAccessor ada(pf, annotation_id);
mda.EnumerateAnnotations([&](panda_file::File::EntityId annotationId) {
panda_file::AnnotationDataAccessor ada(pf, annotationId);
auto *annotationName = reinterpret_cast<const char *>(pf.GetStringData(ada.GetClassId()).data);
ASSERT(annotationName != nullptr);
if (::strcmp("L_ESTypeAnnotation;", annotationName) != 0) {