[heap] Clear from space after garbage collection.

Bug: chromium:829771
Change-Id: I9e71e6cbba347dd6951e5415332e5178df9b5122
Reviewed-on: https://chromium-review.googlesource.com/1041685
Commit-Queue: Hannes Payer <hpayer@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52957}
This commit is contained in:
Hannes Payer 2018-05-03 10:25:12 +02:00 committed by Commit Bot
parent d78d026d08
commit 494068c1c2

View File

@ -920,10 +920,7 @@ void Heap::DeoptMarkedAllocationSites() {
void Heap::GarbageCollectionEpilogue() {
TRACE_GC(tracer(), GCTracer::Scope::HEAP_EPILOGUE);
// In release mode, we only zap the from space under heap verification.
if (Heap::ShouldZapGarbage()) {
ZapFromSpace();
}
ZapFromSpace();
#ifdef VERIFY_HEAP
if (FLAG_verify_heap) {
@ -3844,12 +3841,13 @@ void Heap::VerifyCountersBeforeConcurrentSweeping() {
void Heap::ZapFromSpace() {
if (!new_space_->IsFromSpaceCommitted()) return;
for (Page* page :
PageRange(new_space_->FromSpaceStart(), new_space_->FromSpaceEnd())) {
for (Address cursor = page->area_start(), limit = page->area_end();
cursor < limit; cursor += kPointerSize) {
Memory::Address_at(cursor) = static_cast<Address>(kFromSpaceZapValue);
}
memory_allocator()->ZapBlock(page->area_start(), page->area_size(),
Heap::ShouldZapGarbage()
? kFromSpaceZapValue
: kClearedFreeMemoryValue);
}
}