28#ifdef V8_ENABLE_SANDBOX
30 &code_pointer_space_);
32#ifdef V8_ENABLE_LEAPTIERING
34#if V8_STATIC_DISPATCH_HANDLES_BOOL
35 jdt->DetachSpaceFromReadOnlySegment(&js_dispatch_table_space_);
37 jdt->TearDownSpace(&js_dispatch_table_space_);
48 if (read_only_snapshot_data !=
nullptr) {
49 bool read_only_heap_created =
false;
56 isolate, read_only_snapshot_data, can_rehash);
58 read_only_heap_created =
true;
60 isolate->SetUpFromReadOnlyArtifacts(artifacts);
61#ifdef V8_COMPRESS_POINTERS
62 isolate->external_pointer_table().SetUpFromReadOnlyArtifacts(
63 isolate->heap()->read_only_external_pointer_space(), artifacts);
66 artifacts->
VerifyChecksum(read_only_snapshot_data, read_only_heap_created);
93 isolate->serializer_enabled())) {
117 isolate->heap()->EnsureSweepingCompleted(
118 Heap::SweepingForcedFinalizationMode::kV8Only);
134 std::unique_ptr<ReadOnlyHeap> shared_ro_heap(
new ReadOnlyHeap(ro_space));
135 isolate->isolate_group()->set_shared_read_only_heap(shared_ro_heap.get());
137 isolate->SetUpFromReadOnlyArtifacts(artifacts);
141 void*
const isolate_ro_roots =
142 isolate->roots_table().read_only_roots_begin().location();
148 void*
const isolate_ro_roots =
149 isolate->roots_table().read_only_roots_begin().location();
158 isolate->isolate_group()->read_only_artifacts();
170 : read_only_space_(ro_space) {
171#ifdef V8_ENABLE_SANDBOX
173 &code_pointer_space_);
175#ifdef V8_ENABLE_LEAPTIERING
177 jdt->InitializeSpace(&js_dispatch_table_space_);
181 js_dispatch_table_space_.set_allocate_black(
true);
182#if V8_STATIC_DISPATCH_HANDLES_BOOL
183 jdt->AttachSpaceToReadOnlySegment(&js_dispatch_table_space_);
184 jdt->PreAllocateEntries(&js_dispatch_table_space_,
185 JSBuiltinDispatchHandleRoot::kCount,
true);
193 statistics->read_only_space_size_ = 0;
194 statistics->read_only_space_used_size_ = 0;
195 statistics->read_only_space_physical_size_ = 0;
200 statistics->read_only_space_used_size_ = ro_space->
Size();
201 statistics->read_only_space_physical_size_ =
218#ifdef V8_ENABLE_SANDBOX
231 : ro_space_(ro_space),
240 if (!obj.
is_null())
return obj;
255 page, page == nullptr ?
kNullAddress : page->GetAreaStart(),
256 skip_free_space_or_filler) {}
262 current_addr_(current_addr),
263 skip_free_space_or_filler_(skip_free_space_or_filler) {
264 DCHECK_GE(current_addr, page->GetAreaStart());
265 DCHECK_LT(current_addr, page->GetAreaStart() + page->area_size());
277 const int object_size =
object->Size();
281 IsFreeSpaceOrFiller(
object)) {
V8_INLINE void AssertHeld() const
virtual size_t CommittedMemory() const
static Tagged< HeapObject > FromAddress(Address address)
static void VerifyReadOnlyHeap(Heap *heap)
static void VerifyHeap(Heap *heap)
static IsolateGroup * current()
ReadOnlyArtifacts * read_only_artifacts()
ReadOnlyArtifacts * InitializeReadOnlyArtifacts()
static V8_INLINE MemoryChunk * FromAddress(Address addr)
static V8_INLINE MemoryChunk * FromHeapObject(Tagged< HeapObject > object)
V8_INLINE bool InReadOnlySpace() const
ReadOnlyHeap * read_only_heap() const
void ReinstallReadOnlySpace(Isolate *isolate)
void InitializeChecksum(SnapshotData *read_only_snapshot_data)
void VerifyChecksum(SnapshotData *read_only_snapshot_data, bool read_only_heap_created)
void set_initial_next_unique_sfi_id(uint32_t id)
void set_read_only_heap(std::unique_ptr< ReadOnlyHeap > read_only_heap)
void VerifyHeapAndSpaceRelationships(Isolate *isolate)
SharedReadOnlySpace * shared_read_only_space()
void DeserializeIntoIsolate()
Tagged< HeapObject > Next()
const ReadOnlySpace *const ro_space_
std::vector< ReadOnlyPageMetadata * >::const_iterator current_page_
ReadOnlyPageObjectIterator page_iterator_
ReadOnlyHeapObjectIterator(const ReadOnlyHeap *ro_heap)
static void PopulateReadOnlySpaceStatistics(SharedMemoryStatistics *statistics)
void DeserializeIntoIsolate(Isolate *isolate, SnapshotData *read_only_snapshot_data, bool can_rehash)
static V8_EXPORT_PRIVATE bool Contains(Address address)
void InitializeFromIsolateRoots(Isolate *isolate)
Address read_only_roots_[kEntriesCount]
static constexpr size_t kEntriesCount
static V8_EXPORT_PRIVATE bool SandboxSafeContains(Tagged< HeapObject > object)
static void SetUp(Isolate *isolate, SnapshotData *read_only_snapshot_data, bool can_rehash)
bool roots_init_complete_
V8_EXPORT_PRIVATE void OnCreateHeapObjectsComplete(Isolate *isolate)
ReadOnlySpace * read_only_space_
void InitFromIsolate(Isolate *isolate)
void InitializeIsolateRoots(Isolate *isolate)
ReadOnlyHeap(ReadOnlySpace *ro_space)
static void CreateInitialHeapForBootstrapping(Isolate *isolate, ReadOnlyArtifacts *artifacts)
void OnCreateRootsComplete(Isolate *isolate)
ReadOnlySpace * read_only_space() const
const SkipFreeSpaceOrFiller skip_free_space_or_filler_
const ReadOnlyPageMetadata * page_
ReadOnlyPageObjectIterator(const ReadOnlyPageMetadata *page, SkipFreeSpaceOrFiller skip_free_space_or_filler=SkipFreeSpaceOrFiller::kYes)
void Reset(const ReadOnlyPageMetadata *page)
Tagged< HeapObject > Next()
V8_EXPORT_PRIVATE void ShrinkPages()
size_t Size() const override
V8_EXPORT_PRIVATE size_t CommittedPhysicalMemory() const override
void DetachPagesAndAddToArtifacts(ReadOnlyArtifacts *artifacts)
V8_INLINE constexpr bool is_null() const
#define ALIGN_TO_ALLOCATION_ALIGNMENT(value)
NormalPage * current_page_
kInterpreterTrampolineOffset Tagged< HeapObject >
V8_EXPORT_PRIVATE FlagValues v8_flags
static constexpr Address kNullAddress
#define DCHECK_OBJECT_SIZE(size)
#define DCHECK_LE(v1, v2)
#define DCHECK_NOT_NULL(val)
#define DCHECK_GE(v1, v2)
#define DCHECK(condition)
#define DCHECK_LT(v1, v2)
#define DCHECK_EQ(v1, v2)
#define V8_UNLIKELY(condition)