@@ -1991,40 +1991,8 @@ Address Heap::DoScavenge(ObjectVisitor* scavenge_visitor,
19911991 // for pointers to from semispace instead of looking for pointers
19921992 // to new space.
19931993 DCHECK (!target->IsMap ());
1994- Address obj_address = target->address ();
1995-
1996- // We are not collecting slots on new space objects during mutation
1997- // thus we have to scan for pointers to evacuation candidates when we
1998- // promote objects. But we should not record any slots in non-black
1999- // objects. Grey object's slots would be rescanned.
2000- // White object might not survive until the end of collection
2001- // it would be a violation of the invariant to record it's slots.
2002- bool record_slots = false ;
2003- if (incremental_marking ()->IsCompacting ()) {
2004- MarkBit mark_bit = Marking::MarkBitFrom (target);
2005- record_slots = Marking::IsBlack (mark_bit);
2006- }
2007- #if V8_DOUBLE_FIELDS_UNBOXING
2008- LayoutDescriptorHelper helper (target->map ());
2009- bool has_only_tagged_fields = helper.all_fields_tagged ();
2010-
2011- if (!has_only_tagged_fields) {
2012- for (int offset = 0 ; offset < size;) {
2013- int end_of_region_offset;
2014- if (helper.IsTagged (offset, size, &end_of_region_offset)) {
2015- IterateAndMarkPointersToFromSpace (
2016- record_slots, obj_address + offset,
2017- obj_address + end_of_region_offset, &ScavengeObject);
2018- }
2019- offset = end_of_region_offset;
2020- }
2021- } else {
2022- #endif
2023- IterateAndMarkPointersToFromSpace (
2024- record_slots, obj_address, obj_address + size, &ScavengeObject);
2025- #if V8_DOUBLE_FIELDS_UNBOXING
2026- }
2027- #endif
1994+
1995+ IteratePointersToFromSpace (target, size, &ScavengeObject);
20281996 }
20291997 }
20301998
@@ -5058,6 +5026,67 @@ void Heap::IterateAndMarkPointersToFromSpace(bool record_slots, Address start,
50585026}
50595027
50605028
5029+ void Heap::IteratePointersToFromSpace (HeapObject* target, int size,
5030+ ObjectSlotCallback callback) {
5031+ Address obj_address = target->address ();
5032+
5033+ // We are not collecting slots on new space objects during mutation
5034+ // thus we have to scan for pointers to evacuation candidates when we
5035+ // promote objects. But we should not record any slots in non-black
5036+ // objects. Grey object's slots would be rescanned.
5037+ // White object might not survive until the end of collection
5038+ // it would be a violation of the invariant to record it's slots.
5039+ bool record_slots = false ;
5040+ if (incremental_marking ()->IsCompacting ()) {
5041+ MarkBit mark_bit = Marking::MarkBitFrom (target);
5042+ record_slots = Marking::IsBlack (mark_bit);
5043+ }
5044+
5045+ // Do not scavenge JSArrayBuffer's contents
5046+ switch (target->ContentType ()) {
5047+ case HeapObjectContents::kTaggedValues : {
5048+ IterateAndMarkPointersToFromSpace (record_slots, obj_address,
5049+ obj_address + size, callback);
5050+ break ;
5051+ }
5052+ case HeapObjectContents::kMixedValues : {
5053+ if (target->IsFixedTypedArrayBase ()) {
5054+ IterateAndMarkPointersToFromSpace (
5055+ record_slots, obj_address + FixedTypedArrayBase::kBasePointerOffset ,
5056+ obj_address + FixedTypedArrayBase::kHeaderSize , callback);
5057+ } else if (target->IsJSArrayBuffer ()) {
5058+ IterateAndMarkPointersToFromSpace (
5059+ record_slots, obj_address,
5060+ obj_address + JSArrayBuffer::kByteLengthOffset + kPointerSize ,
5061+ callback);
5062+ IterateAndMarkPointersToFromSpace (
5063+ record_slots, obj_address + JSArrayBuffer::kSize ,
5064+ obj_address + size, callback);
5065+ #if V8_DOUBLE_FIELDS_UNBOXING
5066+ } else if (FLAG_unbox_double_fields) {
5067+ LayoutDescriptorHelper helper (target->map ());
5068+ DCHECK (!helper.all_fields_tagged ());
5069+
5070+ for (int offset = 0 ; offset < size;) {
5071+ int end_of_region_offset;
5072+ if (helper.IsTagged (offset, size, &end_of_region_offset)) {
5073+ IterateAndMarkPointersToFromSpace (
5074+ record_slots, obj_address + offset,
5075+ obj_address + end_of_region_offset, callback);
5076+ }
5077+ offset = end_of_region_offset;
5078+ }
5079+ #endif
5080+ }
5081+ break ;
5082+ }
5083+ case HeapObjectContents::kRawValues : {
5084+ break ;
5085+ }
5086+ }
5087+ }
5088+
5089+
50615090void Heap::IterateRoots (ObjectVisitor* v, VisitMode mode) {
50625091 IterateStrongRoots (v, mode);
50635092 IterateWeakRoots (v, mode);
0 commit comments