Change the data type (int to uint)

Signed-off-by: hwx1163501 <hanjing35@huawei.com>
issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I7LDYJ
This commit is contained in:
hwx1163501 2023-07-25 10:33:11 +08:00
parent 2fcde36d5c
commit 29e0ddd5f3
11 changed files with 25 additions and 25 deletions

View File

@ -19,7 +19,7 @@
#include "ecmascript/js_dataview.h"
namespace panda::ecmascript::base {
enum class BytesSize : int32_t {ONEBYTES = 1, TWOBYTES = 2, FOURBYTES = 4, EIGHTBYTES = 8};
enum class BytesSize : uint32_t {ONEBYTES = 1, TWOBYTES = 2, FOURBYTES = 4, EIGHTBYTES = 8};
class AtomicHelper final {
public:

View File

@ -57,7 +57,7 @@ JSHandle<JSTaggedValue> Internalize::InternalizeJsonProperty(JSThread *thread, c
}
// Return ? Call(receiver, holder, « name, val »).
const int32_t argsLength = 2; // 2: « name, val »
const uint32_t argsLength = 2; // 2: « name, val »
JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, receiver, objHandle, undefined, argsLength);
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);

View File

@ -313,7 +313,7 @@ JSTaggedValue JsonStringifier::GetSerializeValue(const JSHandle<JSTaggedValue> &
if (UNLIKELY(replacer->IsCallable())) {
handleValue_.Update(tagValue);
// a. Let value be Call(ReplacerFunction, holder, «key, value»).
const int32_t argsLength = 2; // 2: «key, value»
const uint32_t argsLength = 2; // 2: «key, value»
EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread_, replacer, object, undefined, argsLength);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread_);

View File

@ -2399,7 +2399,7 @@ void LLVMIRBuilder::VisitDeoptCheck(GateRef gate)
size_t shift = Deoptimizier::ComputeShift(maxDepth);
frameState = deoptFrameState;
ArgumentAccessor argAcc(const_cast<Circuit *>(circuit_));
for (int32_t curDepth = maxDepth; curDepth >= 0; curDepth--) {
for (int32_t curDepth = static_cast<int32_t>(maxDepth); curDepth >= 0; curDepth--) {
ASSERT(acc_.GetOpCode(frameState) == OpCode::FRAME_STATE);
GateRef frameValues = acc_.GetValueIn(frameState, 1); // 1: frame values
const size_t numValueIn = acc_.GetNumValueIn(frameValues);

View File

@ -103,8 +103,8 @@ public:
static constexpr int32_t UINT30_MAX = 0x3fffffff;
static constexpr int32_t TYPED_ARRAY_ONHEAP_MAX = JSTypedArray::MAX_ONHEAP_LENGTH;
static const inline std::vector<int32_t> rangeBounds_ = { INT32_MIN, INT32_MIN + 1,
-1, 0, 1, TYPED_ARRAY_ONHEAP_MAX - 1, TYPED_ARRAY_ONHEAP_MAX, TYPED_ARRAY_ONHEAP_MAX + 1, TYPED_ARRAY_ONHEAP_MAX * 3, UINT30_MAX, UINT30_MAX + 1,
INT32_MAX - 1, INT32_MAX };
-1, 0, 1, TYPED_ARRAY_ONHEAP_MAX - 1, TYPED_ARRAY_ONHEAP_MAX, TYPED_ARRAY_ONHEAP_MAX + 1,
TYPED_ARRAY_ONHEAP_MAX * 3, UINT30_MAX, UINT30_MAX + 1, INT32_MAX - 1, INT32_MAX };
static RangeInfo NONE()
{

View File

@ -747,12 +747,12 @@ void OptimizedCall::CallRuntimeWithArgv(ExtendedAssembler *assembler)
Register sp(SP);
// 2 : 2 means pair
__ Stp(argc, argv, MemoryOperand(sp, -FRAME_SLOT_SIZE * 2, AddrMode::PREINDEX));
__ Stp(Register(X30), runtimeId, MemoryOperand(sp, -FRAME_SLOT_SIZE * 2, AddrMode::PREINDEX));
__ Stp(Register(X30), runtimeId, MemoryOperand(sp, -FRAME_SLOT_SIZE * 2, AddrMode::PREINDEX)); // 2 : 2 means pair
Register fp(X29);
// construct leave frame
Register frameType(X9);
__ Mov(frameType, Immediate(static_cast<int64_t>(FrameType::LEAVE_FRAME_WITH_ARGV)));
__ Stp(frameType, Register(X29), MemoryOperand(sp, -FRAME_SLOT_SIZE * 2, AddrMode::PREINDEX));
__ Stp(frameType, Register(X29), MemoryOperand(sp, -FRAME_SLOT_SIZE * 2, AddrMode::PREINDEX)); // 2 : 2 means pair
__ Add(Register(FP), sp, Immediate(FRAME_SLOT_SIZE));
__ Str(fp, MemoryOperand(glue, JSThread::GlueData::GetLeaveFrameOffset(false)));

View File

@ -66,13 +66,13 @@ uint32_t JSMap::GetSize() const
return LinkedHashMap::Cast(GetLinkedMap().GetTaggedObject())->NumberOfElements();
}
JSTaggedValue JSMap::GetKey(int entry) const
JSTaggedValue JSMap::GetKey(uint32_t entry) const
{
ASSERT_PRINT(entry >= 0 && entry < GetSize(), "entry must be non-negative integer less than capacity");
return LinkedHashMap::Cast(GetLinkedMap().GetTaggedObject())->GetKey(entry);
}
JSTaggedValue JSMap::GetValue(int entry) const
JSTaggedValue JSMap::GetValue(uint32_t entry) const
{
ASSERT_PRINT(entry >= 0 && entry < GetSize(), "entry must be non-negative integer less than capacity");
return LinkedHashMap::Cast(GetLinkedMap().GetTaggedObject())->GetValue(entry);

View File

@ -36,9 +36,9 @@ public:
uint32_t GetSize() const;
JSTaggedValue GetKey(int entry) const;
JSTaggedValue GetKey(uint32_t entry) const;
JSTaggedValue GetValue(int entry) const;
JSTaggedValue GetValue(uint32_t entry) const;
static constexpr size_t LINKED_MAP_OFFSET = JSObject::SIZE;
ACCESSORS(LinkedMap, LINKED_MAP_OFFSET, SIZE)

View File

@ -141,7 +141,7 @@ JSHandle<Derived> TaggedTree<Derived>::AdjustTaggedTree(const JSThread *thread,
return newTree;
}
int elements = tree->NumberOfElements();
uint32_t elements = tree->NumberOfElements();
newTree.Update(factory->NewTaggedArray(len).GetTaggedValue());
newTree->SetNumberOfElements(thread, elements);
newTree->SetNumberOfDeletedElements(thread, 0);
@ -393,7 +393,7 @@ JSHandle<Derived> TaggedTree<Derived>::Insert(JSThread *thread, JSHandle<Derived
parentKey.Update(newTree->GetKey(parentIndex));
}
int entry = newTree->NumberOfElements() + newTree->NumberOfDeletedElements();
uint32_t entry = newTree->NumberOfElements() + newTree->NumberOfDeletedElements();
if (res != ComparisonResult::LESS) {
newTree->InsertRightEntry(thread, parentIndex, entry, key.GetTaggedValue(), value.GetTaggedValue());
} else {
@ -407,9 +407,9 @@ JSHandle<Derived> TaggedTree<Derived>::Insert(JSThread *thread, JSHandle<Derived
template<typename Derived>
JSHandle<Derived> TaggedTree<Derived>::GrowCapacity(const JSThread *thread, JSHandle<Derived> &tree)
{
int nof = tree->NumberOfElements() + tree->NumberOfDeletedElements();
uint32_t nof = tree->NumberOfElements() + tree->NumberOfDeletedElements();
int oldCapacity = tree->Capacity();
if (nof + 1 <= oldCapacity) {
if (static_cast<int>(nof + 1) <= oldCapacity) {
return tree;
}
@ -470,7 +470,7 @@ template<typename Derived>
JSHandle<Derived> TaggedTree<Derived>::Shrink(const JSThread *thread, const JSHandle<Derived> &tree)
{
int oldCapacity = static_cast<int>(tree->Capacity());
if (tree->NumberOfElements() >= (oldCapacity + 1) / 4) { // 4: quarter
if (static_cast<int>(tree->NumberOfElements()) >= (oldCapacity + 1) / 4) { // 4: quarter
return tree;
}
uint32_t newCapacity = static_cast<uint32_t>(oldCapacity - 1) >> 1;

View File

@ -59,12 +59,12 @@ public:
static void Remove(const JSThread *thread, const JSHandle<Derived> &tree, int entry);
inline int NumberOfElements() const
inline uint32_t NumberOfElements() const
{
return Get(NUMBER_OF_ELEMENTS_INDEX).GetInt();
}
inline int NumberOfDeletedElements() const
inline uint32_t NumberOfDeletedElements() const
{
return Get(NUMBER_OF_HOLE_ENTRIES_INDEX).GetInt();
}
@ -109,7 +109,7 @@ public:
return !key.IsHole();
}
inline void SetNumberOfElements(const JSThread *thread, int num)
inline void SetNumberOfElements(const JSThread *thread, uint32_t num)
{
Set(thread, NUMBER_OF_ELEMENTS_INDEX, JSTaggedValue(num));
}