chromium/v8/src/heap/read-only-heap.cc

// Copyright 2019 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.

#include "src/heap/read-only-heap.h"

#include <cstddef>
#include <cstring>

#include "src/base/lazy-instance.h"
#include "src/base/platform/mutex.h"
#include "src/common/globals.h"
#include "src/common/ptr-compr-inl.h"
#include "src/heap/heap-write-barrier-inl.h"
#include "src/heap/memory-chunk-metadata.h"
#include "src/heap/mutable-page-metadata.h"
#include "src/heap/read-only-spaces.h"
#include "src/objects/heap-object-inl.h"
#include "src/objects/objects-inl.h"
#include "src/objects/smi.h"
#include "src/sandbox/js-dispatch-table-inl.h"
#include "src/snapshot/read-only-deserializer.h"
#include "src/utils/allocation.h"

namespace v8 {
namespace internal {

namespace {
// Mutex used to ensure that ReadOnlyArtifacts creation is only done once.
base::LazyMutex read_only_heap_creation_mutex_ = LAZY_MUTEX_INITIALIZER;

// Weak pointer holding ReadOnlyArtifacts. ReadOnlyHeap::SetUp creates a
// std::shared_ptr from this when it attempts to reuse it. Since all Isolates
// hold a std::shared_ptr to this, the object is destroyed when no Isolates
// remain.
base::LazyInstance<std::weak_ptr<ReadOnlyArtifacts>>::type
    read_only_artifacts_ = LAZY_INSTANCE_INITIALIZER;

std::shared_ptr<ReadOnlyArtifacts> InitializeSharedReadOnlyArtifacts() {}
}  // namespace

ReadOnlyHeap::~ReadOnlyHeap() {}

bool ReadOnlyHeap::IsSharedMemoryAvailable() {}

// This ReadOnlyHeap instance will only be accessed by Isolates that are already
// set up. As such it doesn't need to be guarded by a mutex or shared_ptrs,
// since an already set up Isolate will hold a shared_ptr to
// read_only_artifacts_.
SoleReadOnlyHeap* SoleReadOnlyHeap::shared_ro_heap_ =;

// static
void ReadOnlyHeap::SetUp(Isolate* isolate,
                         SnapshotData* read_only_snapshot_data,
                         bool can_rehash) {}

void ReadOnlyHeap::DeserializeIntoIsolate(Isolate* isolate,
                                          SnapshotData* read_only_snapshot_data,
                                          bool can_rehash) {}

void ReadOnlyHeap::OnCreateRootsComplete(Isolate* isolate) {}

void ReadOnlyHeap::OnCreateHeapObjectsComplete(Isolate* isolate) {}

// Only for compressed spaces
ReadOnlyHeap::ReadOnlyHeap(ReadOnlyHeap* ro_heap, ReadOnlySpace* ro_space)
    :{}

// static
ReadOnlyHeap* ReadOnlyHeap::CreateInitialHeapForBootstrapping(
    Isolate* isolate, std::shared_ptr<ReadOnlyArtifacts> artifacts) {}

void SoleReadOnlyHeap::InitializeIsolateRoots(Isolate* isolate) {}

void SoleReadOnlyHeap::InitializeFromIsolateRoots(Isolate* isolate) {}

void ReadOnlyHeap::InitFromIsolate(Isolate* isolate) {}

ReadOnlyHeap::ReadOnlyHeap(ReadOnlySpace* ro_space)
    :{}

void ReadOnlyHeap::OnHeapTearDown(Heap* heap) {}

void SoleReadOnlyHeap::OnHeapTearDown(Heap* heap) {}

// static
void ReadOnlyHeap::PopulateReadOnlySpaceStatistics(
    SharedMemoryStatistics* statistics) {}

// static
bool ReadOnlyHeap::Contains(Address address) {}

// static
bool ReadOnlyHeap::Contains(Tagged<HeapObject> object) {}

// static
bool ReadOnlyHeap::SandboxSafeContains(Tagged<HeapObject> object) {}

ReadOnlyHeapObjectIterator::ReadOnlyHeapObjectIterator(
    const ReadOnlyHeap* ro_heap)
    :{}

ReadOnlyHeapObjectIterator::ReadOnlyHeapObjectIterator(
    const ReadOnlySpace* ro_space)
    :{}

Tagged<HeapObject> ReadOnlyHeapObjectIterator::Next() {}

ReadOnlyPageObjectIterator::ReadOnlyPageObjectIterator(
    const ReadOnlyPageMetadata* page,
    SkipFreeSpaceOrFiller skip_free_space_or_filler)
    :{}

ReadOnlyPageObjectIterator::ReadOnlyPageObjectIterator(
    const ReadOnlyPageMetadata* page, Address current_addr,
    SkipFreeSpaceOrFiller skip_free_space_or_filler)
    :{}

Tagged<HeapObject> ReadOnlyPageObjectIterator::Next() {}

void ReadOnlyPageObjectIterator::Reset(const ReadOnlyPageMetadata* page) {}

}  // namespace internal
}  // namespace v8