diff --git a/runtime/ic/ic_runtime_stub-inl.h b/runtime/ic/ic_runtime_stub-inl.h index c124b677ab51ecaa9f0dc3295bb0eb1381cb7ff4..a1ba8893f67e85b29c68bcf651d7d674e7fde9b5 100644 --- a/runtime/ic/ic_runtime_stub-inl.h +++ b/runtime/ic/ic_runtime_stub-inl.h @@ -244,39 +244,15 @@ JSTaggedValue ICRuntimeStub::StoreICByValue(JSThread *thread, JSFunction *func, } // Check element if (first_value.GetTaggedObject() == hclass) { - JSTaggedValue handler = profile_type_info->Get(slot_id + 1); - auto handler_info = static_cast(handler.GetInt()); - bool was_overflowed = false; - auto res = StoreElement(thread, JSObject::Cast(receiver.GetHeapObject()), key, value, handler_info, - &was_overflowed); - if (!key.IsInt()) { - HandlerBase::SetKeyNotInt(handler_info); - profile_type_info->Set(thread, slot_id + 1, JSTaggedValue(handler_info)); - } - if (was_overflowed) { - HandlerBase::SetArrayOverflowed(handler_info); - profile_type_info->Set(thread, slot_id + 1, JSTaggedValue(handler_info)); - } - return res; + return StoreElement(thread, JSObject::Cast(receiver.GetHeapObject()), key, value, profile_type_info, + slot_id + 1); } size_t index = slot_id + 2; while (index < SlotSizeForICByValue()) { first_value = profile_type_info->Get(index); if (first_value.GetRawData() == ToUintPtr(hclass)) { - JSTaggedValue handler = profile_type_info->Get(index + 1); - auto handler_info = static_cast(handler.GetInt()); - bool was_overflowed = false; - auto res = StoreElement(thread, JSObject::Cast(receiver.GetHeapObject()), key, value, handler_info, - &was_overflowed); - if (!key.IsInt()) { - HandlerBase::SetKeyNotInt(handler_info); - profile_type_info->Set(thread, index + 1, JSTaggedValue(handler_info)); - } - if (was_overflowed) { - HandlerBase::SetArrayOverflowed(handler_info); - profile_type_info->Set(thread, index + 1, JSTaggedValue(handler_info)); - } - return res; + return StoreElement(thread, JSObject::Cast(receiver.GetHeapObject()), key, value, profile_type_info, + index + 1); } index += 2; } @@ -507,10 +483,16 @@ JSTaggedValue ICRuntimeStub::LoadElement(JSObject *receiver, JSTaggedValue key) } JSTaggedValue ICRuntimeStub::StoreElement(JSThread *thread, JSObject *receiver, JSTaggedValue key, JSTaggedValue value, - uint32_t handler_info, bool *was_overflowed) + ProfileTypeInfo *profile_type_info, uint32_t slot_id) { INTERPRETER_TRACE(thread, StoreElement); + JSTaggedValue handler = profile_type_info->Get(slot_id); + auto handler_info = static_cast(handler.GetInt()); ASSERT(HandlerBase::IsElement(handler_info)); + if (!key.IsInt()) { + HandlerBase::SetKeyNotInt(handler_info); + profile_type_info->Set(thread, slot_id, JSTaggedValue(handler_info)); + } auto index = TryToElementsIndex(key); if (index >= JSObject::MAX_ELEMENT_INDEX) { return JSTaggedValue::Hole(); @@ -526,7 +508,8 @@ JSTaggedValue ICRuntimeStub::StoreElement(JSThread *thread, JSObject *receiver, TaggedArray *elements = TaggedArray::Cast(receiver->GetElements().GetHeapObject()); uint32_t capacity = elements->GetLength(); if (element_index >= capacity) { - *was_overflowed = true; + HandlerBase::SetArrayOverflowed(handler_info); + profile_type_info->Set(thread, slot_id, JSTaggedValue(handler_info)); if (JSObject::ShouldTransToDict(capacity, element_index)) { return JSTaggedValue::Hole(); } diff --git a/runtime/ic/ic_runtime_stub.h b/runtime/ic/ic_runtime_stub.h index 94bdfae0e5991aba330263fb0c8b7443040d64e9..99d0de02801efe3ea87c922a51c8f61b5c9c50ca 100644 --- a/runtime/ic/ic_runtime_stub.h +++ b/runtime/ic/ic_runtime_stub.h @@ -77,8 +77,8 @@ public: JSTaggedValue key, JSTaggedValue value, uint32_t slot_id); ARK_INLINE static inline JSTaggedValue LoadElement(JSObject *receiver, JSTaggedValue key); ARK_INLINE static inline JSTaggedValue StoreElement(JSThread *thread, JSObject *receiver, JSTaggedValue key, - JSTaggedValue value, uint32_t handler_info, - bool *was_overflowed); + JSTaggedValue value, ProfileTypeInfo *profile_type_info, + uint32_t slot_id); ARK_INLINE static inline uint32_t TryToElementsIndex(JSTaggedValue key); private: