diff --git a/src/heap/memory-chunk-layout.h b/src/heap/memory-chunk-layout.h index 67e3a7b9dd..fd65684b12 100644 --- a/src/heap/memory-chunk-layout.h +++ b/src/heap/memory-chunk-layout.h @@ -39,11 +39,7 @@ class V8_EXPORT_PRIVATE MemoryChunkLayout { public: static constexpr int kNumSets = NUMBER_OF_REMEMBERED_SET_TYPES; static constexpr int kNumTypes = ExternalBackingStoreType::kNumTypes; -#if V8_CC_MSVC && V8_TARGET_ARCH_IA32 - static constexpr int kMemoryChunkAlignment = 8; -#else static constexpr int kMemoryChunkAlignment = sizeof(size_t); -#endif // V8_CC_MSVC && V8_TARGET_ARCH_IA32 #define FIELD(Type, Name) \ k##Name##Offset, k##Name##End = k##Name##Offset + sizeof(Type) - 1 enum Header { @@ -73,7 +69,7 @@ class V8_EXPORT_PRIVATE MemoryChunkLayout { FIELD(FreeListCategory**, Categories), FIELD(CodeObjectRegistry*, CodeObjectRegistry), FIELD(PossiblyEmptyBuckets, PossiblyEmptyBuckets), - FIELD(ActiveSystemPages, ActiveSystemPages), + FIELD(ActiveSystemPages*, ActiveSystemPages), #ifdef V8_ENABLE_INNER_POINTER_RESOLUTION_OSB FIELD(ObjectStartBitmap, ObjectStartBitmap), #endif // V8_ENABLE_INNER_POINTER_RESOLUTION_OSB diff --git a/src/heap/memory-chunk.cc b/src/heap/memory-chunk.cc index a2238416f5..6a98d11ffe 100644 --- a/src/heap/memory-chunk.cc +++ b/src/heap/memory-chunk.cc @@ -182,11 +182,13 @@ MemoryChunk::MemoryChunk(Heap* heap, BaseSpace* space, size_t chunk_size, possibly_empty_buckets_.Initialize(); if (page_size == PageSize::kRegular) { - active_system_pages_.Init(MemoryChunkLayout::kMemoryChunkHeaderSize, - MemoryAllocator::GetCommitPageSizeBits(), size()); + active_system_pages_ = new ActiveSystemPages; + active_system_pages_->Init(MemoryChunkLayout::kMemoryChunkHeaderSize, + MemoryAllocator::GetCommitPageSizeBits(), + size()); } else { // We do not track active system pages for large pages. - active_system_pages_.Clear(); + active_system_pages_ = nullptr; } // All pages of a shared heap need to be marked with this flag. @@ -202,7 +204,7 @@ MemoryChunk::MemoryChunk(Heap* heap, BaseSpace* space, size_t chunk_size, size_t MemoryChunk::CommittedPhysicalMemory() const { if (!base::OS::HasLazyCommits() || IsLargePage()) return size(); - return active_system_pages_.Size(MemoryAllocator::GetCommitPageSizeBits()); + return active_system_pages_->Size(MemoryAllocator::GetCommitPageSizeBits()); } void MemoryChunk::SetOldGenerationPageFlags(bool is_marking) { @@ -245,6 +247,11 @@ void MemoryChunk::ReleaseAllocatedMemoryNeededForWritableChunk() { code_object_registry_ = nullptr; } + if (active_system_pages_ != nullptr) { + delete active_system_pages_; + active_system_pages_ = nullptr; + } + possibly_empty_buckets_.Release(); ReleaseSlotSet(); ReleaseSlotSet(); diff --git a/src/heap/memory-chunk.h b/src/heap/memory-chunk.h index 8e74f9edc2..f532e28de0 100644 --- a/src/heap/memory-chunk.h +++ b/src/heap/memory-chunk.h @@ -297,7 +297,7 @@ class MemoryChunk : public BasicMemoryChunk { PossiblyEmptyBuckets possibly_empty_buckets_; - ActiveSystemPages active_system_pages_; + ActiveSystemPages* active_system_pages_; #ifdef V8_ENABLE_INNER_POINTER_RESOLUTION_OSB ObjectStartBitmap object_start_bitmap_; diff --git a/src/heap/spaces.h b/src/heap/spaces.h index 53e35d129c..29ac3ad0ed 100644 --- a/src/heap/spaces.h +++ b/src/heap/spaces.h @@ -315,7 +315,7 @@ class Page : public MemoryChunk { void AllocateFreeListCategories(); void ReleaseFreeListCategories(); - ActiveSystemPages* active_system_pages() { return &active_system_pages_; } + ActiveSystemPages* active_system_pages() { return active_system_pages_; } template void ClearTypedSlotsInFreeMemory(const TypedSlotSet::FreeRangesMap& ranges) {