v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
v8::internal::Serializer Class Referenceabstract

#include <serializer.h>

Inheritance diagram for v8::internal::Serializer:
Collaboration diagram for v8::internal::Serializer:

Classes

class  HotObjectsList
 
class  ObjectSerializer
 
class  RecursionScope
 

Public Member Functions

 Serializer (Isolate *isolate, Snapshot::SerializerFlags flags)
 
 ~Serializer () override
 
 Serializer (const Serializer &)=delete
 
Serializeroperator= (const Serializer &)=delete
 
const std::vector< uint8_t > * Payload () const
 
bool ReferenceMapContains (DirectHandle< HeapObject > o)
 
Isolateisolate () const
 
PtrComprCageBase cage_base () const
 
int TotalAllocationSize () const
 
- Public Member Functions inherited from v8::internal::RootVisitor
virtual ~RootVisitor ()=default
 
virtual void VisitRootPointer (Root root, const char *description, FullObjectSlot p)
 
virtual void VisitRootPointers (Root root, const char *description, OffHeapObjectSlot start, OffHeapObjectSlot end)
 
virtual void VisitRunningCode (FullObjectSlot code_slot, FullObjectSlot istream_or_smi_zero_slot)
 
virtual void Synchronize (VisitorSynchronization::SyncTag tag)
 
virtual GarbageCollector collector () const
 

Protected Types

using PendingObjectReferences = std::vector<int>*
 
- Protected Types inherited from v8::internal::SerializerDeserializer
enum class  SlotType { kAnySlot , kMapSlot }
 
enum  Bytecode : uint8_t {
  kNewObject = 0x00 , kBackref = 0x04 , kReadOnlyHeapRef , kStartupObjectCache ,
  kRootArray , kAttachedReference , kSharedHeapObjectCache , kNop ,
  kSynchronize , kVariableRepeatRoot , kOffHeapBackingStore , kOffHeapResizableBackingStore ,
  kEmbedderFieldsData , kApiWrapperFieldsData , kVariableRawData , kApiReference ,
  kExternalReference , kSandboxedApiReference , kSandboxedExternalReference , kSandboxedRawExternalReference ,
  kClearedWeakReference , kWeakPrefix , kRegisterPendingForwardRef , kResolvePendingForwardRef ,
  kNewContextlessMetaMap , kNewContextfulMetaMap , kIndirectPointerPrefix , kInitializeSelfIndirectPointer ,
  kAllocateJSDispatchEntry , kJSDispatchEntry , kProtectedPointerPrefix , kRootArrayConstants = 0x40 ,
  kFixedRawData = 0x60 , kFixedRepeatRoot = 0x80 , kHotObject = 0x90
}
 
template<Bytecode bytecode>
using SpaceEncoder
 
using NewObject = SpaceEncoder<kNewObject>
 
using FixedRawDataWithSize
 
using FixedRepeatRootWithCount
 
using RootArrayConstant
 
using HotObject = BytecodeValueEncoder<kHotObject, 0, kHotObjectCount - 1>
 

Protected Member Functions

V8_INLINE bool IsNotMappedSymbol (Tagged< HeapObject > obj) const
 
void SerializeDeferredObjects ()
 
void SerializeObject (Handle< HeapObject > o, SlotType slot_type)
 
virtual void SerializeObjectImpl (Handle< HeapObject > o, SlotType slot_type)=0
 
virtual bool MustBeDeferred (Tagged< HeapObject > object)
 
void VisitRootPointers (Root root, const char *description, FullObjectSlot start, FullObjectSlot end) override
 
void SerializeRootObject (FullObjectSlot slot)
 
void PutRoot (RootIndex root_index)
 
void PutSmiRoot (FullObjectSlot slot)
 
void PutBackReference (Tagged< HeapObject > object, SerializerReference reference)
 
void PutAttachedReference (SerializerReference reference)
 
void PutNextChunk (SnapshotSpace space)
 
void PutRepeatRoot (int repeat_count, RootIndex root_index)
 
void PutPendingForwardReference (PendingObjectReferences &ref)
 
void ResolvePendingForwardReference (int obj)
 
bool SerializeRoot (Tagged< HeapObject > obj)
 
bool SerializeHotObject (Tagged< HeapObject > obj)
 
bool SerializeBackReference (Tagged< HeapObject > obj)
 
bool SerializePendingObject (Tagged< HeapObject > obj)
 
bool ObjectIsBytecodeHandler (Tagged< HeapObject > obj) const
 
ExternalReferenceEncoder::Value EncodeExternalReference (Address addr)
 
Maybe< ExternalReferenceEncoder::ValueTryEncodeExternalReference (Address addr)
 
bool SerializeReadOnlyObjectReference (Tagged< HeapObject > obj, SnapshotByteSink *sink)
 
void Pad (int padding_offset=0)
 
void InitializeCodeAddressMap ()
 
Tagged< InstructionStreamCopyCode (Tagged< InstructionStream > istream)
 
void QueueDeferredObject (Tagged< HeapObject > obj)
 
void RegisterObjectIsPending (Tagged< HeapObject > obj)
 
void ResolvePendingObject (Tagged< HeapObject > obj)
 
void OutputStatistics (const char *name)
 
void CountAllocation (Tagged< Map > map, int size, SnapshotSpace space)
 
SerializerReferenceMapreference_map ()
 
const RootIndexMaproot_index_map () const
 
bool allow_unknown_external_references_for_testing () const
 
bool allow_active_isolate_for_testing () const
 
bool reconstruct_read_only_and_shared_object_caches_for_testing () const
 
bool deferred_objects_empty ()
 
bool serializer_tracks_serialization_statistics () const
 
void set_serializer_tracks_serialization_statistics (bool v)
 
- Protected Member Functions inherited from v8::internal::SerializerDeserializer
void RestoreExternalReferenceRedirector (Isolate *isolate, Tagged< AccessorInfo > accessor_info)
 
void RestoreExternalReferenceRedirector (Isolate *isolate, Tagged< FunctionTemplateInfo > function_template_info)
 

Protected Attributes

SnapshotByteSink sink_
 

Private Attributes

Isolateisolate_
 
HotObjectsList hot_objects_
 
SerializerReferenceMap reference_map_
 
ExternalReferenceEncoder external_reference_encoder_
 
RootIndexMap root_index_map_
 
std::unique_ptr< CodeAddressMapcode_address_map_
 
std::vector< uint8_t > code_buffer_
 
GlobalHandleVector< HeapObjectdeferred_objects_
 
int num_back_refs_ = 0
 
std::unordered_map< JSDispatchHandle, uint32_t > dispatch_handle_map_
 
int next_forward_ref_id_ = 0
 
int unresolved_forward_refs_ = 0
 
IdentityMap< PendingObjectReferences, base::DefaultAllocationPolicyforward_refs_per_pending_object_
 
uint32_t seen_backing_stores_index_ = 1
 
int recursion_depth_ = 0
 
const Snapshot::SerializerFlags flags_
 
bool serializer_tracks_serialization_statistics_ = true
 
size_t allocation_size_ [kNumberOfSnapshotSpaces] = {0}
 

Additional Inherited Members

- Static Public Member Functions inherited from v8::internal::SerializerDeserializer
static void IterateStartupObjectCache (Isolate *isolate, RootVisitor *visitor)
 
static void IterateSharedHeapObjectCache (Isolate *isolate, RootVisitor *visitor)
 
- Static Public Member Functions inherited from v8::internal::RootVisitor
static const char * RootName (Root root)
 
- Static Protected Member Functions inherited from v8::internal::SerializerDeserializer
static bool CanBeDeferred (Tagged< HeapObject > o, SlotType slot_type)
 
- Static Protected Attributes inherited from v8::internal::SerializerDeserializer
static const int kRootArrayConstantsCount = 0x20
 
static const int kFixedRawDataCount = 0x20
 
static const int kFixedRepeatRootCount = 0x10
 
static const int kHotObjectCount = 8
 
static const int kDoubleAlignmentSentinel = 0
 
static const int kFirstEncodableFixedRawDataSize = 1
 
static const int kLastEncodableFixedRawDataSize
 
static const int kFirstEncodableRepeatRootCount = 2
 
static const int kLastEncodableFixedRepeatRootCount
 
static const int kFirstEncodableVariableRepeatRootCount
 
static const uint32_t kEmptyBackingStoreRefSentinel = 0
 

Detailed Description

Definition at line 182 of file serializer.h.

Member Typedef Documentation

◆ PendingObjectReferences

using v8::internal::Serializer::PendingObjectReferences = std::vector<int>*
protected

Definition at line 210 of file serializer.h.

Constructor & Destructor Documentation

◆ Serializer() [1/2]

v8::internal::Serializer::Serializer ( Isolate * isolate,
Snapshot::SerializerFlags flags )

Definition at line 34 of file serializer.cc.

◆ ~Serializer()

v8::internal::Serializer::~Serializer ( )
inlineoverride

Definition at line 185 of file serializer.h.

◆ Serializer() [2/2]

v8::internal::Serializer::Serializer ( const Serializer & )
delete

Member Function Documentation

◆ allow_active_isolate_for_testing()

bool v8::internal::Serializer::allow_active_isolate_for_testing ( ) const
inlineprotected

Definition at line 328 of file serializer.h.

Here is the caller graph for this function:

◆ allow_unknown_external_references_for_testing()

bool v8::internal::Serializer::allow_unknown_external_references_for_testing ( ) const
inlineprotected

Definition at line 325 of file serializer.h.

◆ cage_base()

PtrComprCageBase v8::internal::Serializer::cage_base ( ) const
inline

Definition at line 199 of file serializer.h.

Here is the caller graph for this function:

◆ CopyCode()

Tagged< InstructionStream > v8::internal::Serializer::CopyCode ( Tagged< InstructionStream > istream)
protected

Definition at line 441 of file serializer.cc.

Here is the call graph for this function:

◆ CountAllocation()

void v8::internal::Serializer::CountAllocation ( Tagged< Map > map,
int size,
SnapshotSpace space )
protected

Definition at line 67 of file serializer.cc.

Here is the caller graph for this function:

◆ deferred_objects_empty()

bool v8::internal::Serializer::deferred_objects_empty ( )
inlineprotected

Definition at line 337 of file serializer.h.

◆ EncodeExternalReference()

ExternalReferenceEncoder::Value v8::internal::Serializer::EncodeExternalReference ( Address addr)
protected

Definition at line 374 of file serializer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitializeCodeAddressMap()

void v8::internal::Serializer::InitializeCodeAddressMap ( )
protected

Definition at line 436 of file serializer.cc.

Here is the caller graph for this function:

◆ IsNotMappedSymbol()

bool v8::internal::Serializer::IsNotMappedSymbol ( Tagged< HeapObject > obj) const
protected

Definition at line 16 of file serializer-inl.h.

Here is the call graph for this function:

◆ isolate()

Isolate * v8::internal::Serializer::isolate ( ) const
inline

Definition at line 195 of file serializer.h.

Here is the caller graph for this function:

◆ MustBeDeferred()

bool v8::internal::Serializer::MustBeDeferred ( Tagged< HeapObject > object)
protectedvirtual

Definition at line 181 of file serializer.cc.

◆ ObjectIsBytecodeHandler()

bool v8::internal::Serializer::ObjectIsBytecodeHandler ( Tagged< HeapObject > obj) const
protected

Definition at line 274 of file serializer.cc.

Here is the caller graph for this function:

◆ operator=()

Serializer & v8::internal::Serializer::operator= ( const Serializer & )
delete

◆ OutputStatistics()

void v8::internal::Serializer::OutputStatistics ( const char * name)
protected

Definition at line 105 of file serializer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pad()

void v8::internal::Serializer::Pad ( int padding_offset = 0)
protected

Definition at line 424 of file serializer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Payload()

const std::vector< uint8_t > * v8::internal::Serializer::Payload ( ) const
inline

Definition at line 189 of file serializer.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PutAttachedReference()

void v8::internal::Serializer::PutAttachedReference ( SerializerReference reference)
protected

Definition at line 328 of file serializer.cc.

Here is the call graph for this function:

◆ PutBackReference()

void v8::internal::Serializer::PutBackReference ( Tagged< HeapObject > object,
SerializerReference reference )
protected

Definition at line 321 of file serializer.cc.

Here is the call graph for this function:

◆ PutNextChunk()

void v8::internal::Serializer::PutNextChunk ( SnapshotSpace space)
protected

◆ PutPendingForwardReference()

void v8::internal::Serializer::PutPendingForwardReference ( PendingObjectReferences & ref)
protected

Definition at line 347 of file serializer.cc.

◆ PutRepeatRoot()

void v8::internal::Serializer::PutRepeatRoot ( int repeat_count,
RootIndex root_index )
protected

Definition at line 334 of file serializer.cc.

◆ PutRoot()

void v8::internal::Serializer::PutRoot ( RootIndex root_index)
protected

Definition at line 279 of file serializer.cc.

Here is the call graph for this function:

◆ PutSmiRoot()

void v8::internal::Serializer::PutSmiRoot ( FullObjectSlot slot)
protected

Definition at line 305 of file serializer.cc.

◆ QueueDeferredObject()

void v8::internal::Serializer::QueueDeferredObject ( Tagged< HeapObject > obj)
inlineprotected

Definition at line 296 of file serializer.h.

Here is the call graph for this function:

◆ reconstruct_read_only_and_shared_object_caches_for_testing()

bool v8::internal::Serializer::reconstruct_read_only_and_shared_object_caches_for_testing ( ) const
inlineprotected

Definition at line 332 of file serializer.h.

Here is the caller graph for this function:

◆ reference_map()

SerializerReferenceMap * v8::internal::Serializer::reference_map ( )
inlineprotected

Definition at line 320 of file serializer.h.

Here is the caller graph for this function:

◆ ReferenceMapContains()

bool v8::internal::Serializer::ReferenceMapContains ( DirectHandle< HeapObject > o)
inline

Definition at line 191 of file serializer.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RegisterObjectIsPending()

void v8::internal::Serializer::RegisterObjectIsPending ( Tagged< HeapObject > obj)
protected

Definition at line 391 of file serializer.cc.

◆ ResolvePendingForwardReference()

void v8::internal::Serializer::ResolvePendingForwardReference ( int obj)
protected

Definition at line 362 of file serializer.cc.

◆ ResolvePendingObject()

void v8::internal::Serializer::ResolvePendingObject ( Tagged< HeapObject > obj)
protected

Definition at line 408 of file serializer.cc.

◆ root_index_map()

const RootIndexMap * v8::internal::Serializer::root_index_map ( ) const
inlineprotected

Definition at line 321 of file serializer.h.

Here is the caller graph for this function:

◆ SerializeBackReference()

bool v8::internal::Serializer::SerializeBackReference ( Tagged< HeapObject > obj)
protected

Definition at line 236 of file serializer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SerializeDeferredObjects()

void v8::internal::Serializer::SerializeDeferredObjects ( )
protected

Definition at line 148 of file serializer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SerializeHotObject()

bool v8::internal::Serializer::SerializeHotObject ( Tagged< HeapObject > obj)
protected

Definition at line 221 of file serializer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SerializeObject()

void v8::internal::Serializer::SerializeObject ( Handle< HeapObject > o,
SlotType slot_type )
protected

Definition at line 161 of file serializer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SerializeObjectImpl()

virtual void v8::internal::Serializer::SerializeObjectImpl ( Handle< HeapObject > o,
SlotType slot_type )
protectedpure virtual

◆ SerializePendingObject()

bool v8::internal::Serializer::SerializePendingObject ( Tagged< HeapObject > obj)
protected

Definition at line 264 of file serializer.cc.

◆ serializer_tracks_serialization_statistics()

bool v8::internal::Serializer::serializer_tracks_serialization_statistics ( ) const
inlineprotected

Definition at line 340 of file serializer.h.

◆ SerializeReadOnlyObjectReference()

bool v8::internal::Serializer::SerializeReadOnlyObjectReference ( Tagged< HeapObject > obj,
SnapshotByteSink * sink )
protected

Definition at line 1462 of file serializer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SerializeRoot()

bool v8::internal::Serializer::SerializeRoot ( Tagged< HeapObject > obj)
protected

Definition at line 210 of file serializer.cc.

Here is the caller graph for this function:

◆ SerializeRootObject()

void v8::internal::Serializer::SerializeRootObject ( FullObjectSlot slot)
protected

Definition at line 190 of file serializer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_serializer_tracks_serialization_statistics()

void v8::internal::Serializer::set_serializer_tracks_serialization_statistics ( bool v)
inlineprotected

Definition at line 343 of file serializer.h.

◆ TotalAllocationSize()

int v8::internal::Serializer::TotalAllocationSize ( ) const

Definition at line 80 of file serializer.cc.

Here is the caller graph for this function:

◆ TryEncodeExternalReference()

Maybe< ExternalReferenceEncoder::Value > v8::internal::Serializer::TryEncodeExternalReference ( Address addr)
inlineprotected

Definition at line 278 of file serializer.h.

Here is the call graph for this function:

◆ VisitRootPointers()

void v8::internal::Serializer::VisitRootPointers ( Root root,
const char * description,
FullObjectSlot start,
FullObjectSlot end )
overrideprotectedvirtual

Implements v8::internal::RootVisitor.

Definition at line 183 of file serializer.cc.

Here is the caller graph for this function:

Member Data Documentation

◆ allocation_size_

size_t v8::internal::Serializer::allocation_size_[kNumberOfSnapshotSpaces] = {0}
private

Definition at line 438 of file serializer.h.

◆ code_address_map_

std::unique_ptr<CodeAddressMap> v8::internal::Serializer::code_address_map_
private

Definition at line 402 of file serializer.h.

◆ code_buffer_

std::vector<uint8_t> v8::internal::Serializer::code_buffer_
private

Definition at line 403 of file serializer.h.

◆ deferred_objects_

GlobalHandleVector<HeapObject> v8::internal::Serializer::deferred_objects_
private

Definition at line 405 of file serializer.h.

◆ dispatch_handle_map_

std::unordered_map<JSDispatchHandle, uint32_t> v8::internal::Serializer::dispatch_handle_map_
private

Definition at line 409 of file serializer.h.

◆ external_reference_encoder_

ExternalReferenceEncoder v8::internal::Serializer::external_reference_encoder_
private

Definition at line 400 of file serializer.h.

◆ flags_

const Snapshot::SerializerFlags v8::internal::Serializer::flags_
private

Definition at line 435 of file serializer.h.

◆ forward_refs_per_pending_object_

IdentityMap<PendingObjectReferences, base::DefaultAllocationPolicy> v8::internal::Serializer::forward_refs_per_pending_object_
private

Definition at line 425 of file serializer.h.

◆ hot_objects_

HotObjectsList v8::internal::Serializer::hot_objects_
private

Definition at line 398 of file serializer.h.

◆ isolate_

Isolate* v8::internal::Serializer::isolate_
private

Definition at line 394 of file serializer.h.

◆ next_forward_ref_id_

int v8::internal::Serializer::next_forward_ref_id_ = 0
private

Definition at line 422 of file serializer.h.

◆ num_back_refs_

int v8::internal::Serializer::num_back_refs_ = 0
private

Definition at line 406 of file serializer.h.

◆ recursion_depth_

int v8::internal::Serializer::recursion_depth_ = 0
private

Definition at line 434 of file serializer.h.

◆ reference_map_

SerializerReferenceMap v8::internal::Serializer::reference_map_
private

Definition at line 399 of file serializer.h.

◆ root_index_map_

RootIndexMap v8::internal::Serializer::root_index_map_
private

Definition at line 401 of file serializer.h.

◆ seen_backing_stores_index_

uint32_t v8::internal::Serializer::seen_backing_stores_index_ = 1
private

Definition at line 432 of file serializer.h.

◆ serializer_tracks_serialization_statistics_

bool v8::internal::Serializer::serializer_tracks_serialization_statistics_ = true
private

Definition at line 437 of file serializer.h.

◆ sink_

SnapshotByteSink v8::internal::Serializer::sink_
protected

Definition at line 323 of file serializer.h.

◆ unresolved_forward_refs_

int v8::internal::Serializer::unresolved_forward_refs_ = 0
private

Definition at line 423 of file serializer.h.


The documentation for this class was generated from the following files: