diff --git a/src/heap/memory-allocator.h b/src/heap/memory-allocator.h index 72f7943e1d..74d9b6bca5 100644 --- a/src/heap/memory-allocator.h +++ b/src/heap/memory-allocator.h @@ -330,12 +330,14 @@ class MemoryAllocator { } void RegisterExecutableMemoryChunk(MemoryChunk* chunk) { + base::MutexGuard guard(&executable_memory_mutex_); DCHECK(chunk->IsFlagSet(MemoryChunk::IS_EXECUTABLE)); DCHECK_EQ(executable_memory_.find(chunk), executable_memory_.end()); executable_memory_.insert(chunk); } void UnregisterExecutableMemoryChunk(MemoryChunk* chunk) { + base::MutexGuard guard(&executable_memory_mutex_); DCHECK_NE(executable_memory_.find(chunk), executable_memory_.end()); executable_memory_.erase(chunk); chunk->heap()->UnregisterUnprotectedMemoryChunk(chunk); @@ -396,6 +398,7 @@ class MemoryAllocator { // Data structure to remember allocated executable memory chunks. std::unordered_set executable_memory_; + base::Mutex executable_memory_mutex_; friend class heap::TestCodePageAllocatorScope;