Reviewers: Hannes Payer,

Description:
Don't UnshiftGrey any black objects

[email protected]
BUG=

Please review this at https://codereview.chromium.org/1128683006/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+20, -1 lines):
  M src/heap/incremental-marking.cc
  M src/heap/mark-compact.h


Index: src/heap/incremental-marking.cc
diff --git a/src/heap/incremental-marking.cc b/src/heap/incremental-marking.cc index 95f522bd991fe83fadb9baa8445fd7768b736f6f..2184c72d31a3b091a11d5336d413662d9e897b60 100644
--- a/src/heap/incremental-marking.cc
+++ b/src/heap/incremental-marking.cc
@@ -188,7 +188,12 @@ class IncrementalMarkingMarkingVisitor
       } while (scan_until_end && start_offset < object_size);
       chunk->set_progress_bar(start_offset);
       if (start_offset < object_size) {
- heap->mark_compact_collector()->marking_deque()->UnshiftGrey(object);
+        if (Marking::IsGrey(Marking::MarkBitFrom(object))) {
+ heap->mark_compact_collector()->marking_deque()->UnshiftGrey(object);
+        } else {
+          DCHECK(Marking::IsBlack(Marking::MarkBitFrom(object)));
+ heap->mark_compact_collector()->marking_deque()->UnshiftBlack(object);
+        }
         heap->incremental_marking()->NotifyIncompleteScanOfObject(
             object_size - (start_offset - already_scanned_offset));
       }
Index: src/heap/mark-compact.h
diff --git a/src/heap/mark-compact.h b/src/heap/mark-compact.h
index 322965decdd4e6d57a403f152c85ab8a07c26c16..e8f5c63fe3925a9dcbe3197cf5f31af52b332845 100644
--- a/src/heap/mark-compact.h
+++ b/src/heap/mark-compact.h
@@ -244,6 +244,7 @@ class MarkingDeque {

   INLINE(void UnshiftGrey(HeapObject* object)) {
     DCHECK(object->IsHeapObject());
+    DCHECK(Marking::IsGrey(Marking::MarkBitFrom(object)));
     if (IsFull()) {
       SetOverflowed();
     } else {
@@ -252,6 +253,19 @@ class MarkingDeque {
     }
   }

+  INLINE(void UnshiftBlack(HeapObject* object)) {
+    DCHECK(object->IsHeapObject());
+    DCHECK(Marking::IsBlack(Marking::MarkBitFrom(object)));
+    if (IsFull()) {
+      Marking::BlackToGrey(object);
+ MemoryChunk::IncrementLiveBytesFromGC(object->address(), -object->Size());
+      SetOverflowed();
+    } else {
+      bottom_ = ((bottom_ - 1) & mask_);
+      array_[bottom_] = object;
+    }
+  }
+
   HeapObject** array() { return array_; }
   int bottom() { return bottom_; }
   int top() { return top_; }


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to