From e5965e83267b4648a632fbd72a32b66616428775 Mon Sep 17 00:00:00 2001 From: duomingliang Date: Sat, 30 Aug 2025 10:15:41 +0800 Subject: [PATCH] fastpath for VisitObjectBody of cmc Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/ICVJ7R Description: fastpath for VisitObjectBody of cmc Signed-off-by: duomingliang Change-Id: I118634aaebb126255bed7c3616548c45bc947268 --- ecmascript/mem/dynamic_object_operator.cpp | 2 +- ecmascript/mem/object_xray.h | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ecmascript/mem/dynamic_object_operator.cpp b/ecmascript/mem/dynamic_object_operator.cpp index eb33a7fbc3..6dce31e1e1 100644 --- a/ecmascript/mem/dynamic_object_operator.cpp +++ b/ecmascript/mem/dynamic_object_operator.cpp @@ -55,7 +55,7 @@ void RefFieldObjectVisitor::VisitAllRefFields(TaggedObject *obj) // Note this will update the stack param, not the slot of object hclass // But sinc hclass in non-movable, so current all visitor will not update hlass field, so it's ok VisitObjectHClassImpl(obj->GetClass()); - ObjectXRay::VisitObjectBody(obj, obj->GetClass(), *this); + ObjectXRay::VisitObjectBody(obj, obj->GetClass(), *this); } void RefFieldObjectVisitor::visit(ObjectSlot slot) diff --git a/ecmascript/mem/object_xray.h b/ecmascript/mem/object_xray.h index b4cf6ada23..ee374be6f1 100644 --- a/ecmascript/mem/object_xray.h +++ b/ecmascript/mem/object_xray.h @@ -157,12 +157,19 @@ public: vm->GetJSThread()->IterateJitCodeMap(updater); } - template + template static inline void VisitObjectBody(TaggedObject *object, JSHClass *klass, BaseObjectVisitor &visitor) { // handle body JSType type = klass->GetObjectType(); + if constexpr (isCMCGC) { + // fastpath for cmcgc + if (type == JSType::JS_TYPED_ARRAY) { + JSTypedArray::Cast(object)->VisitRangeSlot(visitor); + return; + } + } switch (type) { case JSType::JS_OBJECT: case JSType::JS_XREF_OBJECT: -- Gitee