@@ -133,6 +133,52 @@ class ConcurrentMarkingVisitor final
133133 return 0 ;
134134 }
135135
136+ // ===========================================================================
137+ // Strings with pointers =====================================================
138+ // ===========================================================================
139+
140+ int VisitConsString (Map* map, ConsString* object) {
141+ int size = ConsString::BodyDescriptor::SizeOf (map, object);
142+ const SlotSnapshot& snapshot = MakeSlotSnapshot (map, object, size);
143+ if (!ShouldVisit (object)) return 0 ;
144+ VisitPointersInSnapshot (object, snapshot);
145+ return size;
146+ }
147+
148+ int VisitSlicedString (Map* map, SlicedString* object) {
149+ int size = SlicedString::BodyDescriptor::SizeOf (map, object);
150+ const SlotSnapshot& snapshot = MakeSlotSnapshot (map, object, size);
151+ if (!ShouldVisit (object)) return 0 ;
152+ VisitPointersInSnapshot (object, snapshot);
153+ return size;
154+ }
155+
156+ int VisitThinString (Map* map, ThinString* object) {
157+ int size = ThinString::BodyDescriptor::SizeOf (map, object);
158+ const SlotSnapshot& snapshot = MakeSlotSnapshot (map, object, size);
159+ if (!ShouldVisit (object)) return 0 ;
160+ VisitPointersInSnapshot (object, snapshot);
161+ return size;
162+ }
163+
164+ // ===========================================================================
165+ // Strings without pointers ==================================================
166+ // ===========================================================================
167+
168+ int VisitSeqOneByteString (Map* map, SeqOneByteString* object) {
169+ int size = SeqOneByteString::SizeFor (object->synchronized_length ());
170+ if (!ShouldVisit (object)) return 0 ;
171+ VisitMapPointer (object, object->map_slot ());
172+ return size;
173+ }
174+
175+ int VisitSeqTwoByteString (Map* map, SeqTwoByteString* object) {
176+ int size = SeqTwoByteString::SizeFor (object->synchronized_length ());
177+ if (!ShouldVisit (object)) return 0 ;
178+ VisitMapPointer (object, object->map_slot ());
179+ return size;
180+ }
181+
136182 // ===========================================================================
137183 // Fixed array object ========================================================
138184 // ===========================================================================
@@ -284,13 +330,14 @@ class ConcurrentMarkingVisitor final
284330 SlotSnapshot* slot_snapshot_;
285331 };
286332
287- const SlotSnapshot& MakeSlotSnapshot (Map* map, HeapObject* object, int size) {
333+ template <typename T>
334+ const SlotSnapshot& MakeSlotSnapshot (Map* map, T* object, int size) {
288335 // TODO(ulan): Iterate only the existing fields and skip slack at the end
289336 // of the object.
290337 SlotSnapshottingVisitor visitor (&slot_snapshot_);
291338 visitor.VisitPointer (object,
292339 reinterpret_cast <Object**>(object->map_slot ()));
293- JSObject ::BodyDescriptor::IterateBody (object, size, &visitor);
340+ T ::BodyDescriptor::IterateBody (object, size, &visitor);
294341 return slot_snapshot_;
295342 }
296343 ConcurrentMarking::MarkingWorklist::View shared_;
0 commit comments