Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Unified Diff: src/heap/spaces.cc

Issue 2445283003: Reland "[heap] Start sweeper tasks after evacuation" (second try). (Closed)
Patch Set: bugfix Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/spaces.h ('k') | test/cctest/heap/heap-tester.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/spaces.cc
diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
index 3a794a8c6b4417ad4c7faa5b14d3d0510634d3d3..26b29afaeb9816397ad37fb26b671960e6510b72 100644
--- a/src/heap/spaces.cc
+++ b/src/heap/spaces.cc
@@ -395,11 +395,12 @@ void MemoryAllocator::Unmapper::ReconsiderDelayedChunks() {
bool MemoryAllocator::CanFreeMemoryChunk(MemoryChunk* chunk) {
MarkCompactCollector* mc = isolate_->heap()->mark_compact_collector();
- // We cannot free memory chunks in new space while the sweeper is running
- // since a sweeper thread might be stuck right before trying to lock the
- // corresponding page.
- return !chunk->InNewSpace() || (mc == nullptr) || !FLAG_concurrent_sweeping ||
- mc->sweeper().IsSweepingCompleted();
+ // We cannot free a memory chunk in new space while the sweeper is running
+ // because the memory chunk can be in the queue of a sweeper task.
+ // Chunks in old generation are unmapped if they are empty.
+ DCHECK(chunk->InNewSpace() || chunk->SweepingDone());
+ return !chunk->InNewSpace() || mc == nullptr || !FLAG_concurrent_sweeping ||
+ mc->sweeper().IsSweepingCompleted(NEW_SPACE);
}
bool MemoryAllocator::CommitMemory(Address base, size_t size,
« no previous file with comments | « src/heap/spaces.h ('k') | test/cctest/heap/heap-tester.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698