diff --git a/runtime/mem/ecma_reference_processor.cpp b/runtime/mem/ecma_reference_processor.cpp index bfc978f0b2f81e6158d307b9170625cd5ad8db05..8762f45d4dd945ac3dc9f193dc7cacc019d7dd6b 100644 --- a/runtime/mem/ecma_reference_processor.cpp +++ b/runtime/mem/ecma_reference_processor.cpp @@ -82,8 +82,14 @@ bool EcmaReferenceProcessor::IsReference([[maybe_unused]] const BaseClass *base_ auto object_type = hcls->GetObjectType(); switch (object_type) { case panda::ecmascript::JSType::TAGGED_ARRAY: - return EnumerateArrayElements(static_cast(ref), - is_reference_checker); + // Weak tagged array is used for inline caches. + // It is reasonable to collect IC only in OOM case else it leads + // to big perf degradation. + if (gc_->GetLastGCCause() == GCTaskCause::OOM_CAUSE) { + return EnumerateArrayElements(static_cast(ref), + is_reference_checker); + } + break; case panda::ecmascript::JSType::JS_WEAK_REF: { panda::ecmascript::JSTaggedValue referent = static_cast(ref)->GetReferent(); diff --git a/runtime/object_factory.cpp b/runtime/object_factory.cpp index 9b64ef0a2dac1b8ee6cb5ab0b250956158750566..88353d282cd656a19e19e9bd17f087b3461a2282 100644 --- a/runtime/object_factory.cpp +++ b/runtime/object_factory.cpp @@ -1915,7 +1915,7 @@ JSHandle ObjectFactory::NewProfileTypeInfo(uint32_t length) ASSERT(length > 0); size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), length); - auto header = heapHelper_.AllocateNonMovableOrHugeObject(arrayClass_, size); + auto header = heapHelper_.AllocateNonMovableOrHugeObject(weakArrayClass_, size); JSHandle array(thread_, header); array->InitializeWithSpecialValue(JSTaggedValue::Undefined(), length);