Chromium Code Reviews| Index: src/heap/mark-compact.h |
| diff --git a/src/heap/mark-compact.h b/src/heap/mark-compact.h |
| index d6f10e601326f92dbf716735b1a69fc8e9a5eea9..aa3df2de77529a59beac81a2ec0d711b39893471 100644 |
| --- a/src/heap/mark-compact.h |
| +++ b/src/heap/mark-compact.h |
| @@ -159,15 +159,21 @@ class Marking : public AllStatic { |
| // Returns true if the transferred color is black. |
|
Hannes Payer (out of office)
2016/05/20 07:34:41
Mention that this function clears the color of the
Marcel Hlopko
2016/05/20 14:31:41
Done.
|
| INLINE(static bool TransferColor(HeapObject* from, HeapObject* to)) { |
| - if (Page::FromAddress(to->address())->IsFlagSet(Page::BLACK_PAGE)) |
| - return true; |
| MarkBit from_mark_bit = MarkBitFrom(from); |
| + if (Page::FromAddress(to->address())->IsFlagSet(Page::BLACK_PAGE)) { |
| + if (!Marking::IsWhite(from_mark_bit)) { |
| + Marking::MarkWhite(from_mark_bit); |
| + } |
| + return true; |
| + } |
| MarkBit to_mark_bit = MarkBitFrom(to); |
| DCHECK(Marking::IsWhite(to_mark_bit)); |
| if (from_mark_bit.Get()) { |
| to_mark_bit.Set(); |
| + from_mark_bit.Clear(); |
| if (from_mark_bit.Next().Get()) { |
| to_mark_bit.Next().Set(); |
| + from_mark_bit.Next().Clear(); |
| return true; |
| } |
| } |