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

#include <code-serializer.h>

Inheritance diagram for v8::internal::CodeSerializer:
Collaboration diagram for v8::internal::CodeSerializer:

Classes

struct  OffThreadDeserializeData
 

Public Member Functions

 CodeSerializer (const CodeSerializer &)=delete
 
CodeSerializeroperator= (const CodeSerializer &)=delete
 
AlignedCachedDataSerializeSharedFunctionInfo (Handle< SharedFunctionInfo > info)
 
uint32_t source_hash () 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
 

Static Public Member Functions

static V8_EXPORT_PRIVATE ScriptCompiler::CachedDataSerialize (Isolate *isolate, Handle< SharedFunctionInfo > info)
 
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< SharedFunctionInfoDeserialize (Isolate *isolate, AlignedCachedData *cached_data, DirectHandle< String > source, const ScriptDetails &script_details, MaybeDirectHandle< Script > maybe_cached_script={})
 
static V8_WARN_UNUSED_RESULT OffThreadDeserializeData StartDeserializeOffThread (LocalIsolate *isolate, AlignedCachedData *cached_data)
 
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< SharedFunctionInfoFinishOffThreadDeserialize (Isolate *isolate, OffThreadDeserializeData &&data, AlignedCachedData *cached_data, DirectHandle< String > source, const ScriptDetails &script_details, BackgroundMergeTask *background_merge_task=nullptr)
 
- 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 Member Functions

 CodeSerializer (Isolate *isolate, uint32_t source_hash)
 
 ~CodeSerializer () override
 
void SerializeGeneric (Handle< HeapObject > heap_object, SlotType slot_type)
 
- 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)
 

Private Member Functions

void SerializeObjectImpl (Handle< HeapObject > o, SlotType slot_type) override
 

Private Attributes

uint32_t source_hash_
 

Additional Inherited Members

- 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>
 
- 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 60 of file code-serializer.h.

Constructor & Destructor Documentation

◆ CodeSerializer() [1/2]

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

◆ CodeSerializer() [2/2]

v8::internal::CodeSerializer::CodeSerializer ( Isolate * isolate,
uint32_t source_hash )
protected

Definition at line 45 of file code-serializer.cc.

◆ ~CodeSerializer()

v8::internal::CodeSerializer::~CodeSerializer ( )
inlineoverrideprotected

Definition at line 103 of file code-serializer.h.

Here is the call graph for this function:

Member Function Documentation

◆ Deserialize()

MaybeDirectHandle< SharedFunctionInfo > v8::internal::CodeSerializer::Deserialize ( Isolate * isolate,
AlignedCachedData * cached_data,
DirectHandle< String > source,
const ScriptDetails & script_details,
MaybeDirectHandle< Script > maybe_cached_script = {} )
static

Definition at line 481 of file code-serializer.cc.

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

◆ FinishOffThreadDeserialize()

MaybeDirectHandle< SharedFunctionInfo > v8::internal::CodeSerializer::FinishOffThreadDeserialize ( Isolate * isolate,
OffThreadDeserializeData && data,
AlignedCachedData * cached_data,
DirectHandle< String > source,
const ScriptDetails & script_details,
BackgroundMergeTask * background_merge_task = nullptr )
static

Definition at line 610 of file code-serializer.cc.

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

◆ operator=()

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

◆ Serialize()

ScriptCompiler::CachedData * v8::internal::CodeSerializer::Serialize ( Isolate * isolate,
Handle< SharedFunctionInfo > info )
static

Definition at line 50 of file code-serializer.cc.

Here is the call graph for this function:

◆ SerializeGeneric()

void v8::internal::CodeSerializer::SerializeGeneric ( Handle< HeapObject > heap_object,
SlotType slot_type )
protected

Definition at line 281 of file code-serializer.cc.

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

◆ SerializeObjectImpl()

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

Definition at line 120 of file code-serializer.cc.

Here is the call graph for this function:

◆ SerializeSharedFunctionInfo()

AlignedCachedData * v8::internal::CodeSerializer::SerializeSharedFunctionInfo ( Handle< SharedFunctionInfo > info)

Definition at line 106 of file code-serializer.cc.

Here is the call graph for this function:

◆ source_hash()

uint32_t v8::internal::CodeSerializer::source_hash ( ) const
inline

Definition at line 99 of file code-serializer.h.

Here is the caller graph for this function:

◆ StartDeserializeOffThread()

CodeSerializer::OffThreadDeserializeData v8::internal::CodeSerializer::StartDeserializeOffThread ( LocalIsolate * isolate,
AlignedCachedData * cached_data )
static

Definition at line 582 of file code-serializer.cc.

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

Member Data Documentation

◆ source_hash_

uint32_t v8::internal::CodeSerializer::source_hash_
private

Definition at line 111 of file code-serializer.h.


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