Index: src/spaces.h |
=================================================================== |
--- src/spaces.h (revision 12610) |
+++ src/spaces.h (working copy) |
@@ -393,6 +393,15 @@ |
WAS_SWEPT_PRECISELY, |
WAS_SWEPT_CONSERVATIVELY, |
+ // Used for large objects only. Indicates that the object has been |
+ // partially scanned by the incremental mark-sweep GC. Objects that have |
+ // been partially scanned are marked black so that the write barrier |
+ // triggers for them, and they are counted as live bytes. If the mutator |
+ // writes to them they may be turned grey and subtracted from the live byte |
+ // list. They move back to the marking deque either by an iteration over |
+ // the large object space or in the write barrier. |
+ IS_PARTIALLY_SCANNED, |
+ |
// Last flag, keep at bottom. |
NUM_MEMORY_CHUNK_FLAGS |
}; |
@@ -413,7 +422,26 @@ |
(1 << IN_FROM_SPACE) | |
(1 << IN_TO_SPACE); |
+ static const int kIsPartiallyScannedMask = 1 << IS_PARTIALLY_SCANNED; |
+ void SetPartiallyScannedProgress(int progress) { |
+ SetFlag(IS_PARTIALLY_SCANNED); |
+ partially_scanned_progress_ = progress; |
+ } |
+ |
+ bool IsPartiallyScanned() { |
+ return IsFlagSet(IS_PARTIALLY_SCANNED); |
+ } |
+ |
+ void SetCompletelyScanned() { |
+ ClearFlag(IS_PARTIALLY_SCANNED); |
+ } |
+ |
+ int PartiallyScannedProgress() { |
+ ASSERT(IsPartiallyScanned()); |
+ return partially_scanned_progress_; |
+ } |
+ |
void SetFlag(int flag) { |
flags_ |= static_cast<uintptr_t>(1) << flag; |
} |
@@ -488,9 +516,15 @@ |
static const size_t kSlotsBufferOffset = kLiveBytesOffset + kIntSize; |
- static const size_t kHeaderSize = |
- kSlotsBufferOffset + kPointerSize + kPointerSize; |
+ static const size_t kPartiallyScannedProgress = |
+ kSlotsBufferOffset + kPointerSize + kPointerSize; |
+ // Actually the partially_scanned_progress_ member is only an int, but on |
+ // 64 bit the size of MemoryChunk gets rounded up to a 64 bit size so we |
+ // have to have the header start kPointerSize after the |
+ // partially_scanned_progress_ member. |
+ static const size_t kHeaderSize = kPartiallyScannedProgress + kPointerSize; |
+ |
static const int kBodyOffset = |
CODE_POINTER_ALIGN(MAP_POINTER_ALIGN(kHeaderSize + Bitmap::kSize)); |
@@ -625,6 +659,7 @@ |
int live_byte_count_; |
SlotsBuffer* slots_buffer_; |
SkipList* skip_list_; |
+ int partially_scanned_progress_; |
static MemoryChunk* Initialize(Heap* heap, |
Address base, |