Commit 5bf95ec6 authored by Victor Gomes's avatar Victor Gomes Committed by V8 LUCI CQ

[heap] Remove unecessary unprotected_memory_chunks_registry_enabled_

This is an unecessary boolean, that makes reason about the code more
complicated.

Bug: v8:12054
Change-Id: I5bdf2069ead427f53ce774e825fe9656e668480e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3268284
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: 's avatarDominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77765}
parent 103f9d53
......@@ -826,7 +826,6 @@ CodePageCollectionMemoryModificationScope::
: heap_(heap) {
if (heap_->write_protect_code_memory() &&
!heap_->code_space_memory_modification_scope_depth()) {
heap_->EnableUnprotectedMemoryChunksRegistry();
heap_->IncrementCodePageCollectionMemoryModificationScopeDepth();
}
}
......@@ -838,7 +837,6 @@ CodePageCollectionMemoryModificationScope::
heap_->DecrementCodePageCollectionMemoryModificationScopeDepth();
if (heap_->code_page_collection_memory_modification_scope_depth() == 0) {
heap_->ProtectUnprotectedMemoryChunks();
heap_->DisableUnprotectedMemoryChunksRegistry();
}
}
}
......
......@@ -2650,7 +2650,7 @@ void Heap::ComputeFastPromotionMode() {
void Heap::UnprotectAndRegisterMemoryChunk(MemoryChunk* chunk,
UnprotectMemoryOrigin origin) {
if (unprotected_memory_chunks_registry_enabled_) {
if (code_page_collection_memory_modification_scope_depth_ > 0) {
base::Optional<base::MutexGuard> guard;
if (origin != UnprotectMemoryOrigin::kMainThread) {
guard.emplace(&unprotected_memory_chunks_mutex_);
......@@ -2671,7 +2671,7 @@ void Heap::UnregisterUnprotectedMemoryChunk(MemoryChunk* chunk) {
}
void Heap::ProtectUnprotectedMemoryChunks() {
DCHECK(unprotected_memory_chunks_registry_enabled_);
DCHECK_EQ(code_page_collection_memory_modification_scope_depth_, 0);
for (auto chunk = unprotected_memory_chunks_.begin();
chunk != unprotected_memory_chunks_.end(); chunk++) {
CHECK(memory_allocator()->IsMemoryChunkExecutable(*chunk));
......
......@@ -668,18 +668,6 @@ class Heap {
void UnregisterUnprotectedMemoryChunk(MemoryChunk* chunk);
V8_EXPORT_PRIVATE void ProtectUnprotectedMemoryChunks();
void EnableUnprotectedMemoryChunksRegistry() {
unprotected_memory_chunks_registry_enabled_ = true;
}
void DisableUnprotectedMemoryChunksRegistry() {
unprotected_memory_chunks_registry_enabled_ = false;
}
bool unprotected_memory_chunks_registry_enabled() {
return unprotected_memory_chunks_registry_enabled_;
}
void IncrementCodePageCollectionMemoryModificationScopeDepth() {
code_page_collection_memory_modification_scope_depth_++;
}
......@@ -2476,7 +2464,6 @@ class Heap {
base::Mutex unprotected_memory_chunks_mutex_;
std::unordered_set<MemoryChunk*> unprotected_memory_chunks_;
bool unprotected_memory_chunks_registry_enabled_ = false;
#ifdef V8_ENABLE_ALLOCATION_TIMEOUT
// If the --gc-interval flag is set to a positive value, 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