mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-23 01:59:58 +00:00
Modify code warning
Issue : https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I8VGFI Signed-off-by: liushitong <liushitong@huawei.com>
This commit is contained in:
parent
78651a6021
commit
3738ffa28c
@ -83,7 +83,7 @@ static std::pair<TaggedArray*, size_t> BuildArgumentsListFast(JSThread *thread,
|
||||
TaggedArray *elements = nullptr;
|
||||
if (argList->GetElements().IsMutantTaggedArray()) {
|
||||
JSHandle<JSObject> obj(arrayObj);
|
||||
int elementsLength = ElementAccessor::GetElementsLength(obj);
|
||||
int elementsLength = static_cast<int>(ElementAccessor::GetElementsLength(obj));
|
||||
JSHandle<TaggedArray> newElements = thread->GetEcmaVM()->GetFactory()->
|
||||
NewTaggedArray(elementsLength, JSTaggedValue::Undefined());
|
||||
for (int i = 0; i < elementsLength; ++i) {
|
||||
|
@ -48,7 +48,6 @@ public:
|
||||
// If not specified, default to: Ofastcompile, Elf, X86_64, NoDebug, Quiet
|
||||
|
||||
// O0/O1/Ofastcompile
|
||||
// LiteCG& SetOptLevel(); // default to fastcompile
|
||||
|
||||
// return LiteCG& enables chaining of config functions.
|
||||
LiteCG &SetOutputType(OutputType config);
|
||||
|
@ -153,7 +153,7 @@ void OptCodeProfiler::Update(JSHandle<JSTaggedValue> &func, int bcIndex, EcmaOpc
|
||||
auto itr = std::find(abcNames_.begin(), abcNames_.end(), pfName);
|
||||
uint32_t index = 0;
|
||||
if (itr != abcNames_.end()) {
|
||||
index = std::distance(abcNames_.begin(), itr);
|
||||
index = static_cast<uint32_t>(std::distance(abcNames_.begin(), itr));
|
||||
} else {
|
||||
abcNames_.emplace_back(pfName);
|
||||
index = abcNames_.size();
|
||||
|
@ -850,7 +850,7 @@ void SendableClassDefiner::AddFieldTypeToHClass(JSThread *thread, const JSHandle
|
||||
{
|
||||
uint32_t length = fieldTypeArray->GetLength();
|
||||
JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
|
||||
uint32_t index = layout->NumberOfElements();
|
||||
uint32_t index = static_cast<uint32_t>(layout->NumberOfElements());
|
||||
PropertyAttributes attributes = PropertyAttributes::Default(true, true, false);
|
||||
attributes.SetIsInlinedProps(true);
|
||||
attributes.SetRepresentation(Representation::TAGGED);
|
||||
|
@ -674,9 +674,9 @@ void Heap::OnAllocateEvent([[maybe_unused]] TaggedObject* address, [[maybe_unuse
|
||||
|
||||
std::string FormatCmdLine(const std::string& cmdLine)
|
||||
{
|
||||
int startPos = 0;
|
||||
int endPos = cmdLine.size();
|
||||
for (unsigned long i = 0; i < cmdLine.size(); i++) {
|
||||
std::string::size_type startPos = 0;
|
||||
std::string::size_type endPos = cmdLine.size();
|
||||
for (std::string::size_type i = 0; i < cmdLine.size(); i++) {
|
||||
if (cmdLine[i] == '/') {
|
||||
startPos = i + 1;
|
||||
} else if (cmdLine[i] == '\0') {
|
||||
|
@ -1229,7 +1229,7 @@ void PGOProfiler::UpdateTranstionLayout(JSHClass *parent, JSHClass *child)
|
||||
}
|
||||
}
|
||||
|
||||
int32_t size = hclassVec.size();
|
||||
int32_t size = static_cast<int32_t>(hclassVec.size());
|
||||
for (int32_t i = size - 1; i >= 0; i--) {
|
||||
curHClass = hclassVec[i];
|
||||
curType = typeVec[i];
|
||||
|
@ -17,7 +17,7 @@ let a = [1, 2, 3];
|
||||
let b = [1, , 3];
|
||||
let c = [1, 2, 'test', 1];
|
||||
let d = [1, 2, 3, 4.23];
|
||||
let e = new Array(3);
|
||||
let e = new Array(3); // 3 is the size of Array
|
||||
|
||||
function foo(p) {
|
||||
p[1] = 1.1;
|
||||
|
@ -410,7 +410,7 @@ public:
|
||||
auto count = from->GetCount();
|
||||
size_t size = sizeof(PGOProtoChainTemplate);
|
||||
if (count != 0) {
|
||||
size += sizeof(PGOProfileType) * (count - 1) * 2; // 2 means mul by 2
|
||||
size += sizeof(PGOProfileType) * (static_cast<size_t>(count) - 1) * 2; // 2 means mul by 2
|
||||
}
|
||||
auto result = reinterpret_cast<PGOProtoChainTemplate *>(malloc(size));
|
||||
new (result) PGOProtoChainTemplate(size, count);
|
||||
|
@ -640,7 +640,7 @@ public:
|
||||
JSHandle<JSTaggedValue> val3 = JSObject::GetProperty(thread, sObj, key3).GetRawValue();
|
||||
JSHandle<JSTaggedValue> val4 = JSObject::GetProperty(thread, sObj, key4).GetRawValue();
|
||||
EXPECT_TRUE(val4->IsJSSharedFunction());
|
||||
EXPECT_EQ(val1->GetInt(), 1024);
|
||||
EXPECT_EQ(val1->GetInt(), 1024); // 1024 is the expected value
|
||||
EXPECT_TRUE(val2->ToBoolean());
|
||||
JSHandle<EcmaString> str3 = JSHandle<EcmaString>(val3);
|
||||
JSHandle<EcmaString> strTest3 = factory->NewFromStdString("hello world!");
|
||||
|
@ -2977,7 +2977,7 @@ JSTaggedValue RuntimeStubs::RuntimeCreatePrivateProperty(JSThread *thread, JSTag
|
||||
return JSTaggedValue::Undefined();
|
||||
}
|
||||
// instace property number is hidden in the last index of literal buffer
|
||||
uint32_t instacePropertyCount = literalBuffer->Get(literalBufferLength - 1).GetInt();
|
||||
uint32_t instacePropertyCount = static_cast<uint32_t>(literalBuffer->Get(literalBufferLength - 1).GetInt());
|
||||
ASSERT(startIndex + count + literalBufferLength - (instacePropertyCount == 0) <= length);
|
||||
for (uint32_t i = 0; i < literalBufferLength - 1; i++) {
|
||||
JSTaggedValue literalValue = literalBuffer->Get(i);
|
||||
|
@ -1680,8 +1680,8 @@ DEF_RUNTIME_STUBS(LdPrivateProperty)
|
||||
{
|
||||
RUNTIME_STUBS_HEADER(LdPrivateProperty);
|
||||
JSTaggedValue lexicalEnv = GetArg(argv, argc, 0); // 0: means the zeroth parameter
|
||||
uint32_t levelIndex = GetArg(argv, argc, 1).GetInt(); // 1: means the first parameter
|
||||
uint32_t slotIndex = GetArg(argv, argc, 2).GetInt(); // 2: means the second parameter
|
||||
uint32_t levelIndex = static_cast<uint32_t>(GetArg(argv, argc, 1).GetInt()); // 1: means the first parameter
|
||||
uint32_t slotIndex = static_cast<uint32_t>(GetArg(argv, argc, 2).GetInt()); // 2: means the second parameter
|
||||
JSTaggedValue obj = GetArg(argv, argc, 3); // 3: means the third parameter
|
||||
return RuntimeLdPrivateProperty(thread, lexicalEnv, levelIndex, slotIndex, obj).GetRawData();
|
||||
}
|
||||
@ -1690,8 +1690,8 @@ DEF_RUNTIME_STUBS(StPrivateProperty)
|
||||
{
|
||||
RUNTIME_STUBS_HEADER(StPrivateProperty);
|
||||
JSTaggedValue lexicalEnv = GetArg(argv, argc, 0); // 0: means the zeroth parameter
|
||||
uint32_t levelIndex = GetArg(argv, argc, 1).GetInt(); // 1: means the first parameter
|
||||
uint32_t slotIndex = GetArg(argv, argc, 2).GetInt(); // 2: means the second parameter
|
||||
uint32_t levelIndex = static_cast<uint32_t>(GetArg(argv, argc, 1).GetInt()); // 1: means the first parameter
|
||||
uint32_t slotIndex = static_cast<uint32_t>(GetArg(argv, argc, 2).GetInt()); // 2: means the second parameter
|
||||
JSTaggedValue obj = GetArg(argv, argc, 3); // 3: means the third parameter
|
||||
JSTaggedValue value = GetArg(argv, argc, 4); // 4: means the fourth parameter
|
||||
return RuntimeStPrivateProperty(thread, lexicalEnv, levelIndex, slotIndex, obj, value).GetRawData();
|
||||
@ -1701,8 +1701,8 @@ DEF_RUNTIME_STUBS(TestIn)
|
||||
{
|
||||
RUNTIME_STUBS_HEADER(TestIn);
|
||||
JSTaggedValue lexicalEnv = GetArg(argv, argc, 0); // 0: means the zeroth parameter
|
||||
uint32_t levelIndex = GetArg(argv, argc, 1).GetInt(); // 1: means the first parameter
|
||||
uint32_t slotIndex = GetArg(argv, argc, 2).GetInt(); // 2: means the second parameter
|
||||
uint32_t levelIndex = static_cast<uint32_t>(GetArg(argv, argc, 1).GetInt()); // 1: means the first parameter
|
||||
uint32_t slotIndex = static_cast<uint32_t>(GetArg(argv, argc, 2).GetInt()); // 2: means the second parameter
|
||||
JSTaggedValue obj = GetArg(argv, argc, 3); // 3: means the third parameter
|
||||
return RuntimeTestIn(thread, lexicalEnv, levelIndex, slotIndex, obj).GetRawData();
|
||||
}
|
||||
@ -2595,9 +2595,9 @@ DEF_RUNTIME_STUBS(CreatePrivateProperty)
|
||||
{
|
||||
RUNTIME_STUBS_HEADER(CreatePrivateProperty);
|
||||
JSTaggedValue lexicalEnv = GetArg(argv, argc, 0); // 0: means the zeroth parameter
|
||||
uint32_t count = GetArg(argv, argc, 1).GetInt(); // 1: means the first parameter
|
||||
uint32_t count = static_cast<uint32_t>(GetArg(argv, argc, 1).GetInt()); // 1: means the first parameter
|
||||
JSTaggedValue constpool = GetArg(argv, argc, 2); // 2: means the second parameter
|
||||
uint32_t literalId = GetArg(argv, argc, 3).GetInt(); // 3: means the third parameter
|
||||
uint32_t literalId = static_cast<uint32_t>(GetArg(argv, argc, 3).GetInt()); // 3: means the third parameter
|
||||
JSTaggedValue module = GetArg(argv, argc, 4); // 4: means the fourth parameter
|
||||
return RuntimeCreatePrivateProperty(thread, lexicalEnv, count, constpool, literalId, module).GetRawData();
|
||||
}
|
||||
@ -2606,8 +2606,8 @@ DEF_RUNTIME_STUBS(DefinePrivateProperty)
|
||||
{
|
||||
RUNTIME_STUBS_HEADER(DefinePrivateProperty);
|
||||
JSTaggedValue lexicalEnv = GetArg(argv, argc, 0); // 0: means the zeroth parameter
|
||||
uint32_t levelIndex = GetArg(argv, argc, 1).GetInt(); // 1: means the first parameter
|
||||
uint32_t slotIndex = GetArg(argv, argc, 2).GetInt(); // 2: means the second parameter
|
||||
uint32_t levelIndex = static_cast<uint32_t>(GetArg(argv, argc, 1).GetInt()); // 1: means the first parameter
|
||||
uint32_t slotIndex = static_cast<uint32_t>(GetArg(argv, argc, 2).GetInt()); // 2: means the second parameter
|
||||
JSTaggedValue obj = GetArg(argv, argc, 3); // 3: means the third parameter
|
||||
JSTaggedValue value = GetArg(argv, argc, 4); // 4: means the fourth parameter
|
||||
return RuntimeDefinePrivateProperty(thread, lexicalEnv, levelIndex, slotIndex, obj, value).GetRawData();
|
||||
|
@ -19,7 +19,6 @@ function foo () {
|
||||
let a : number[][];
|
||||
a = new Array(500);
|
||||
for (let i = 0; i < 500; i++) {
|
||||
// let arr = new Array(500);
|
||||
let arr = new Array(500);
|
||||
a[i] = arr;
|
||||
for (let j = 0; j < 500; j++) {
|
||||
|
Loading…
Reference in New Issue
Block a user