From 4793ec3b7ed22bef96d6bbe8d6ff2c3d6c68a5e6 Mon Sep 17 00:00:00 2001 From: "hpayer@chromium.org" Date: Wed, 2 Jul 2014 12:19:03 +0000 Subject: [PATCH] Precisely sweep scan on scavenge pages and use heap iterator to iterate over them. BUG= R=jarin@chromium.org Review URL: https://codereview.chromium.org/362313002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22154 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/mark-compact.cc | 21 ++++++++++++++++----- src/store-buffer.cc | 17 +++++++++++++++-- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/src/mark-compact.cc b/src/mark-compact.cc index 191b94bfe6..d3dbaef82a 100644 --- a/src/mark-compact.cc +++ b/src/mark-compact.cc @@ -4146,12 +4146,23 @@ void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) { pages_swept++; parallel_sweeping_active = true; } else { - if (FLAG_gc_verbose) { - PrintF("Sweeping 0x%" V8PRIxPTR " conservatively in parallel.\n", - reinterpret_cast(p)); + if (p->scan_on_scavenge()) { + SweepPrecisely( + space, p, NULL); + pages_swept++; + if (FLAG_gc_verbose) { + PrintF("Sweeping 0x%" V8PRIxPTR + " scan on scavenge page precisely.\n", + reinterpret_cast(p)); + } + } else { + if (FLAG_gc_verbose) { + PrintF("Sweeping 0x%" V8PRIxPTR " conservatively in parallel.\n", + reinterpret_cast(p)); + } + p->set_parallel_sweeping(MemoryChunk::PARALLEL_SWEEPING_PENDING); + space->IncreaseUnsweptFreeBytes(p); } - p->set_parallel_sweeping(MemoryChunk::PARALLEL_SWEEPING_PENDING); - space->IncreaseUnsweptFreeBytes(p); } space->set_end_of_unswept_pages(p); break; diff --git a/src/store-buffer.cc b/src/store-buffer.cc index 4ab5c33c8c..e4cef27b4a 100644 --- a/src/store-buffer.cc +++ b/src/store-buffer.cc @@ -552,8 +552,21 @@ void StoreBuffer::IteratePointersToNewSpace(ObjectSlotCallback slot_callback, FindPointersToNewSpaceInMapsRegion( start, end, slot_callback, clear_maps); } else { - FindPointersToNewSpaceInRegion( - start, end, slot_callback, clear_maps); + ASSERT(page->WasSweptPrecisely()); + HeapObjectIterator iterator(page, NULL); + for (HeapObject* heap_object = iterator.Next(); + heap_object != NULL; + heap_object = iterator.Next()) { + // We skip filler, free space, and constant pool objects. + if (!heap_object->IsFiller() && + !heap_object->IsConstantPoolArray()) { + FindPointersToNewSpaceInRegion( + heap_object->address() + HeapObject::kHeaderSize, + heap_object->address() + heap_object->Size(), + slot_callback, + clear_maps); + } + } } } }