Commit 25ecc45f authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[heap] Remove --write-protect-code-memory feature flag.

R=hpayer@chromium.org
BUG=v8:6792

Change-Id: Id3413994de603dac1b7501c6fe376cdac1f9d7ce
Reviewed-on: https://chromium-review.googlesource.com/866851
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50759}
parent d414d80d
......@@ -278,7 +278,6 @@ DEFINE_BOOL(future, FUTURE_BOOL,
"not-too-far future")
DEFINE_IMPLICATION(future, background_compile)
DEFINE_IMPLICATION(future, write_protect_code_memory)
// Flags for experimental implementation features.
DEFINE_BOOL(allocation_site_pretenuring, true,
......@@ -640,7 +639,6 @@ DEFINE_BOOL(incremental_marking_wrappers, true,
"use incremental marking for marking wrappers")
DEFINE_BOOL(parallel_scavenge, true, "parallel scavenge")
DEFINE_BOOL(trace_parallel_scavenge, false, "trace parallel scavenge")
DEFINE_BOOL(write_protect_code_memory, true, "write protect code memory")
#ifdef V8_CONCURRENT_MARKING
#define V8_CONCURRENT_MARKING_BOOL true
#else
......
......@@ -620,40 +620,35 @@ AlwaysAllocateScope::~AlwaysAllocateScope() {
CodeSpaceMemoryModificationScope::CodeSpaceMemoryModificationScope(Heap* heap)
: heap_(heap) {
if (heap_->write_protect_code_memory()) {
heap_->increment_code_space_memory_modification_scope_depth();
heap_->code_space()->SetReadAndWritable();
LargePage* page = heap_->lo_space()->first_page();
while (page != nullptr) {
if (page->IsFlagSet(MemoryChunk::IS_EXECUTABLE)) {
CHECK(heap_->memory_allocator()->IsMemoryChunkExecutable(page));
page->SetReadAndWritable();
}
page = page->next_page();
heap_->increment_code_space_memory_modification_scope_depth();
heap_->code_space()->SetReadAndWritable();
LargePage* page = heap_->lo_space()->first_page();
while (page != nullptr) {
if (page->IsFlagSet(MemoryChunk::IS_EXECUTABLE)) {
CHECK(heap_->memory_allocator()->IsMemoryChunkExecutable(page));
page->SetReadAndWritable();
}
page = page->next_page();
}
}
CodeSpaceMemoryModificationScope::~CodeSpaceMemoryModificationScope() {
if (heap_->write_protect_code_memory()) {
heap_->decrement_code_space_memory_modification_scope_depth();
heap_->code_space()->SetReadAndExecutable();
LargePage* page = heap_->lo_space()->first_page();
while (page != nullptr) {
if (page->IsFlagSet(MemoryChunk::IS_EXECUTABLE)) {
CHECK(heap_->memory_allocator()->IsMemoryChunkExecutable(page));
page->SetReadAndExecutable();
}
page = page->next_page();
heap_->decrement_code_space_memory_modification_scope_depth();
heap_->code_space()->SetReadAndExecutable();
LargePage* page = heap_->lo_space()->first_page();
while (page != nullptr) {
if (page->IsFlagSet(MemoryChunk::IS_EXECUTABLE)) {
CHECK(heap_->memory_allocator()->IsMemoryChunkExecutable(page));
page->SetReadAndExecutable();
}
page = page->next_page();
}
}
CodePageMemoryModificationScope::CodePageMemoryModificationScope(
MemoryChunk* chunk)
: chunk_(chunk),
scope_active_(chunk_->heap()->write_protect_code_memory() &&
chunk_->IsFlagSet(MemoryChunk::IS_EXECUTABLE)) {
scope_active_(chunk_->IsFlagSet(MemoryChunk::IS_EXECUTABLE)) {
if (scope_active_) {
DCHECK(chunk_->owner()->identity() == CODE_SPACE ||
(chunk_->owner()->identity() == LO_SPACE &&
......
......@@ -169,7 +169,6 @@ Heap::Heap()
code_space_(nullptr),
map_space_(nullptr),
lo_space_(nullptr),
write_protect_code_memory_(false),
code_space_memory_modification_scope_depth_(0),
gc_state_(NOT_IN_GC),
gc_post_processing_depth_(0),
......@@ -5630,8 +5629,6 @@ bool Heap::SetUp() {
new_space()->AddAllocationObserver(stress_scavenge_observer_);
}
write_protect_code_memory_ = FLAG_write_protect_code_memory;
return true;
}
......
......@@ -788,8 +788,6 @@ class Heap {
// Print short heap statistics.
void PrintShortHeapStatistics();
bool write_protect_code_memory() const { return write_protect_code_memory_; }
uintptr_t code_space_memory_modification_scope_depth() {
return code_space_memory_modification_scope_depth_;
}
......@@ -2370,10 +2368,6 @@ class Heap {
// Map from the space id to the space.
Space* space_[LAST_SPACE + 1];
// Determines whether code space is write-protected. This is essentially a
// race-free copy of the {FLAG_write_protect_code_memory} flag.
bool write_protect_code_memory_;
// Holds the number of open CodeSpaceMemoryModificationScopes.
uintptr_t code_space_memory_modification_scope_depth_;
......
......@@ -591,16 +591,8 @@ MemoryChunk* MemoryChunk::Initialize(Heap* heap, Address base, size_t size,
if (executable == EXECUTABLE) {
chunk->SetFlag(IS_EXECUTABLE);
if (heap->write_protect_code_memory()) {
chunk->write_unprotect_counter_ =
heap->code_space_memory_modification_scope_depth();
} else {
size_t page_size = MemoryAllocator::GetCommitPageSize();
DCHECK(IsAddressAligned(area_start, page_size));
size_t area_size = RoundUp(area_end - area_start, page_size);
CHECK(SetPermissions(area_start, area_size,
PageAllocator::kReadWriteExecute));
}
chunk->write_unprotect_counter_ =
heap->code_space_memory_modification_scope_depth();
}
if (reservation != nullptr) {
......
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