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

Unified Diff: src/heap/mark-compact.cc

Issue 1382003002: [heap] Divide available memory upon compaction tasks (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@counters
Patch Set: Addressed first round of comments Created 5 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
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index e26653495ecf2ae7ff6bb9211798212dec8cbc1b..6fe7c4de8a38be2a7d1205916c41b680320ea4c0 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -608,6 +608,27 @@ void MarkCompactCollector::RefillFreeList(PagedSpace* space) {
}
+void MarkCompactCollector::RefillFreeList(CompactionSpace* space) {
+ FreeList* free_list = nullptr;
+ if (space->identity() == OLD_SPACE) {
+ free_list = free_list_old_space_.get();
+ } else if (space->identity() == CODE_SPACE) {
+ free_list = free_list_code_space_.get();
+ } else {
+ UNREACHABLE();
+ }
+
+ intptr_t refilled = 0;
+ while (refilled < kCompactionSpaceMemoryWanted) {
+ FreeSpace* node =
+ free_list->TryRemoveMemory(kCompactionSpaceMemoryWanted - refilled);
+ if (node == nullptr) return;
+ refilled += node->size();
+ space->AddMemory(node->address(), node->size());
+ }
+}
+
+
void Marking::TransferMark(Heap* heap, Address old_start, Address new_start) {
// This is only used when resizing an object.
DCHECK(MemoryChunk::FromAddress(old_start) ==
@@ -3397,11 +3418,10 @@ void MarkCompactCollector::EvacuatePagesInParallel() {
compaction_spaces_for_tasks[i] = new CompactionSpaceCollection(heap());
}
- compaction_spaces_for_tasks[0]->Get(OLD_SPACE)->MoveOverFreeMemory(
- heap()->old_space());
- compaction_spaces_for_tasks[0]
- ->Get(CODE_SPACE)
- ->MoveOverFreeMemory(heap()->code_space());
+ heap()->old_space()->DivideUponCompactionSpaces(
+ compaction_spaces_for_tasks, num_tasks, kCompactionSpaceMemoryWanted);
+ heap()->code_space()->DivideUponCompactionSpaces(
+ compaction_spaces_for_tasks, num_tasks, kCompactionSpaceMemoryWanted);
compaction_in_progress_ = true;
// Kick off parallel tasks.
@@ -3413,9 +3433,7 @@ void MarkCompactCollector::EvacuatePagesInParallel() {
}
// Contribute in main thread. Counter and signal are in principal not needed.
- concurrent_compaction_tasks_active_++;
EvacuatePages(compaction_spaces_for_tasks[0], &migration_slots_buffer_);
- pending_compaction_tasks_semaphore_.Signal();
WaitUntilCompactionCompleted();
« no previous file with comments | « src/heap/mark-compact.h ('k') | src/heap/spaces.h » ('j') | src/heap/spaces.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698