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

#include <context-serializer.h>

Inheritance diagram for v8::internal::ContextSerializer:
Collaboration diagram for v8::internal::ContextSerializer:

Public Member Functions

 ContextSerializer (Isolate *isolate, Snapshot::SerializerFlags flags, StartupSerializer *startup_serializer, SerializeEmbedderFieldsCallback callback)
 
 ~ContextSerializer () override
 
 ContextSerializer (const ContextSerializer &)=delete
 
ContextSerializeroperator= (const ContextSerializer &)=delete
 
void Serialize (Tagged< Context > *o, const DisallowGarbageCollection &no_gc)
 
bool can_be_rehashed () const
 
- Public Member Functions inherited from v8::internal::Serializer
 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
 

Private Member Functions

void SerializeObjectImpl (Handle< HeapObject > o, SlotType slot_type) override
 
bool ShouldBeInTheStartupObjectCache (Tagged< HeapObject > o)
 
bool ShouldBeInTheSharedObjectCache (Tagged< HeapObject > o)
 
void CheckRehashability (Tagged< HeapObject > obj)
 
template<typename V8Type , typename UserSerializerWrapper , typename UserCallback , typename ApiObjectType >
void SerializeObjectWithEmbedderFields (Handle< V8Type > data_holder, int embedder_fields_count, UserSerializerWrapper wrapper, UserCallback user_callback, ApiObjectType api_obj)
 
void SerializeApiWrapperFields (DirectHandle< JSObject > js_object)
 

Private Attributes

StartupSerializerstartup_serializer_
 
SerializeEmbedderFieldsCallback serialize_embedder_fields_
 
bool can_be_rehashed_
 
Tagged< Contextcontext_
 
SnapshotByteSink embedder_fields_sink_
 
SnapshotByteSink api_wrapper_sink_
 

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)
 
- Protected Types inherited from v8::internal::Serializer
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 inherited from v8::internal::Serializer
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)
 
- Static Protected Member Functions inherited from v8::internal::SerializerDeserializer
static bool CanBeDeferred (Tagged< HeapObject > o, SlotType slot_type)
 
- Protected Attributes inherited from v8::internal::Serializer
SnapshotByteSink sink_
 
- 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 17 of file context-serializer.h.

Constructor & Destructor Documentation

◆ ContextSerializer() [1/2]

v8::internal::ContextSerializer::ContextSerializer ( Isolate * isolate,
Snapshot::SerializerFlags flags,
StartupSerializer * startup_serializer,
SerializeEmbedderFieldsCallback callback )

Definition at line 67 of file context-serializer.cc.

Here is the call graph for this function:

◆ ~ContextSerializer()

v8::internal::ContextSerializer::~ContextSerializer ( )
override

Definition at line 78 of file context-serializer.cc.

Here is the call graph for this function:

◆ ContextSerializer() [2/2]

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

Member Function Documentation

◆ can_be_rehashed()

bool v8::internal::ContextSerializer::can_be_rehashed ( ) const
inline

Definition at line 30 of file context-serializer.h.

Here is the caller graph for this function:

◆ CheckRehashability()

void v8::internal::ContextSerializer::CheckRehashability ( Tagged< HeapObject > obj)
private

Definition at line 404 of file context-serializer.cc.

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

◆ operator=()

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

◆ Serialize()

void v8::internal::ContextSerializer::Serialize ( Tagged< Context > * o,
const DisallowGarbageCollection & no_gc )

Definition at line 82 of file context-serializer.cc.

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

◆ SerializeApiWrapperFields()

void v8::internal::ContextSerializer::SerializeApiWrapperFields ( DirectHandle< JSObject > js_object)
private

Definition at line 287 of file context-serializer.cc.

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

◆ SerializeObjectImpl()

void v8::internal::ContextSerializer::SerializeObjectImpl ( Handle< HeapObject > o,
SlotType slot_type )
overrideprivate

Definition at line 158 of file context-serializer.cc.

Here is the call graph for this function:

◆ SerializeObjectWithEmbedderFields()

template<typename V8Type , typename UserSerializerWrapper , typename UserCallback , typename ApiObjectType >
void v8::internal::ContextSerializer::SerializeObjectWithEmbedderFields ( Handle< V8Type > data_holder,
int embedder_fields_count,
UserSerializerWrapper wrapper,
UserCallback user_callback,
ApiObjectType api_obj )
private

Definition at line 318 of file context-serializer.cc.

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

◆ ShouldBeInTheSharedObjectCache()

bool v8::internal::ContextSerializer::ShouldBeInTheSharedObjectCache ( Tagged< HeapObject > o)
private

Definition at line 277 of file context-serializer.cc.

◆ ShouldBeInTheStartupObjectCache()

bool v8::internal::ContextSerializer::ShouldBeInTheStartupObjectCache ( Tagged< HeapObject > o)
private

Definition at line 266 of file context-serializer.cc.

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

Member Data Documentation

◆ api_wrapper_sink_

SnapshotByteSink v8::internal::ContextSerializer::api_wrapper_sink_
private

Definition at line 60 of file context-serializer.h.

◆ can_be_rehashed_

bool v8::internal::ContextSerializer::can_be_rehashed_
private

Definition at line 54 of file context-serializer.h.

◆ context_

Tagged<Context> v8::internal::ContextSerializer::context_
private

Definition at line 55 of file context-serializer.h.

◆ embedder_fields_sink_

SnapshotByteSink v8::internal::ContextSerializer::embedder_fields_sink_
private

Definition at line 58 of file context-serializer.h.

◆ serialize_embedder_fields_

SerializeEmbedderFieldsCallback v8::internal::ContextSerializer::serialize_embedder_fields_
private

Definition at line 51 of file context-serializer.h.

◆ startup_serializer_

StartupSerializer* v8::internal::ContextSerializer::startup_serializer_
private

Definition at line 50 of file context-serializer.h.


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