diff --git a/ecmascript/mem/dynamic_object_operator.cpp b/ecmascript/mem/dynamic_object_operator.cpp index eb33a7fbc35c8fa2a260f4178b344c920135dd3a..6dce31e1e19b0f423a63ebf879f6e79efc45776c 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 b4cf6ada23b42b664fa03860bb8ac5c589f9d0c5..ee374be6f1bf50e92c0cc9c3d0442e7268fcc823 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: