V8 Project
v8::internal::StartupSerializer Class Reference

#include <serialize.h>

+ Inheritance diagram for v8::internal::StartupSerializer:
+ Collaboration diagram for v8::internal::StartupSerializer:

Public Member Functions

 StartupSerializer (Isolate *isolate, SnapshotByteSink *sink)
 
virtual void SerializeStrongReferences ()
 
virtual void SerializeObject (Object *o, HowToCode how_to_code, WhereToPoint where_to_point, int skip)
 
void SerializeWeakReferences ()
 
void Serialize ()
 
- Public Member Functions inherited from v8::internal::Serializer
 Serializer (Isolate *isolate, SnapshotByteSink *sink)
 
 ~Serializer ()
 
void VisitPointers (Object **start, Object **end)
 
int CurrentAllocationAddress (int space) const
 
Isolateisolate () const
 
SerializationAddressMapperaddress_mapper ()
 
void PutRoot (int index, HeapObject *object, HowToCode how, WhereToPoint where, int skip)
 

Private Member Functions

 DISALLOW_COPY_AND_ASSIGN (StartupSerializer)
 

Additional Inherited Members

- Static Public Member Functions inherited from v8::internal::SerializerDeserializer
static void Iterate (Isolate *isolate, ObjectVisitor *visitor)
 
static int nop ()
 
- Static Public Attributes inherited from v8::internal::SerializerDeserializer
static const int kNumberOfPreallocatedSpaces = LO_SPACE
 
static const int kNumberOfSpaces = INVALID_SPACE
 
- Protected Types inherited from v8::internal::SerializerDeserializer
enum  Where {
  kNewObject = 0 , kRootArray = 0x9 , kPartialSnapshotCache = 0xa , kExternalReference = 0xb ,
  kSkip = 0xc , kBuiltin = 0xd , kAttachedReference = 0xe , kNop = 0xf ,
  kBackref = 0x10 , kBackrefWithSkip = 0x18 , kPointedToMask = 0x3f
}
 
enum  HowToCode { kPlain = 0 , kFromCode = 0x40 , kHowToCodeMask = 0x40 }
 
enum  WithSkip { kNoSkipDistance = 0 , kHasSkipDistance = 0x40 , kWithSkipMask = 0x40 }
 
enum  WhereToPoint { kStartOfObject = 0 , kInnerPointer = 0x80 , kWhereToPointMask = 0x80 }
 
- Protected Member Functions inherited from v8::internal::Serializer
int RootIndex (HeapObject *heap_object, HowToCode from)
 
intptr_t root_index_wave_front ()
 
void set_root_index_wave_front (intptr_t value)
 
void SerializeReferenceToPreviousObject (HeapObject *heap_object, HowToCode how_to_code, WhereToPoint where_to_point, int skip)
 
void InitializeAllocators ()
 
int AllocateLargeObject (int size)
 
int Allocate (int space, int size)
 
int EncodeExternalReference (Address addr)
 
int SpaceAreaSize (int space)
 
bool ShouldBeSkipped (Object **current)
 
void Pad ()
 
void InitializeCodeAddressMap ()
 
- Protected Member Functions inherited from v8::internal::SerializerDeserializer
 STATIC_ASSERT (kNumberOfSpaces<=kSpaceMask+1)
 
- Static Protected Member Functions inherited from v8::internal::Serializer
static int SpaceOfObject (HeapObject *object)
 
- Static Protected Member Functions inherited from v8::internal::SerializerDeserializer
static int CodeForRepeats (int repeats)
 
static int RepeatsForCode (int byte_code)
 
static int RootArrayConstantFromByteCode (int byte_code)
 
- Protected Attributes inherited from v8::internal::Serializer
Isolateisolate_
 
int fullness_ [kNumberOfSpaces]
 
SnapshotByteSinksink_
 
ExternalReferenceEncoderexternal_reference_encoder_
 
SerializationAddressMapper address_mapper_
 
intptr_t root_index_wave_front_
 
- Static Protected Attributes inherited from v8::internal::Serializer
static const int kInvalidRootIndex = -1
 
- Static Protected Attributes inherited from v8::internal::SerializerDeserializer
static const int kRawData = 0x20
 
static const int kSynchronize = 0x70
 
static const int kNativesStringResource = 0x71
 
static const int kRepeat = 0x72
 
static const int kConstantRepeat = 0x73
 
static const int kMaxRepeats = 0x7f - 0x72
 
static const int kRootArrayConstants = 0xa0
 
static const int kRootArrayNumberOfConstantEncodings = 0x20
 
static const int kAnyOldSpace = -1
 
static const int kSpaceMask = 7
 

Detailed Description

Definition at line 546 of file serialize.h.

Constructor & Destructor Documentation

◆ StartupSerializer()

v8::internal::StartupSerializer::StartupSerializer ( Isolate isolate,
SnapshotByteSink sink 
)
inline

Definition at line 548 of file serialize.h.

549  : Serializer(isolate, sink) {
550  // Clear the cache of objects used by the partial snapshot. After the
551  // strong roots have been serialized we can create a partial snapshot
552  // which will repopulate the cache with objects needed by that partial
553  // snapshot.
554  isolate->set_serialize_partial_snapshot_cache_length(0);
556  }
Serializer(Isolate *isolate, SnapshotByteSink *sink)
Definition: serialize.cc:1214
Isolate * isolate() const
Definition: serialize.h:390

References v8::internal::Serializer::InitializeCodeAddressMap(), and v8::internal::Serializer::isolate().

+ Here is the call graph for this function:

Member Function Documentation

◆ DISALLOW_COPY_AND_ASSIGN()

v8::internal::StartupSerializer::DISALLOW_COPY_AND_ASSIGN ( StartupSerializer  )
private

◆ Serialize()

void v8::internal::StartupSerializer::Serialize ( )
inline

Definition at line 567 of file serialize.h.

567  {
570  Pad();
571  }
virtual void SerializeStrongReferences()
Definition: serialize.cc:1233

References v8::internal::Serializer::Pad(), SerializeStrongReferences(), and SerializeWeakReferences().

+ Here is the call graph for this function:

◆ SerializeObject()

void v8::internal::StartupSerializer::SerializeObject ( Object o,
HowToCode  how_to_code,
WhereToPoint  where_to_point,
int  skip 
)
virtual

Implements v8::internal::Serializer.

Definition at line 1380 of file serialize.cc.

1384  {
1385  CHECK(o->IsHeapObject());
1386  HeapObject* heap_object = HeapObject::cast(o);
1387  DCHECK(!heap_object->IsJSFunction());
1388 
1389  int root_index;
1390  if ((root_index = RootIndex(heap_object, how_to_code)) != kInvalidRootIndex) {
1391  PutRoot(root_index, heap_object, how_to_code, where_to_point, skip);
1392  return;
1393  }
1394 
1395  if (address_mapper_.IsMapped(heap_object)) {
1396  SerializeReferenceToPreviousObject(heap_object, how_to_code, where_to_point,
1397  skip);
1398  } else {
1399  if (skip != 0) {
1400  sink_->Put(kSkip, "FlushPendingSkip");
1401  sink_->PutInt(skip, "SkipDistance");
1402  }
1403 
1404  // Object has not yet been serialized. Serialize it here.
1405  ObjectSerializer object_serializer(this,
1406  heap_object,
1407  sink_,
1408  how_to_code,
1409  where_to_point);
1410  object_serializer.Serialize();
1411  }
1412 }
friend class ObjectSerializer
Definition: serialize.h:492
void SerializeReferenceToPreviousObject(HeapObject *heap_object, HowToCode how_to_code, WhereToPoint where_to_point, int skip)
Definition: serialize.cc:1353
int RootIndex(HeapObject *heap_object, HowToCode from)
Definition: serialize.cc:1336
SnapshotByteSink * sink_
Definition: serialize.h:485
static const int kInvalidRootIndex
Definition: serialize.h:400
SerializationAddressMapper address_mapper_
Definition: serialize.h:488
void PutRoot(int index, HeapObject *object, HowToCode how, WhereToPoint where, int skip)
Definition: serialize.cc:1428
virtual void Put(byte b, const char *description)=0
void PutInt(uintptr_t integer, const char *description)
#define CHECK(condition)
Definition: logging.h:36
#define DCHECK(condition)
Definition: logging.h:205

References v8::internal::Serializer::address_mapper_, CHECK, DCHECK, v8::internal::SerializationAddressMapper::IsMapped(), v8::internal::Serializer::kInvalidRootIndex, v8::internal::SerializerDeserializer::kSkip, v8::internal::SnapshotByteSink::Put(), v8::internal::SnapshotByteSink::PutInt(), v8::internal::Serializer::PutRoot(), v8::internal::Serializer::RootIndex(), v8::internal::Serializer::ObjectSerializer::Serialize(), v8::internal::Serializer::SerializeReferenceToPreviousObject(), and v8::internal::Serializer::sink_.

+ Here is the call graph for this function:

◆ SerializeStrongReferences()

void v8::internal::StartupSerializer::SerializeStrongReferences ( )
virtual

Definition at line 1233 of file serialize.cc.

1233  {
1234  Isolate* isolate = this->isolate();
1235  // No active threads.
1236  CHECK_EQ(NULL, isolate->thread_manager()->FirstThreadStateInUse());
1237  // No active or weak handles.
1238  CHECK(isolate->handle_scope_implementer()->blocks()->is_empty());
1241  // We don't support serializing installed extensions.
1243  isolate->heap()->IterateSmiRoots(this);
1245 }
List< internal::Object ** > * blocks()
Definition: api.h:537
void IterateSmiRoots(ObjectVisitor *v)
Definition: heap.cc:4739
void IterateStrongRoots(ObjectVisitor *v, VisitMode mode)
Definition: heap.cc:4747
bool has_installed_extensions()
Definition: isolate.h:953
HandleScopeImplementer * handle_scope_implementer()
Definition: isolate.h:901
EternalHandles * eternal_handles()
Definition: isolate.h:919
GlobalHandles * global_handles()
Definition: isolate.h:917
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define CHECK_EQ(expected, value)
Definition: logging.h:169
@ VISIT_ONLY_STRONG
Definition: globals.h:397

References v8::internal::HandleScopeImplementer::blocks(), CHECK, CHECK_EQ, v8::internal::Isolate::eternal_handles(), v8::internal::ThreadManager::FirstThreadStateInUse(), v8::internal::Isolate::global_handles(), v8::internal::Isolate::handle_scope_implementer(), v8::internal::Isolate::has_installed_extensions(), v8::internal::Isolate::heap(), v8::internal::Serializer::isolate(), v8::internal::Heap::IterateSmiRoots(), v8::internal::Heap::IterateStrongRoots(), NULL, v8::internal::EternalHandles::NumberOfHandles(), v8::internal::GlobalHandles::NumberOfWeakHandles(), v8::internal::Isolate::thread_manager(), and v8::internal::VISIT_ONLY_STRONG.

Referenced by main(), and Serialize().

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

◆ SerializeWeakReferences()

void v8::internal::StartupSerializer::SerializeWeakReferences ( )

Definition at line 1415 of file serialize.cc.

1415  {
1416  // This phase comes right after the partial serialization (of the snapshot).
1417  // After we have done the partial serialization the partial snapshot cache
1418  // will contain some references needed to decode the partial snapshot. We
1419  // add one entry with 'undefined' which is the sentinel that the deserializer
1420  // uses to know it is done deserializing the array.
1421  Object* undefined = isolate()->heap()->undefined_value();
1422  VisitPointer(&undefined);
1423  isolate()->heap()->IterateWeakRoots(this, VISIT_ALL);
1424  Pad();
1425 }
void IterateWeakRoots(ObjectVisitor *v, VisitMode mode)
Definition: heap.cc:4728
kSerializedDataOffset Object
Definition: objects-inl.h:5322

References v8::internal::Isolate::heap(), v8::internal::Serializer::isolate(), v8::internal::Heap::IterateWeakRoots(), v8::internal::Serializer::Pad(), and v8::internal::VISIT_ALL.

Referenced by main(), and Serialize().

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

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