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