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

Unified Diff: src/heap/spaces.h

Issue 1244353002: Use a lock in pages to synchronize sweeper threads to allow others to wait on concurrently swept pa… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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.cc ('k') | src/heap/spaces.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/spaces.h
diff --git a/src/heap/spaces.h b/src/heap/spaces.h
index 3461de3ef009f18d9549a8de8f18ce831ba2f572..ca4fe9526b9c4f74292dcb7d898d15896e03aaa3 100644
--- a/src/heap/spaces.h
+++ b/src/heap/spaces.h
@@ -452,10 +452,14 @@ class MemoryChunk {
base::Release_Store(&parallel_sweeping_, state);
}
- bool TryParallelSweeping() {
- return base::Acquire_CompareAndSwap(&parallel_sweeping_, SWEEPING_PENDING,
- SWEEPING_IN_PROGRESS) ==
- SWEEPING_PENDING;
+ bool TryLock() { return mutex_->TryLock(); }
+
+ base::Mutex* mutex() { return mutex_; }
+
+ void WaitUntilSweepingCompleted() {
+ mutex_->Lock();
+ mutex_->Unlock();
+ DCHECK(SweepingCompleted());
}
bool SweepingCompleted() { return parallel_sweeping() <= SWEEPING_FINALIZE; }
@@ -537,9 +541,10 @@ class MemoryChunk {
static const size_t kWriteBarrierCounterOffset =
kSlotsBufferOffset + kPointerSize + kPointerSize;
- static const size_t kHeaderSize =
- kWriteBarrierCounterOffset + kPointerSize + kIntSize + kIntSize +
- kPointerSize + 5 * kPointerSize + kPointerSize + kPointerSize;
+ static const size_t kHeaderSize = kWriteBarrierCounterOffset + kPointerSize +
+ kIntSize + kIntSize + kPointerSize +
+ 5 * kPointerSize + kPointerSize +
+ kPointerSize + kPointerSize;
Michael Lippautz 2015/07/22 13:17:01 Can we make this more verbose by adding a comment?
Hannes Payer (out of office) 2015/07/22 13:29:25 Done.
static const int kBodyOffset =
CODE_POINTER_ALIGN(kHeaderSize + Bitmap::kSize);
@@ -675,6 +680,7 @@ class MemoryChunk {
// count highest number of bytes ever allocated on the page.
int high_water_mark_;
+ base::Mutex* mutex_;
base::AtomicWord parallel_sweeping_;
// PagedSpace free-list statistics.
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/heap/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698