fix codex and reviewBot warnings

Signed-off-by: zhaozhibo <zhaozhibo3@huawei.com>
This commit is contained in:
zhaozhibo 2022-11-02 10:35:17 +08:00
parent 392f1cd017
commit ef9d0886d6
14 changed files with 24 additions and 39 deletions

View File

@ -114,8 +114,7 @@ public:
}
}
private:
union Data
{
union Data {
uint64_t inlineWord_ {0};
uint64_t *words_ {nullptr};
};
@ -145,7 +144,7 @@ private:
return size >> BYTE_PER_WORD_LOG2;
}
bool UseWords() const
bool UseWords() const
{
return wordCount_ > 1;
}

View File

@ -86,9 +86,9 @@ private:
bool ComputeLiveOut(size_t bbId);
void ComputeLiveState();
void ComputeLiveOutBC(const BytecodeInfo &bytecodeInfo);
bool MergeIntoPredBC(const uint8_t* predPc);
bool MergeIntoPredBC(const uint8_t *predPc);
bool MergeIntoPredBB(BytecodeRegion *bb, BytecodeRegion *predBb);
FrameStateInfo *GetOrOCreateStateInfo(const uint8_t * pc)
FrameStateInfo *GetOrOCreateStateInfo(const uint8_t *pc)
{
auto currentInfo = stateInfos_[pc];
if (currentInfo == nullptr) {

View File

@ -270,10 +270,7 @@ kungfu::CalleeRegAndOffsetVec LLVMAssembler::GetCalleeReg2Offset(LLVMValueRef fn
auto value = std::stoi(std::string(Attr.getValueAsString()));
info.push_back(std::make_pair(RegNum, value));
(void)log;
auto logFlag = true;
if (logFlag) {
LOG_COMPILER(INFO) << " RegNum:" << RegNum << " value:" << value << std::endl;
}
LOG_COMPILER(INFO) << " RegNum:" << RegNum << " value:" << value << std::endl;
}
}
}

View File

@ -150,7 +150,6 @@ protected:
TestHelper::TearDownFrame(thread, prev);
return result;
}
};
HWTEST_F_L0(ContainersLinkedListTest, LinkedListConstructor)
@ -263,7 +262,7 @@ HWTEST_F_L0(ContainersLinkedListTest, RemoveByIndex)
// Remove index < (NODE_NUMBERS / 2)
result = LinkedListRemoveByIndex(linkedlist, JSTaggedValue(6));
EXPECT_EQ(result, JSTaggedValue(6));
EXPECT_EQ(linkedlist->Length(), static_cast<int>(NODE_NUMBERS - 2));
EXPECT_EQ(linkedlist->Length(), static_cast<int>(NODE_NUMBERS - 2));
}
HWTEST_F_L0(ContainersLinkedListTest, RemoveFirst)

View File

@ -284,7 +284,7 @@ HWTEST_F_L0(ContainersListTest, Equal)
// Value Not Equal
JSHandle<JSAPIList> list3 = CreateJSAPIList();
for (uint32_t i = 0; i < NODE_NUMBERS; i++) {
if(i == (NODE_NUMBERS - 1)) {
if (i == (NODE_NUMBERS - 1)) {
result = ListAdd(list3, JSTaggedValue(0));
} else {
result = ListAdd(list3, JSTaggedValue(i));

View File

@ -79,7 +79,7 @@ JSTaggedValue JSAPITreeMapIterator::Next(EcmaRuntimeCallInfo *argv)
JSHandle<TaggedArray> array = factory->NewTaggedArray(2); // 2 means the length of array
array->Set(thread, 0, key);
array->Set(thread, 1, value);
JSHandle<JSTaggedValue> keyAndValue(JSArray::CreateArrayFromList(thread, array));
JSHandle<JSTaggedValue> keyAndValue(JSArray::CreateArrayFromList(thread, array));
return JSIterator::CreateIterResultObject(thread, keyAndValue, false).GetTaggedValue();
}

View File

@ -1294,7 +1294,7 @@ JSHandle<BigInt> BigInt::DivideAndRemainderWithBigintDivisor(JSThread *thread, J
// qv is used to store the result of quotient * divisor of each round
JSHandle<BigInt> qv = CreateBigint(thread, divisorLen + 1);
uint32_t vHighest = v->GetDigit(divisorLen - 1);
for (int i = quotientLen; i >= 0; --i) {
for (int i = static_cast<int>(quotientLen); i >= 0; --i) {
uint32_t currentUHighest = u->GetDigit(i + divisorLen);
uint32_t r = 0;
uint32_t q = DivideAndRemainder(currentUHighest, u->GetDigit(i + divisorLen - 1), vHighest, r);
@ -1335,13 +1335,13 @@ JSHandle<BigInt> BigInt::DivideAndRemainderWithUint32Divisor(JSThread *thread, J
uint32_t r = 0;
JSMutableHandle<BigInt> quotient(thread, JSTaggedValue::Null());
if (!remainder.GetTaggedValue().IsNull()) {
for (int i = dividend->GetLength() - 1; i >= 0; --i) {
for (int i = static_cast<int>(dividend->GetLength()) - 1; i >= 0; --i) {
DivideAndRemainder(r, dividend->GetDigit(i), divisor, r);
remainder.Update(Uint32ToBigInt(thread, r));
}
} else {
quotient.Update(CreateBigint(thread, dividend->GetLength()));
for (int i = dividend->GetLength() - 1; i >= 0; --i) {
for (int i = static_cast<int>(dividend->GetLength()) - 1; i >= 0; --i) {
uint32_t q = DivideAndRemainder(r, dividend->GetDigit(i), divisor, r);
quotient->SetDigit(i, q);
}
@ -1494,14 +1494,14 @@ JSTaggedNumber BigInt::BigIntToNumber(JSHandle<BigInt> bigint)
uint32_t bigintLen = bigint->GetLength();
uint32_t BigintHead = bigint->GetDigit(bigintLen - 1);
uint32_t leadingZeros = base::CountLeadingZeros(BigintHead);
int bigintBitLen = static_cast<int>(bigintLen * BigInt::DATEBITS) - leadingZeros;
int bigintBitLen = static_cast<int>(bigintLen * BigInt::DATEBITS - leadingZeros);
// if Significant bits greater than 1024 then double is infinity
bool bigintSign = bigint->GetSign();
if (bigintBitLen > (base::DOUBLE_EXPONENT_BIAS + 1)) {
return JSTaggedNumber(bigintSign ? -base::POSITIVE_INFINITY : base::POSITIVE_INFINITY);
}
uint64_t sign = bigintSign ? 1ULL << 63 : 0; // 63 : Set the sign bit of sign to 1
int needMoveBit = leadingZeros + BigInt::DATEBITS + 1;
int needMoveBit = static_cast<int>(leadingZeros + BigInt::DATEBITS + 1);
// Align to the most significant bit, then right shift 12 bits so that the head of the mantissa is in place
uint64_t mantissa = (static_cast<uint64_t>(BigintHead) << needMoveBit) >> 12; // 12 mantissa just has 52 bits
int remainMantissaBits = needMoveBit - 12;

View File

@ -712,7 +712,7 @@ CString JSDate::ToDateString(double timeMs)
}
if (localMin >= 0) {
localTime += PLUS;
} else if (localMin < 0) {
} else {
localTime += NEG;
localMin = -localMin;
}
@ -844,7 +844,7 @@ JSTaggedValue JSDate::ToString(JSThread *thread) const
}
if (localMin >= 0) {
localTime += PLUS;
} else if (localMin < 0) {
} else {
localTime += NEG;
localMin = -localMin;
}

View File

@ -547,7 +547,7 @@ JSHandle<JSArray> JSLocale::SupportedLocales(JSThread *thread, const JSHandle<Ta
// a. Let options be ? ToObject(options).
// b. Let matcher be ? GetOption(options, "localeMatcher", "string", « "lookup", "best fit" », "best fit").
// 2. Else, let matcher be "best fit".
LocaleMatcherOption matcher = LocaleMatcherOption::BEST_FIT;
[[maybe_unused]] LocaleMatcherOption matcher = LocaleMatcherOption::BEST_FIT;
if (!options->IsUndefined()) {
JSHandle<JSObject> obj = JSTaggedValue::ToObject(thread, options);
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSArray, thread);
@ -563,12 +563,7 @@ JSHandle<JSArray> JSLocale::SupportedLocales(JSThread *thread, const JSHandle<Ta
// 4. Else,
// a. Let supportedLocales be LookupSupportedLocales(availableLocales, requestedLocales).
JSMutableHandle<TaggedArray> supportedLocales(thread, JSTaggedValue::Undefined());
bool isBestfitSupport = false;
if (matcher == LocaleMatcherOption::BEST_FIT && isBestfitSupport) {
supportedLocales.Update(BestFitSupportedLocales(thread, availableLocales, requestedLocales).GetTaggedValue());
} else {
supportedLocales.Update(LookupSupportedLocales(thread, availableLocales, requestedLocales).GetTaggedValue());
}
supportedLocales.Update(LookupSupportedLocales(thread, availableLocales, requestedLocales).GetTaggedValue());
JSHandle<JSArray> subset = JSArray::CreateArrayFromList(thread, supportedLocales);
// 5. Return CreateArrayFromList(supportedLocales).
@ -763,10 +758,10 @@ std::string JSLocale::UnicodeExtensionValue(const std::string extension, const s
}
ResolvedLocale JSLocale::ResolveLocale(JSThread *thread, const JSHandle<TaggedArray> &availableLocales,
const JSHandle<TaggedArray> &requestedLocales, LocaleMatcherOption matcher,
const JSHandle<TaggedArray> &requestedLocales,
[[maybe_unused]] LocaleMatcherOption matcher,
const std::set<std::string> &relevantExtensionKeys)
{
bool isBestfitSupport = false;
std::map<std::string, std::set<std::string>> localeMap = {
{"hc", {"h11", "h12", "h23", "h24"}},
{"lb", {"strict", "normal", "loose"}},
@ -783,11 +778,7 @@ ResolvedLocale JSLocale::ResolveLocale(JSThread *thread, const JSHandle<TaggedAr
if (availableLocales->GetLength() == 0 && requestedLocales->GetLength() == 0) {
locale.Update(DefaultLocale(thread).GetTaggedValue());
} else {
if (matcher == LocaleMatcherOption::BEST_FIT && isBestfitSupport) {
locale.Update(BestFitMatcher(thread, availableLocales, requestedLocales).GetTaggedValue());
} else {
locale.Update(LookupMatcher(thread, availableLocales, requestedLocales).GetTaggedValue());
}
locale.Update(LookupMatcher(thread, availableLocales, requestedLocales).GetTaggedValue());
}
// 4. Let foundLocale be r.[[locale]].

View File

@ -223,7 +223,8 @@ public:
// 9.2.7 ResolveLocale ( availableLocales, requestedLocales, options, relevantExtensionKeys, localeData )
static ResolvedLocale ResolveLocale(JSThread *thread, const JSHandle<TaggedArray> &availableLocales,
const JSHandle<TaggedArray> &requestedLocales, LocaleMatcherOption matcher,
const JSHandle<TaggedArray> &requestedLocales,
[[maybe_unused]] LocaleMatcherOption matcher,
const std::set<std::string> &relevantExtensionKeys);
// 9.2.8 LookupSupportedLocales ( availableLocales, requestedLocales )

View File

@ -275,7 +275,6 @@ JSHandle<ConstantPool> PandaFileTranslator::ParseConstPool(EcmaVM *vm, const JSP
constpool->SetObjectToCache(thread, value.GetConstpoolIndex(), literal.GetTaggedValue());
}
}
return constpool;
}

View File

@ -1738,7 +1738,6 @@ EncodeBit SnapshotProcessor::EncodeTaggedObject(TaggedObject *objectHeader, CQue
}
queue->emplace(objectHeader);
size_t objectSize = objectHeader->GetClass()->SizeFromJSHClass(objectHeader);
if (objectSize == 0) {
LOG_ECMA_MEM(FATAL) << "It is a zero object. Not Support.";
}

View File

@ -163,6 +163,6 @@ public:
return wasted & Constants::MAX_UINT_32;
}
};
} // namespace panda::ecmascript
} // namespace panda::ecmascript
#endif // ECMASCRIPT_SNAPSHOT_MEM_SNAPSHOT_PROCESSOR_H

View File

@ -111,7 +111,7 @@ JSHandle<TaggedArray> TSTypeTable::GenerateExportTableFromPandaFile(JSThread *th
for (uint32_t i = 1; i < length; i += ITEM_SIZE) {
target = exportTable->Get(i);
// Create GT based on typeId, and wrapped it into a JSTaggedValue
uint32_t typeId = target.GetInt();
uint32_t typeId = static_cast<uint32_t>(target.GetInt());
GlobalTSTypeRef typeGT = TSTypeParser::CreateGT(ecmaVm, jsPandaFile, typeId);
// Set the wrapped GT to exportTable
exportTable->Set(thread, i, JSTaggedValue(typeGT.GetType()));