// Copyright 2023 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_HEAP_PAGE_METADATA_H_ #define V8_HEAP_PAGE_METADATA_H_ #include "src/heap/base-space.h" #include "src/heap/free-list.h" #include "src/heap/mutable-page-metadata.h" #include "src/heap/spaces.h" namespace v8 { namespace internal { class Heap; // ----------------------------------------------------------------------------- // A page is a memory chunk of a size 256K. Large object pages may be larger. // // The only way to get a page pointer is by calling factory methods: // PageMetadata* p = PageMetadata::FromAddress(addr); or // PageMetadata* p = PageMetadata::FromAllocationAreaAddress(address); class PageMetadata : public MutablePageMetadata { … }; // Validate our estimates on the header size. static_assert …; static_assert …; static_assert …; } // namespace internal namespace base { // Define special hash function for page pointers, to be used with std data // structures, e.g. std::unordered_set<PageMetadata*, base::hash<PageMetadata*> template <> struct hash<i::PageMetadata*> : hash<i::MemoryChunkMetadata*> { … }; template <> struct hash<const i::PageMetadata*> : hash<const i::MemoryChunkMetadata*> { … }; } // namespace base } // namespace v8 #endif // V8_HEAP_PAGE_METADATA_H_