Index: src/heap/mark-compact.h |
diff --git a/src/heap/mark-compact.h b/src/heap/mark-compact.h |
index d6adb038ea95764286f3a24bcdfb3003050ec7ec..c9e867e1f4eac39e1cfd6c959c6ab3ffdc8956e8 100644 |
--- a/src/heap/mark-compact.h |
+++ b/src/heap/mark-compact.h |
@@ -157,17 +157,24 @@ class Marking : public AllStatic { |
} |
#endif |
- // Returns true if the transferred color is black. |
+ // Returns true if the transferred color is black. Clears the color of the |
+ // from object. |
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; |
} |
} |