修改4.1-Release告警

Signed-off-by: hwx1163501 <hanjing35@huawei.com>
issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I94C2T
This commit is contained in:
hwx1163501 2024-02-28 11:15:20 +08:00
parent 36aa2bdd02
commit 95a84cb956
14 changed files with 69 additions and 60 deletions

View File

@ -69,7 +69,7 @@ inline constexpr uint32_t CountLeadingZeros(T value)
static_assert(std::numeric_limits<T>::radix == RADIX, "Unexpected radix!");
static_assert(sizeof(T) == sizeof(uint64_t) || sizeof(T) <= sizeof(uint32_t), "Unsupported sizeof(T)");
if (value == 0) {
return sizeof(T) * 8;
return sizeof(T) * 8; // 8 : byte size
}
if (sizeof(T) == sizeof(uint64_t)) {
return __builtin_clzll(static_cast<uint64_t>(value));
@ -107,7 +107,7 @@ inline constexpr uint32_t CountTrailingZeros(T value)
static_assert(std::numeric_limits<T>::radix == RADIX, "Unexpected radix!");
static_assert(sizeof(T) == sizeof(uint64_t) || sizeof(T) <= sizeof(uint32_t), "Unsupported sizeof(T)");
if (value == 0) {
return sizeof(T) * 8;
return sizeof(T) * 8; // 8 : byte size
}
if (sizeof(T) == sizeof(uint64_t)) {
return __builtin_ctzll(static_cast<uint64_t>(value));

View File

@ -3646,7 +3646,7 @@ void Builtins::InitializeCjsModule(const JSHandle<GlobalEnv> &env) const
JSHandle<JSTaggedValue> loaded(factory_->NewEmptyJSObject());
JSHandle<JSTaggedValue> children(factory_->NewEmptyJSObject());
JSHandle<JSTaggedValue> cache = JSHandle<JSTaggedValue>::Cast(CjsModuleCache::Create(thread_,
CjsModuleCache::DEAULT_DICTIONART_CAPACITY));
CjsModuleCache::DEAULT_DICTIONART_CAPACITY));
// CjsModule.prototype members
SetNonConstantObject(cjsModulePrototype, "id", id);

View File

@ -35,14 +35,14 @@ LogicalImmediate LogicalImmediate::Create(uint64_t imm, int width)
// First, determine the element size.
unsigned int size = static_cast<uint32_t>(width);
do {
size /= 2;
size /= 2; // 2 : Divide by 2
uint64_t mask = (1ULL << size) - 1;
if ((imm & mask) != ((imm >> size) & mask)) {
size *= 2;
size *= 2; // 2 : Multiply by 2
break;
}
} while (size > 2);
} while (size > 2); // 2 : Greater than 2
// Second, determine the rotation to make the element be: 0^m 1^n.
unsigned int cto = 0;
@ -408,7 +408,8 @@ void AssemblerAarch64::Mov(const Register &rd, const Immediate &imm)
return;
}
// One to up three instruction sequence.
if (allOneHalfWords >= (halfWords - 2) || allZeroHalfWords >= (halfWords - 2)) {
if (allOneHalfWords >= (halfWords - 2) || // 2 : Must be greater than or equal to (halfWords -2)
allZeroHalfWords >= (halfWords - 2)) { // 2 : Must be greater than or equal to (halfWords -2)
EmitMovInstruct(rd, immValue, allOneHalfWords, allZeroHalfWords);
return;
}
@ -755,12 +756,12 @@ void AssemblerAarch64::Lsr(const Register &rd, const Register &rn, unsigned shif
// 31 : 31 32-bit variant Applies when sf == 0 && N == 0 && imms == 011111
// LSR <Wd>, <Wn>, #<shift> is equivalent to UBFM <Wd>, <Wn>, #<shift>, #31
// and is always the preferred disassembly
imms = 31;
imms = 31; // 31 : 32-bit variant Applies
} else {
// 63 : 63 64-bit variant Applies when sf == 1 && N == 1 && imms == 111111
// LSR <Xd>, <Xn>, #<shift> is equivalent to UBFM <Xd>, <Xn>, #<shift>, #63
// and is always the preferred disassembly
imms = 63;
imms = 63; // 63 : 64-bit variant Applies
}
Ubfm(rd, rn, shift, imms);
}

View File

@ -96,15 +96,15 @@ public:
inline int GetRegSize() const
{
if (scale_ == B) {
return 8;
return 8; // 8 : RegSize
} else if (scale_ == H) {
return 16;
return 16; // 16 : RegSize
} else if (scale_ == S) {
return 32;
return 32; // 32 : RegSize
} else if (scale_ == D) {
return 64;
return 64; // 64 : RegSize
} else if (scale_ == Q) {
return 128;
return 128; // 128 : RegSize
}
LOG_ECMA(FATAL) << "this branch is unreachable";
UNREACHABLE();

View File

@ -104,9 +104,8 @@ GateRef InterpreterStubBuilder::ReadInst4_2(GateRef pc)
GateRef InterpreterStubBuilder::ReadInst4_3(GateRef pc)
{
// 2 : skip 1 byte of bytecode
return Int8And(
Int8LSR(Load(VariableType::INT8(), pc, IntPtr(2)), Int8(4)), Int8(0xf)); // 4 : read 4 byte of bytecode
return Int8And(Int8LSR(Load(VariableType::INT8(), pc, IntPtr(2)), // 2 : skip 1 byte of bytecode
Int8(4)), Int8(0xf)); // 4 : read 4 byte of bytecode
}
GateRef InterpreterStubBuilder::ReadInstSigned8_0(GateRef pc)
@ -352,7 +351,7 @@ void InterpreterStubBuilder::SetHomeObjectToFunction(GateRef glue, GateRef funct
}
void InterpreterStubBuilder::SetFrameState(GateRef glue, GateRef sp, GateRef function, GateRef acc,
GateRef env, GateRef pc, GateRef prev, GateRef type)
GateRef env, GateRef pc, GateRef prev, GateRef type)
{
GateRef state = GetFrame(sp);
SetFunctionToFrame(glue, state, function);
@ -579,7 +578,7 @@ void InterpreterStubBuilder::DispatchBase(GateRef target, GateRef glue, Args...
}
void InterpreterStubBuilder::Dispatch(GateRef glue, GateRef sp, GateRef pc, GateRef constpool, GateRef profileTypeInfo,
GateRef acc, GateRef hotnessCounter, GateRef format)
GateRef acc, GateRef hotnessCounter, GateRef format)
{
GateRef newPc = PtrAdd(pc, format);
GateRef opcode = Load(VariableType::INT8(), newPc);
@ -589,7 +588,7 @@ void InterpreterStubBuilder::Dispatch(GateRef glue, GateRef sp, GateRef pc, Gate
}
void InterpreterStubBuilder::DispatchLast(GateRef glue, GateRef sp, GateRef pc, GateRef constpool,
GateRef profileTypeInfo, GateRef acc, GateRef hotnessCounter)
GateRef profileTypeInfo, GateRef acc, GateRef hotnessCounter)
{
GateRef target = PtrMul(IntPtr(BytecodeStubCSigns::ID_ExceptionHandler), IntPtrSize());
DispatchBase(target, glue, sp, pc, constpool, profileTypeInfo, acc, hotnessCounter);
@ -597,7 +596,7 @@ void InterpreterStubBuilder::DispatchLast(GateRef glue, GateRef sp, GateRef pc,
}
void InterpreterStubBuilder::DispatchDebugger(GateRef glue, GateRef sp, GateRef pc, GateRef constpool,
GateRef profileTypeInfo, GateRef acc, GateRef hotnessCounter)
GateRef profileTypeInfo, GateRef acc, GateRef hotnessCounter)
{
GateRef opcode = Load(VariableType::INT8(), pc);
GateRef target = PtrMul(ZExtInt32ToPtr(ZExtInt8ToInt32(opcode)), IntPtrSize());
@ -607,7 +606,7 @@ void InterpreterStubBuilder::DispatchDebugger(GateRef glue, GateRef sp, GateRef
}
void InterpreterStubBuilder::DispatchDebuggerLast(GateRef glue, GateRef sp, GateRef pc, GateRef constpool,
GateRef profileTypeInfo, GateRef acc, GateRef hotnessCounter)
GateRef profileTypeInfo, GateRef acc, GateRef hotnessCounter)
{
GateRef target = PtrMul(IntPtr(BytecodeStubCSigns::ID_ExceptionHandler), IntPtrSize());
auto args = { glue, sp, pc, constpool, profileTypeInfo, acc, hotnessCounter };

View File

@ -2688,9 +2688,8 @@ DECLARE_ASM_HANDLER(HandleSuspendgeneratorV8)
varProfileTypeInfo = GetProfileTypeInfoFromMethod(method);
varHotnessCounter = GetHotnessCounterFromMethod(method);
GateRef jumpSize = GetCallSizeFromFrame(prevState);
CallNGCRuntime(glue, RTSTUB_ID(ResumeRspAndDispatch),
{ glue, currentSp, *varPc, *varConstpool, *varProfileTypeInfo,
*varAcc, *varHotnessCounter, jumpSize });
CallNGCRuntime(glue, RTSTUB_ID(ResumeRspAndDispatch), { glue, currentSp, *varPc, *varConstpool,
*varProfileTypeInfo, *varAcc, *varHotnessCounter, jumpSize });
Return();
}
}
@ -2769,9 +2768,8 @@ DECLARE_ASM_HANDLER(HandleDeprecatedSuspendgeneratorPrefV8V8)
varProfileTypeInfo = GetProfileTypeInfoFromMethod(method);
varHotnessCounter = GetHotnessCounterFromMethod(method);
GateRef jumpSize = GetCallSizeFromFrame(prevState);
CallNGCRuntime(glue, RTSTUB_ID(ResumeRspAndDispatch),
{ glue, currentSp, *varPc, *varConstpool, *varProfileTypeInfo,
*varAcc, *varHotnessCounter, jumpSize });
CallNGCRuntime(glue, RTSTUB_ID(ResumeRspAndDispatch), { glue, currentSp, *varPc, *varConstpool,
*varProfileTypeInfo, *varAcc, *varHotnessCounter, jumpSize });
Return();
}
}
@ -3091,9 +3089,8 @@ DECLARE_ASM_HANDLER(HandleAsyncgeneratorresolveV8V8V8)
varProfileTypeInfo = GetProfileTypeInfoFromMethod(method);
varHotnessCounter = GetHotnessCounterFromMethod(method);
GateRef jumpSize = GetCallSizeFromFrame(prevState);
CallNGCRuntime(glue, RTSTUB_ID(ResumeRspAndDispatch),
{ glue, currentSp, *varPc, *varConstpool, *varProfileTypeInfo,
*varAcc, *varHotnessCounter, jumpSize });
CallNGCRuntime(glue, RTSTUB_ID(ResumeRspAndDispatch), { glue, currentSp, *varPc, *varConstpool,
*varProfileTypeInfo, *varAcc, *varHotnessCounter, jumpSize });
Return();
}
}
@ -4900,9 +4897,8 @@ DECLARE_ASM_HANDLER(BCDebuggerEntry)
varProfileTypeInfo = GetProfileTypeInfoFromMethod(method);
varHotnessCounter = GetHotnessCounterFromMethod(method);
GateRef jumpSize = IntPtr(0);
CallNGCRuntime(glue, RTSTUB_ID(ResumeRspAndRollback),
{ glue, currentSp, *varPc, *varConstpool, *varProfileTypeInfo,
*varAcc, *varHotnessCounter, jumpSize });
CallNGCRuntime(glue, RTSTUB_ID(ResumeRspAndRollback), { glue, currentSp, *varPc, *varConstpool,
*varProfileTypeInfo, *varAcc, *varHotnessCounter, jumpSize });
Return();
}
}

View File

@ -1844,7 +1844,8 @@ inline void StubBuilder::SetPrototypeToHClass(VariableType type, GateRef glue, G
Store(type, glue, hClass, offset, proto);
}
inline void StubBuilder::SetProtoChangeDetailsToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef protoChange)
inline void StubBuilder::SetProtoChangeDetailsToHClass(VariableType type, GateRef glue,
GateRef hClass, GateRef protoChange)
{
GateRef offset = IntPtr(JSHClass::PROTO_CHANGE_DETAILS_OFFSET);
Store(type, glue, hClass, offset, protoChange);
@ -2137,9 +2138,8 @@ inline GateRef StubBuilder::IsSpecialContainer(GateRef jsType)
inline GateRef StubBuilder::IsFastTypeArray(GateRef jsType)
{
return BoolAnd(
Int32GreaterThanOrEqual(jsType, Int32(static_cast<int32_t>(JSType::JS_TYPED_ARRAY_FIRST))),
Int32LessThanOrEqual(jsType, Int32(static_cast<int32_t>(JSType::JS_FLOAT64_ARRAY))));
return BoolAnd(Int32GreaterThanOrEqual(jsType, Int32(static_cast<int32_t>(JSType::JS_TYPED_ARRAY_FIRST))),
Int32LessThanOrEqual(jsType, Int32(static_cast<int32_t>(JSType::JS_FLOAT64_ARRAY))));
}
inline GateRef StubBuilder::IsAccessorInternal(GateRef value)

View File

@ -4002,7 +4002,6 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, const uint8_t
uint16_t firstArgRegIdx = READ_INST_8_2();
LOG_INST() << "intrinsics::newobjRange " << numArgs << " v" << firstArgRegIdx;
JSTaggedValue ctor = GET_VREG_VALUE(firstArgRegIdx);
if (ctor.IsJSFunction() && ctor.IsConstructor()) {
JSFunction *ctorFunc = JSFunction::Cast(ctor.GetTaggedObject());
methodHandle.Update(ctorFunc->GetMethod());
@ -4138,7 +4137,6 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, const uint8_t
uint16_t firstArgRegIdx = READ_INST_8_3();
LOG_INST() << "intrinsics::newobjRange " << numArgs << " v" << firstArgRegIdx;
JSTaggedValue ctor = GET_VREG_VALUE(firstArgRegIdx);
if (ctor.IsJSFunction() && ctor.IsConstructor()) {
JSFunction *ctorFunc = JSFunction::Cast(ctor.GetTaggedObject());
methodHandle.Update(ctorFunc->GetMethod());
@ -4275,7 +4273,6 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, const uint8_t
uint16_t firstArgRegIdx = READ_INST_8_3();
LOG_INST() << "intrinsics::newobjRange " << numArgs << " v" << firstArgRegIdx;
JSTaggedValue ctor = GET_VREG_VALUE(firstArgRegIdx);
if (ctor.IsJSFunction() && ctor.IsConstructor()) {
JSFunction *ctorFunc = JSFunction::Cast(ctor.GetTaggedObject());
methodHandle.Update(ctorFunc->GetMethod());
@ -5074,7 +5071,6 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, const uint8_t
LOG_INST() << "intrinsics::resumegenerator";
uint16_t vs = READ_INST_8_1();
JSTaggedValue objVal = GET_VREG_VALUE(vs);
if (objVal.IsAsyncGeneratorObject()) {
JSAsyncGeneratorObject *obj = JSAsyncGeneratorObject::Cast(objVal.GetTaggedObject());
SET_ACC(obj->GetResumeResult());
@ -5101,7 +5097,6 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, const uint8_t
LOG_INST() << "intrinsics::getresumemode";
uint16_t vs = READ_INST_8_1();
JSTaggedValue objVal = GET_VREG_VALUE(vs);
if (objVal.IsAsyncGeneratorObject()) {
JSAsyncGeneratorObject *obj = JSAsyncGeneratorObject::Cast(objVal.GetTaggedObject());
SET_ACC(JSTaggedValue(static_cast<int>(obj->GetResumeMode())));

View File

@ -53,8 +53,7 @@ bool DateUtils::IsLeap(int64_t year)
// static
int64_t DateUtils::GetDaysInYear(int64_t year)
{
int64_t number;
number = IsLeap(year) ? (DAYS_IN_YEAR + 1) : DAYS_IN_YEAR;
int64_t number = IsLeap(year) ? (DAYS_IN_YEAR + 1) : DAYS_IN_YEAR;
return number;
}
@ -276,8 +275,7 @@ JSTaggedValue JSDate::LocalParseStringToMs(const CString &str)
int localHours = 0;
int localMinutes = 0;
int64_t localMs = 0;
CString::size_type localSpace;
localSpace = str.find(' ', index);
CString::size_type localSpace = str.find(' ', index);
CString strMonth = str.substr(localSpace + 1, LENGTH_MONTH_NAME);
for (int i = 0; i < MOUTH_PER_YEAR; i++) {
if (strMonth == monthName[i]) {

View File

@ -1206,8 +1206,8 @@ JSHandle<JSArray> JSDateTimeFormat::ConstructFDateIntervalToJSArray(JSThread *th
int index = 0;
int32_t preEndPos = 0;
// 2: number of elements
std::array<int32_t, 2> begin {};
std::array<int32_t, 2> end {};
std::array<int32_t, 2> begin {}; // 2 : array size
std::array<int32_t, 2> end {}; // 2 : array size
begin[0] = begin[1] = end[0] = end[1] = 0;
std::vector<CommonDateFormatPart> parts;

View File

@ -433,8 +433,7 @@ public:
const char *localeCountry = locale.getCountry();
const char *localeScript = locale.getScript();
if (localeCountry[0] != '\0' && localeScript[0] != '\0') {
std::string removeCountry;
removeCountry = locale.getLanguage();
std::string removeCountry = locale.getLanguage();
removeCountry.append("-");
removeCountry.append(localeScript);
return CheckLocales(removeCountry.c_str(), key, packageName, res);

View File

@ -176,7 +176,7 @@ DEF_RUNTIME_STUBS(CallInternalSetter)
RUNTIME_STUBS_HEADER(CallInternalSetter);
JSHandle<JSObject> receiver = GetHArg<JSObject>(argv, argc, 0); // 0: means the zeroth parameter
JSTaggedType argSetter = GetTArg(argv, argc, 1); // 1: means the first parameter
JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 2);
JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 2); // 2 : means the second parameter
auto setter = AccessorData::Cast((reinterpret_cast<TaggedObject *>(argSetter)));
auto result = setter->CallInternalSet(thread, receiver, value, true);
if (!result) {
@ -793,7 +793,6 @@ DEF_RUNTIME_STUBS(Exp)
RUNTIME_STUBS_HEADER(Exp);
JSTaggedValue baseValue = GetArg(argv, argc, 0); // 0: means the zeroth parameter
JSTaggedValue exponentValue = GetArg(argv, argc, 1); // 1: means the first parameter
if (baseValue.IsNumber() && exponentValue.IsNumber()) {
// fast path
double doubleBase = baseValue.IsInt() ? baseValue.GetInt() : baseValue.GetDouble();
@ -966,9 +965,9 @@ DEF_RUNTIME_STUBS(SuperCallSpread)
DEF_RUNTIME_STUBS(OptSuperCallSpread)
{
RUNTIME_STUBS_HEADER(OptSuperCallSpread);
JSHandle<JSTaggedValue> func = GetHArg<JSTaggedValue>(argv, argc, 0);
JSHandle<JSTaggedValue> newTarget = GetHArg<JSTaggedValue>(argv, argc, 1);
JSHandle<JSTaggedValue> array = GetHArg<JSTaggedValue>(argv, argc, 2);
JSHandle<JSTaggedValue> func = GetHArg<JSTaggedValue>(argv, argc, 0); // 0: means the zeroth parameter
JSHandle<JSTaggedValue> newTarget = GetHArg<JSTaggedValue>(argv, argc, 1); // 1: means the first parameter
JSHandle<JSTaggedValue> array = GetHArg<JSTaggedValue>(argv, argc, 2); // 2: means the second parameter
return RuntimeSuperCallSpread(thread, func, newTarget, array).GetRawData();
}

View File

@ -1,3 +1,18 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
let x = 0
let y = 3.14
let z = x + y

View File

@ -1,11 +1,18 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# HDF is dual licensed: you can use it either under the terms of
# the GPL, or the BSD license, at your option.
# See the LICENSE file in the root of this repository for complete details.
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import shutil