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

#include <value-serializer.h>

Collaboration diagram for v8::internal::ValueSerializer:

Public Member Functions

 ValueSerializer (Isolate *isolate, v8::ValueSerializer::Delegate *delegate)
 
 ~ValueSerializer ()
 
 ValueSerializer (const ValueSerializer &)=delete
 
ValueSerializeroperator= (const ValueSerializer &)=delete
 
void WriteHeader ()
 
Maybe< boolWriteObject (DirectHandle< Object > object) V8_WARN_UNUSED_RESULT
 
std::pair< uint8_t *, size_tRelease ()
 
void TransferArrayBuffer (uint32_t transfer_id, DirectHandle< JSArrayBuffer > array_buffer)
 
void WriteUint32 (uint32_t value)
 
void WriteUint64 (uint64_t value)
 
void WriteRawBytes (const void *source, size_t length)
 
void WriteDouble (double value)
 
void WriteByte (uint8_t value)
 
void SetTreatArrayBufferViewsAsHostObjects (bool mode)
 

Private Member Functions

Maybe< boolExpandBuffer (size_t required_capacity)
 
void WriteTag (SerializationTag tag)
 
template<typename T >
void WriteVarint (T value)
 
template<typename T >
void WriteZigZag (T value)
 
void WriteOneByteString (base::Vector< const uint8_t > chars)
 
void WriteTwoByteString (base::Vector< const base::uc16 > chars)
 
void WriteBigIntContents (Tagged< BigInt > bigint)
 
Maybe< uint8_t * > ReserveRawBytes (size_t bytes)
 
void WriteOddball (Tagged< Oddball > oddball)
 
void WriteSmi (Tagged< Smi > smi)
 
void WriteHeapNumber (Tagged< HeapNumber > number)
 
void WriteBigInt (Tagged< BigInt > bigint)
 
void WriteString (DirectHandle< String > string)
 
Maybe< boolWriteJSReceiver (DirectHandle< JSReceiver > receiver) V8_WARN_UNUSED_RESULT
 
Maybe< boolWriteJSObject (DirectHandle< JSObject > object) V8_WARN_UNUSED_RESULT
 
Maybe< boolWriteJSObjectSlow (DirectHandle< JSObject > object) V8_WARN_UNUSED_RESULT
 
Maybe< boolWriteJSArray (DirectHandle< JSArray > array) V8_WARN_UNUSED_RESULT
 
void WriteJSDate (Tagged< JSDate > date)
 
Maybe< boolWriteJSPrimitiveWrapper (DirectHandle< JSPrimitiveWrapper > value) V8_WARN_UNUSED_RESULT
 
void WriteJSRegExp (DirectHandle< JSRegExp > regexp)
 
Maybe< boolWriteJSMap (DirectHandle< JSMap > map) V8_WARN_UNUSED_RESULT
 
Maybe< boolWriteJSSet (DirectHandle< JSSet > map) V8_WARN_UNUSED_RESULT
 
Maybe< boolWriteJSArrayBuffer (DirectHandle< JSArrayBuffer > array_buffer) V8_WARN_UNUSED_RESULT
 
Maybe< boolWriteJSArrayBufferView (Tagged< JSArrayBufferView > array_buffer)
 
Maybe< boolWriteJSError (DirectHandle< JSObject > error) V8_WARN_UNUSED_RESULT
 
Maybe< boolWriteJSSharedArray (DirectHandle< JSSharedArray > shared_array) V8_WARN_UNUSED_RESULT
 
Maybe< boolWriteJSSharedStruct (DirectHandle< JSSharedStruct > shared_struct) V8_WARN_UNUSED_RESULT
 
Maybe< boolWriteSharedObject (DirectHandle< HeapObject > object) V8_WARN_UNUSED_RESULT
 
Maybe< boolWriteHostObject (DirectHandle< JSObject > object) V8_WARN_UNUSED_RESULT
 
Maybe< uint32_t > WriteJSObjectPropertiesSlow (DirectHandle< JSObject > object, DirectHandle< FixedArray > keys) V8_WARN_UNUSED_RESULT
 
Maybe< boolIsHostObject (DirectHandle< JSObject > object)
 
V8_NOINLINE Maybe< boolThrowDataCloneError (MessageTemplate template_index) V8_WARN_UNUSED_RESULT
 
V8_NOINLINE Maybe< boolThrowDataCloneError (MessageTemplate template_index, DirectHandle< Object > arg0) V8_WARN_UNUSED_RESULT
 
Maybe< boolThrowIfOutOfMemory ()
 

Private Attributes

Isolate *const isolate_
 
v8::ValueSerializer::Delegate *const delegate_
 
uint8_t * buffer_ = nullptr
 
size_t buffer_size_ = 0
 
size_t buffer_capacity_ = 0
 
bool has_custom_host_objects_ = false
 
bool treat_array_buffer_views_as_host_objects_ = false
 
bool out_of_memory_ = false
 
Zone zone_
 
IdentityMap< uint32_t, ZoneAllocationPolicyid_map_
 
uint32_t next_id_ = 0
 
IdentityMap< uint32_t, ZoneAllocationPolicyarray_buffer_transfer_map_
 
SharedObjectConveyorHandlesshared_object_conveyor_ = nullptr
 

Detailed Description

Writes V8 objects in a binary format that allows the objects to be cloned according to the HTML structured clone algorithm.

Format is based on Blink's previous serialization logic.

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

Constructor & Destructor Documentation

◆ ValueSerializer() [1/2]

v8::internal::ValueSerializer::ValueSerializer ( Isolate * isolate,
v8::ValueSerializer::Delegate * delegate )

Definition at line 295 of file value-serializer.cc.

Here is the call graph for this function:

◆ ~ValueSerializer()

v8::internal::ValueSerializer::~ValueSerializer ( )

Definition at line 309 of file value-serializer.cc.

Here is the call graph for this function:

◆ ValueSerializer() [2/2]

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

Member Function Documentation

◆ ExpandBuffer()

Maybe< bool > v8::internal::ValueSerializer::ExpandBuffer ( size_t required_capacity)
private

Definition at line 414 of file value-serializer.cc.

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

◆ IsHostObject()

Maybe< bool > v8::internal::ValueSerializer::IsHostObject ( DirectHandle< JSObject > object)
private

Definition at line 1284 of file value-serializer.cc.

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

◆ operator=()

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

◆ Release()

std::pair< uint8_t *, size_t > v8::internal::ValueSerializer::Release ( )

Definition at line 453 of file value-serializer.cc.

Here is the caller graph for this function:

◆ ReserveRawBytes()

Maybe< uint8_t * > v8::internal::ValueSerializer::ReserveRawBytes ( size_t bytes)
private

Definition at line 401 of file value-serializer.cc.

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

◆ SetTreatArrayBufferViewsAsHostObjects()

void v8::internal::ValueSerializer::SetTreatArrayBufferViewsAsHostObjects ( bool mode)

Definition at line 324 of file value-serializer.cc.

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

◆ ThrowDataCloneError() [1/2]

Maybe< bool > v8::internal::ValueSerializer::ThrowDataCloneError ( MessageTemplate template_index)
private

Definition at line 1308 of file value-serializer.cc.

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

◆ ThrowDataCloneError() [2/2]

Maybe< bool > v8::internal::ValueSerializer::ThrowDataCloneError ( MessageTemplate template_index,
DirectHandle< Object > arg0 )
private

Definition at line 1314 of file value-serializer.cc.

Here is the call graph for this function:

◆ ThrowIfOutOfMemory()

Maybe< bool > v8::internal::ValueSerializer::ThrowIfOutOfMemory ( )
private

Definition at line 1301 of file value-serializer.cc.

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

◆ TransferArrayBuffer()

void v8::internal::ValueSerializer::TransferArrayBuffer ( uint32_t transfer_id,
DirectHandle< JSArrayBuffer > array_buffer )

Definition at line 461 of file value-serializer.cc.

Here is the caller graph for this function:

◆ WriteBigInt()

void v8::internal::ValueSerializer::WriteBigInt ( Tagged< BigInt > bigint)
private

Definition at line 554 of file value-serializer.cc.

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

◆ WriteBigIntContents()

void v8::internal::ValueSerializer::WriteBigIntContents ( Tagged< BigInt > bigint)
private

Definition at line 384 of file value-serializer.cc.

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

◆ WriteByte()

void v8::internal::ValueSerializer::WriteByte ( uint8_t value)

Definition at line 438 of file value-serializer.cc.

Here is the call graph for this function:

◆ WriteDouble()

void v8::internal::ValueSerializer::WriteDouble ( double value)
Here is the caller graph for this function:

◆ WriteHeader()

void v8::internal::ValueSerializer::WriteHeader ( )

Definition at line 319 of file value-serializer.cc.

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

◆ WriteHeapNumber()

void v8::internal::ValueSerializer::WriteHeapNumber ( Tagged< HeapNumber > number)
private

Definition at line 549 of file value-serializer.cc.

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

◆ WriteHostObject()

Maybe< bool > v8::internal::ValueSerializer::WriteHostObject ( DirectHandle< JSObject > object)
private

Definition at line 1241 of file value-serializer.cc.

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

◆ WriteJSArray()

Maybe< bool > v8::internal::ValueSerializer::WriteJSArray ( DirectHandle< JSArray > array)
private

Definition at line 738 of file value-serializer.cc.

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

◆ WriteJSArrayBuffer()

Maybe< bool > v8::internal::ValueSerializer::WriteJSArrayBuffer ( DirectHandle< JSArrayBuffer > array_buffer)
private

Definition at line 962 of file value-serializer.cc.

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

◆ WriteJSArrayBufferView()

Maybe< bool > v8::internal::ValueSerializer::WriteJSArrayBufferView ( Tagged< JSArrayBufferView > array_buffer)
private

Definition at line 1052 of file value-serializer.cc.

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

◆ WriteJSDate()

void v8::internal::ValueSerializer::WriteJSDate ( Tagged< JSDate > date)
private

Definition at line 854 of file value-serializer.cc.

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

◆ WriteJSError()

Maybe< bool > v8::internal::ValueSerializer::WriteJSError ( DirectHandle< JSObject > error)
private

Definition at line 1092 of file value-serializer.cc.

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

◆ WriteJSMap()

Maybe< bool > v8::internal::ValueSerializer::WriteJSMap ( DirectHandle< JSMap > map)
private

Definition at line 893 of file value-serializer.cc.

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

◆ WriteJSObject()

Maybe< bool > v8::internal::ValueSerializer::WriteJSObject ( DirectHandle< JSObject > object)
private

Definition at line 674 of file value-serializer.cc.

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

◆ WriteJSObjectPropertiesSlow()

Maybe< uint32_t > v8::internal::ValueSerializer::WriteJSObjectPropertiesSlow ( DirectHandle< JSObject > object,
DirectHandle< FixedArray > keys )
private

Definition at line 1258 of file value-serializer.cc.

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

◆ WriteJSObjectSlow()

Maybe< bool > v8::internal::ValueSerializer::WriteJSObjectSlow ( DirectHandle< JSObject > object)
private

Definition at line 723 of file value-serializer.cc.

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

◆ WriteJSPrimitiveWrapper()

Maybe< bool > v8::internal::ValueSerializer::WriteJSPrimitiveWrapper ( DirectHandle< JSPrimitiveWrapper > value)
private

Definition at line 859 of file value-serializer.cc.

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

◆ WriteJSReceiver()

Maybe< bool > v8::internal::ValueSerializer::WriteJSReceiver ( DirectHandle< JSReceiver > receiver)
private

Definition at line 581 of file value-serializer.cc.

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

◆ WriteJSRegExp()

void v8::internal::ValueSerializer::WriteJSRegExp ( DirectHandle< JSRegExp > regexp)
private

Definition at line 887 of file value-serializer.cc.

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

◆ WriteJSSet()

Maybe< bool > v8::internal::ValueSerializer::WriteJSSet ( DirectHandle< JSSet > map)
private

Definition at line 928 of file value-serializer.cc.

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

◆ WriteJSSharedArray()

Maybe< bool > v8::internal::ValueSerializer::WriteJSSharedArray ( DirectHandle< JSSharedArray > shared_array)
private

Definition at line 1170 of file value-serializer.cc.

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

◆ WriteJSSharedStruct()

Maybe< bool > v8::internal::ValueSerializer::WriteJSSharedStruct ( DirectHandle< JSSharedStruct > shared_struct)
private

Definition at line 1164 of file value-serializer.cc.

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

◆ WriteObject()

Maybe< bool > v8::internal::ValueSerializer::WriteObject ( DirectHandle< Object > object)

Definition at line 468 of file value-serializer.cc.

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

◆ WriteOddball()

void v8::internal::ValueSerializer::WriteOddball ( Tagged< Oddball > oddball)
private

Definition at line 522 of file value-serializer.cc.

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

◆ WriteOneByteString()

void v8::internal::ValueSerializer::WriteOneByteString ( base::Vector< const uint8_t > chars)
private

Definition at line 373 of file value-serializer.cc.

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

◆ WriteRawBytes()

void v8::internal::ValueSerializer::WriteRawBytes ( const void * source,
size_t length )

Definition at line 394 of file value-serializer.cc.

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

◆ WriteSharedObject()

Maybe< bool > v8::internal::ValueSerializer::WriteSharedObject ( DirectHandle< HeapObject > object)
private

Definition at line 1211 of file value-serializer.cc.

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

◆ WriteSmi()

void v8::internal::ValueSerializer::WriteSmi ( Tagged< Smi > smi)
private

Definition at line 543 of file value-serializer.cc.

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

◆ WriteString()

void v8::internal::ValueSerializer::WriteString ( DirectHandle< String > string)
private

Definition at line 559 of file value-serializer.cc.

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

◆ WriteTag()

void v8::internal::ValueSerializer::WriteTag ( SerializationTag tag)
private

Definition at line 328 of file value-serializer.cc.

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

◆ WriteTwoByteString()

void v8::internal::ValueSerializer::WriteTwoByteString ( base::Vector< const base::uc16 > chars)
private

Definition at line 378 of file value-serializer.cc.

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

◆ WriteUint32()

void v8::internal::ValueSerializer::WriteUint32 ( uint32_t value)

Definition at line 445 of file value-serializer.cc.

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

◆ WriteUint64()

void v8::internal::ValueSerializer::WriteUint64 ( uint64_t value)

Definition at line 449 of file value-serializer.cc.

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

◆ WriteVarint()

template<typename T >
void v8::internal::ValueSerializer::WriteVarint ( T value)
private

Definition at line 334 of file value-serializer.cc.

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

◆ WriteZigZag()

template<typename T >
void v8::internal::ValueSerializer::WriteZigZag ( T value)
private

Definition at line 353 of file value-serializer.cc.

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

Member Data Documentation

◆ array_buffer_transfer_map_

IdentityMap<uint32_t, ZoneAllocationPolicy> v8::internal::ValueSerializer::array_buffer_transfer_map_
private

Definition at line 193 of file value-serializer.h.

◆ buffer_

uint8_t* v8::internal::ValueSerializer::buffer_ = nullptr
private

Definition at line 178 of file value-serializer.h.

◆ buffer_capacity_

size_t v8::internal::ValueSerializer::buffer_capacity_ = 0
private

Definition at line 180 of file value-serializer.h.

◆ buffer_size_

size_t v8::internal::ValueSerializer::buffer_size_ = 0
private

Definition at line 179 of file value-serializer.h.

◆ delegate_

v8::ValueSerializer::Delegate* const v8::internal::ValueSerializer::delegate_
private

Definition at line 177 of file value-serializer.h.

◆ has_custom_host_objects_

bool v8::internal::ValueSerializer::has_custom_host_objects_ = false
private

Definition at line 181 of file value-serializer.h.

◆ id_map_

IdentityMap<uint32_t, ZoneAllocationPolicy> v8::internal::ValueSerializer::id_map_
private

Definition at line 189 of file value-serializer.h.

◆ isolate_

Isolate* const v8::internal::ValueSerializer::isolate_
private

Definition at line 176 of file value-serializer.h.

◆ next_id_

uint32_t v8::internal::ValueSerializer::next_id_ = 0
private

Definition at line 190 of file value-serializer.h.

◆ out_of_memory_

bool v8::internal::ValueSerializer::out_of_memory_ = false
private

Definition at line 183 of file value-serializer.h.

◆ shared_object_conveyor_

SharedObjectConveyorHandles* v8::internal::ValueSerializer::shared_object_conveyor_ = nullptr
private

Definition at line 196 of file value-serializer.h.

◆ treat_array_buffer_views_as_host_objects_

bool v8::internal::ValueSerializer::treat_array_buffer_views_as_host_objects_ = false
private

Definition at line 182 of file value-serializer.h.

◆ zone_

Zone v8::internal::ValueSerializer::zone_
private

Definition at line 184 of file value-serializer.h.


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