#include "src/snapshot/serializer.h"
#include "include/v8-internal.h"
#include "src/codegen/assembler-inl.h"
#include "src/common/globals.h"
#include "src/handles/global-handles-inl.h"
#include "src/heap/heap-inl.h"
#include "src/heap/mutable-page-metadata-inl.h"
#include "src/heap/read-only-heap.h"
#include "src/objects/code.h"
#include "src/objects/descriptor-array.h"
#include "src/objects/instance-type-checker.h"
#include "src/objects/instance-type.h"
#include "src/objects/js-array-buffer-inl.h"
#include "src/objects/map.h"
#include "src/objects/objects-body-descriptors-inl.h"
#include "src/objects/slots-inl.h"
#include "src/objects/slots.h"
#include "src/objects/smi.h"
#include "src/sandbox/js-dispatch-table-inl.h"
#include "src/snapshot/embedded/embedded-data.h"
#include "src/snapshot/serializer-deserializer.h"
#include "src/snapshot/serializer-inl.h"
namespace v8 {
namespace internal {
Serializer::Serializer(Isolate* isolate, Snapshot::SerializerFlags flags)
: … { … }
#ifdef DEBUG
void Serializer::PopStack() { … }
#endif
void Serializer::CountAllocation(Tagged<Map> map, int size,
SnapshotSpace space) { … }
int Serializer::TotalAllocationSize() const { … }
namespace {
const char* ToString(SnapshotSpace space) { … }
}
void Serializer::OutputStatistics(const char* name) { … }
void Serializer::SerializeDeferredObjects() { … }
void Serializer::SerializeObject(Handle<HeapObject> obj, SlotType slot_type) { … }
bool Serializer::MustBeDeferred(Tagged<HeapObject> object) { … }
void Serializer::VisitRootPointers(Root root, const char* description,
FullObjectSlot start, FullObjectSlot end) { … }
void Serializer::SerializeRootObject(FullObjectSlot slot) { … }
#ifdef DEBUG
void Serializer::PrintStack() { … }
void Serializer::PrintStack(std::ostream& out) { … }
#endif
bool Serializer::SerializeRoot(Tagged<HeapObject> obj) { … }
bool Serializer::SerializeHotObject(Tagged<HeapObject> obj) { … }
bool Serializer::SerializeBackReference(Tagged<HeapObject> obj) { … }
bool Serializer::SerializePendingObject(Tagged<HeapObject> obj) { … }
bool Serializer::ObjectIsBytecodeHandler(Tagged<HeapObject> obj) const { … }
void Serializer::PutRoot(RootIndex root) { … }
void Serializer::PutSmiRoot(FullObjectSlot slot) { … }
void Serializer::PutBackReference(Tagged<HeapObject> object,
SerializerReference reference) { … }
void Serializer::PutAttachedReference(SerializerReference reference) { … }
void Serializer::PutRepeat(int repeat_count) { … }
void Serializer::PutPendingForwardReference(PendingObjectReferences& refs) { … }
void Serializer::ResolvePendingForwardReference(int forward_reference_id) { … }
ExternalReferenceEncoder::Value Serializer::EncodeExternalReference(
Address addr) { … }
void Serializer::RegisterObjectIsPending(Tagged<HeapObject> obj) { … }
void Serializer::ResolvePendingObject(Tagged<HeapObject> obj) { … }
void Serializer::Pad(int padding_offset) { … }
void Serializer::InitializeCodeAddressMap() { … }
Tagged<InstructionStream> Serializer::CopyCode(
Tagged<InstructionStream> istream) { … }
void Serializer::ObjectSerializer::SerializePrologue(SnapshotSpace space,
int size,
Tagged<Map> map) { … }
uint32_t Serializer::ObjectSerializer::SerializeBackingStore(
void* backing_store, uint32_t byte_length,
Maybe<uint32_t> max_byte_length) { … }
void Serializer::ObjectSerializer::SerializeJSTypedArray() { … }
void Serializer::ObjectSerializer::SerializeJSArrayBuffer() { … }
void Serializer::ObjectSerializer::SerializeExternalString() { … }
void Serializer::ObjectSerializer::SerializeExternalStringAsSequentialString() { … }
class V8_NODISCARD UnlinkWeakNextScope { … };
void Serializer::ObjectSerializer::Serialize(SlotType slot_type) { … }
namespace {
SnapshotSpace GetSnapshotSpace(Tagged<HeapObject> object) { … }
}
void Serializer::ObjectSerializer::SerializeObject() { … }
void Serializer::ObjectSerializer::SerializeDeferred() { … }
void Serializer::ObjectSerializer::SerializeContent(Tagged<Map> map, int size) { … }
void Serializer::ObjectSerializer::VisitPointers(Tagged<HeapObject> host,
ObjectSlot start,
ObjectSlot end) { … }
void Serializer::ObjectSerializer::VisitPointers(Tagged<HeapObject> host,
MaybeObjectSlot start,
MaybeObjectSlot end) { … }
void Serializer::ObjectSerializer::VisitInstructionStreamPointer(
Tagged<Code> host, InstructionStreamSlot slot) { … }
void Serializer::ObjectSerializer::VisitEmbeddedPointer(
Tagged<InstructionStream> host, RelocInfo* rinfo) { … }
void Serializer::ObjectSerializer::VisitExternalReference(
Tagged<InstructionStream> host, RelocInfo* rinfo) { … }
void Serializer::ObjectSerializer::VisitInternalReference(
Tagged<InstructionStream> host, RelocInfo* rinfo) { … }
void Serializer::ObjectSerializer::VisitOffHeapTarget(
Tagged<InstructionStream> host, RelocInfo* rinfo) { … }
void Serializer::ObjectSerializer::VisitCodeTarget(
Tagged<InstructionStream> host, RelocInfo* rinfo) { … }
void Serializer::ObjectSerializer::OutputExternalReference(
Address target, int target_size, bool sandboxify, ExternalPointerTag tag) { … }
void Serializer::ObjectSerializer::VisitCppHeapPointer(
Tagged<HeapObject> host, CppHeapPointerSlot slot) { … }
void Serializer::ObjectSerializer::VisitExternalPointer(
Tagged<HeapObject> host, ExternalPointerSlot slot) { … }
void Serializer::ObjectSerializer::VisitIndirectPointer(
Tagged<HeapObject> host, IndirectPointerSlot slot,
IndirectPointerMode mode) { … }
void Serializer::ObjectSerializer::VisitTrustedPointerTableEntry(
Tagged<HeapObject> host, IndirectPointerSlot slot) { … }
void Serializer::ObjectSerializer::VisitProtectedPointer(
Tagged<TrustedObject> host, ProtectedPointerSlot slot) { … }
void Serializer::ObjectSerializer::VisitJSDispatchTableEntry(
Tagged<HeapObject> host, JSDispatchHandle handle) { … }
namespace {
void OutputRawWithCustomField(SnapshotByteSink* sink, Address object_start,
int written_so_far, int bytes_to_write,
int field_offset, int field_size,
const uint8_t* field_value) { … }
}
void Serializer::ObjectSerializer::OutputRawData(Address up_to) { … }
Serializer::HotObjectsList::HotObjectsList(Heap* heap) : … { … }
Serializer::HotObjectsList::~HotObjectsList() { … }
Handle<FixedArray> ObjectCacheIndexMap::Values(Isolate* isolate) { … }
bool Serializer::SerializeReadOnlyObjectReference(Tagged<HeapObject> obj,
SnapshotByteSink* sink) { … }
}
}