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

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

Issue 1313313002: Synchronize on concurrent store buffer entries. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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/mark-compact.h ('k') | src/heap/store-buffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index dc93a5a9a746549ce548a478a56b623dc34bc423..738e00b09ceb6fd0a4ae804dbe3b1e27aef125c0 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -47,6 +47,7 @@ MarkCompactCollector::MarkCompactCollector(Heap* heap)
compacting_(false),
was_marked_incrementally_(false),
sweeping_in_progress_(false),
+ parallel_compaction_in_progress_(false),
pending_sweeper_jobs_semaphore_(0),
pending_compaction_jobs_semaphore_(0),
evacuation_(false),
@@ -2690,7 +2691,11 @@ void MarkCompactCollector::AbortWeakCells() {
void MarkCompactCollector::RecordMigratedSlot(Object* value, Address slot) {
if (heap_->InNewSpace(value)) {
- heap_->store_buffer()->Mark(slot);
+ if (parallel_compaction_in_progress_) {
+ heap_->store_buffer()->MarkSynchronized(slot);
+ } else {
+ heap_->store_buffer()->Mark(slot);
+ }
} else if (value->IsHeapObject() && IsOnEvacuationCandidate(value)) {
SlotsBuffer::AddTo(&slots_buffer_allocator_, &migration_slots_buffer_,
reinterpret_cast<Object**>(slot),
@@ -3313,11 +3318,18 @@ void MarkCompactCollector::EvacuateLiveObjectsFromPage(Page* p) {
void MarkCompactCollector::EvacuatePagesInParallel() {
+ parallel_compaction_in_progress_ = true;
V8::GetCurrentPlatform()->CallOnBackgroundThread(
new CompactionTask(heap()), v8::Platform::kShortRunningTask);
}
+void MarkCompactCollector::WaitUntilCompactionCompleted() {
+ pending_compaction_jobs_semaphore_.Wait();
+ parallel_compaction_in_progress_ = false;
+}
+
+
void MarkCompactCollector::EvacuatePages() {
int npages = evacuation_candidates_.length();
int abandoned_pages = 0;
@@ -3626,7 +3638,7 @@ void MarkCompactCollector::EvacuateNewSpaceAndCandidates() {
EvacuationScope evacuation_scope(this);
if (FLAG_parallel_compaction) {
EvacuatePagesInParallel();
- pending_compaction_jobs_semaphore_.Wait();
+ WaitUntilCompactionCompleted();
} else {
EvacuatePages();
}
« no previous file with comments | « src/heap/mark-compact.h ('k') | src/heap/store-buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698