Commit 5d159d50 authored by hpayer@chromium.org's avatar hpayer@chromium.org

Execute a memory barrier when adding a new page to a space to synchronize...

Execute a memory barrier when adding a new page to a space to synchronize access with concurrent sweepers.

BUG=

Review URL: https://codereview.chromium.org/12342017

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13941 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 05a71fc9
...@@ -537,6 +537,17 @@ bool MemoryChunk::CommitArea(size_t requested) { ...@@ -537,6 +537,17 @@ bool MemoryChunk::CommitArea(size_t requested) {
void MemoryChunk::InsertAfter(MemoryChunk* other) { void MemoryChunk::InsertAfter(MemoryChunk* other) {
next_chunk_ = other->next_chunk_; next_chunk_ = other->next_chunk_;
prev_chunk_ = other; prev_chunk_ = other;
// This memory barrier is needed since concurrent sweeper threads may iterate
// over the list of pages while a new page is inserted.
// TODO(hpayer): find a cleaner way to guarantee that the page list can be
// expanded concurrently
MemoryBarrier();
// The following two write operations can take effect in arbitrary order
// since pages are always iterated by the sweeper threads in LIFO order, i.e,
// the inserted page becomes visible for the sweeper threads after
// other->next_chunk_ = this;
other->next_chunk_->prev_chunk_ = this; other->next_chunk_->prev_chunk_ = this;
other->next_chunk_ = this; other->next_chunk_ = this;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment