#include "src/heap/read-only-spaces.h"
#include <memory>
#include "include/v8-internal.h"
#include "include/v8-platform.h"
#include "src/base/logging.h"
#include "src/common/globals.h"
#include "src/common/ptr-compr-inl.h"
#include "src/execution/isolate.h"
#include "src/heap/allocation-stats.h"
#include "src/heap/heap-inl.h"
#include "src/heap/heap-verifier.h"
#include "src/heap/marking-state-inl.h"
#include "src/heap/memory-allocator.h"
#include "src/heap/memory-chunk-metadata.h"
#include "src/heap/read-only-heap.h"
#include "src/objects/objects-inl.h"
#include "src/snapshot/snapshot-data.h"
#include "src/snapshot/snapshot-source-sink.h"
#include "src/snapshot/snapshot-utils.h"
namespace v8 {
namespace internal {
void CopyAndRebaseRoots(Address* src, Address* dst, Address new_base) { … }
void ReadOnlyArtifacts::set_read_only_heap(
std::unique_ptr<ReadOnlyHeap> read_only_heap) { … }
void ReadOnlyArtifacts::InitializeChecksum(
SnapshotData* read_only_snapshot_data) { … }
void ReadOnlyArtifacts::VerifyChecksum(SnapshotData* read_only_snapshot_data,
bool read_only_heap_created) { … }
SingleCopyReadOnlyArtifacts::~SingleCopyReadOnlyArtifacts() { … }
ReadOnlyHeap* SingleCopyReadOnlyArtifacts::GetReadOnlyHeapForIsolate(
Isolate* isolate) { … }
void SingleCopyReadOnlyArtifacts::Initialize(
Isolate* isolate, std::vector<ReadOnlyPageMetadata*>&& pages,
const AllocationStats& stats) { … }
void SingleCopyReadOnlyArtifacts::ReinstallReadOnlySpace(Isolate* isolate) { … }
void SingleCopyReadOnlyArtifacts::VerifyHeapAndSpaceRelationships(
Isolate* isolate) { … }
void PointerCompressedReadOnlyArtifacts::InitializeRootsFrom(Isolate* isolate) { … }
void PointerCompressedReadOnlyArtifacts::InitializeRootsIn(Isolate* isolate) { … }
SharedReadOnlySpace* PointerCompressedReadOnlyArtifacts::CreateReadOnlySpace(
Isolate* isolate) { … }
ReadOnlyHeap* PointerCompressedReadOnlyArtifacts::GetReadOnlyHeapForIsolate(
Isolate* isolate) { … }
std::unique_ptr<::v8::PageAllocator::SharedMemoryMapping>
PointerCompressedReadOnlyArtifacts::RemapPageTo(
size_t i, Address new_address, ReadOnlyPageMetadata*& new_page) { … }
void PointerCompressedReadOnlyArtifacts::Initialize(
Isolate* isolate, std::vector<ReadOnlyPageMetadata*>&& pages,
const AllocationStats& stats) { … }
void PointerCompressedReadOnlyArtifacts::ReinstallReadOnlySpace(
Isolate* isolate) { … }
void PointerCompressedReadOnlyArtifacts::VerifyHeapAndSpaceRelationships(
Isolate* isolate) { … }
ReadOnlySpace::ReadOnlySpace(Heap* heap)
: … { … }
ReadOnlySpace::~ReadOnlySpace() = default;
void SharedReadOnlySpace::TearDown(MemoryAllocator* memory_allocator) { … }
void ReadOnlySpace::TearDown(MemoryAllocator* memory_allocator) { … }
void ReadOnlySpace::DetachPagesAndAddToArtifacts(
std::shared_ptr<ReadOnlyArtifacts> artifacts) { … }
ReadOnlyPageMetadata::ReadOnlyPageMetadata(Heap* heap, BaseSpace* space,
size_t chunk_size,
Address area_start, Address area_end,
VirtualMemory reservation)
: … { … }
MemoryChunk::MainThreadFlags ReadOnlyPageMetadata::InitialFlags() const { … }
void ReadOnlyPageMetadata::MakeHeaderRelocatable() { … }
void ReadOnlySpace::SetPermissionsForPages(MemoryAllocator* memory_allocator,
PageAllocator::Permission access) { … }
void ReadOnlySpace::RepairFreeSpacesAfterDeserialization() { … }
void ReadOnlySpace::Seal(SealMode ro_mode) { … }
void ReadOnlySpace::Unseal() { … }
bool ReadOnlySpace::ContainsSlow(Address addr) const { … }
namespace {
class ReadOnlySpaceObjectIterator : public ObjectIterator { … };
}
#ifdef VERIFY_HEAP
void ReadOnlySpace::Verify(Isolate* isolate,
SpaceVerificationVisitor* visitor) const { … }
#ifdef DEBUG
void ReadOnlySpace::VerifyCounters(Heap* heap) const { … }
#endif
#endif
size_t ReadOnlySpace::CommittedPhysicalMemory() const { … }
void ReadOnlySpace::FreeLinearAllocationArea() { … }
void ReadOnlySpace::EnsurePage() { … }
void ReadOnlySpace::EnsureSpaceForAllocation(int size_in_bytes) { … }
Tagged<HeapObject> ReadOnlySpace::TryAllocateLinearlyAligned(
int size_in_bytes, AllocationAlignment alignment) { … }
AllocationResult ReadOnlySpace::AllocateRawAligned(
int size_in_bytes, AllocationAlignment alignment) { … }
AllocationResult ReadOnlySpace::AllocateRawUnaligned(int size_in_bytes) { … }
AllocationResult ReadOnlySpace::AllocateRaw(int size_in_bytes,
AllocationAlignment alignment) { … }
size_t ReadOnlyPageMetadata::ShrinkToHighWaterMark() { … }
void ReadOnlySpace::ShrinkPages() { … }
SharedReadOnlySpace::SharedReadOnlySpace(
Heap* heap, PointerCompressedReadOnlyArtifacts* artifacts)
: … { … }
SharedReadOnlySpace::SharedReadOnlySpace(
Heap* heap, std::vector<ReadOnlyPageMetadata*>&& new_pages,
std::vector<std::unique_ptr<::v8::PageAllocator::SharedMemoryMapping>>&&
mappings,
AllocationStats&& new_stats)
: … { … }
SharedReadOnlySpace::SharedReadOnlySpace(Heap* heap,
SingleCopyReadOnlyArtifacts* artifacts)
: … { … }
size_t ReadOnlySpace::IndexOf(const MemoryChunkMetadata* chunk) const { … }
size_t ReadOnlySpace::AllocateNextPage() { … }
size_t ReadOnlySpace::AllocateNextPageAt(Address pos) { … }
void ReadOnlySpace::InitializePageForDeserialization(
ReadOnlyPageMetadata* page, size_t area_size_in_bytes) { … }
void ReadOnlySpace::FinalizeSpaceForDeserialization() { … }
}
}