Chromium Code Reviews| Index: src/heap/mark-compact-inl.h |
| diff --git a/src/heap/mark-compact-inl.h b/src/heap/mark-compact-inl.h |
| index 0c4c57d6488b1aeea462c491d54ea8d14031dbf9..9df79746ee64a12eea471412115f5bf70303303b 100644 |
| --- a/src/heap/mark-compact-inl.h |
| +++ b/src/heap/mark-compact-inl.h |
| @@ -143,10 +143,21 @@ template <LiveObjectIterationMode T> |
| HeapObject* LiveObjectIterator<T>::Next() { |
| while (!it_.Done()) { |
| HeapObject* object = nullptr; |
| + if (T == kGreyObjectsOnBlackPage) { |
|
Hannes Payer (out of office)
2016/03/11 15:49:36
We need that when we transition from black to grey
|
| + // Black objects will have most of the mark bits set to 1. If we invert |
| + // the mark bits, grey objects will be left but the mark bit is moved by |
| + // one position. We can just substract one word from the found location |
| + // to obtain the grey object. |
| + current_cell_ = ~current_cell_; |
| + } |
| while (current_cell_ != 0) { |
| uint32_t trailing_zeros = base::bits::CountTrailingZeros32(current_cell_); |
| Address addr = cell_base_ + trailing_zeros * kPointerSize; |
| + if (T == kGreyObjectsOnBlackPage) { |
| + addr -= kPointerSize; |
| + } |
| + |
| // Clear the first bit of the found object.. |
| current_cell_ &= ~(1u << trailing_zeros); |
| @@ -168,6 +179,8 @@ HeapObject* LiveObjectIterator<T>::Next() { |
| object = HeapObject::FromAddress(addr); |
| } else if (T == kAllLiveObjects) { |
| object = HeapObject::FromAddress(addr); |
| + } else if (T == kGreyObjectsOnBlackPage) { |
| + object = HeapObject::FromAddress(addr); |
| } |
| // Clear the second bit of the found object. |
| current_cell_ &= ~second_bit_index; |