V8 Project
v8::internal::SerializerDeserializer Class Reference

#include <serialize.h>

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

Static Public Member Functions

static void Iterate (Isolate *isolate, ObjectVisitor *visitor)
 
static int nop ()
 

Static Public Attributes

static const int kNumberOfPreallocatedSpaces = LO_SPACE
 
static const int kNumberOfSpaces = INVALID_SPACE
 

Protected Types

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

 STATIC_ASSERT (kNumberOfSpaces<=kSpaceMask+1)
 

Static Protected Member Functions

static int CodeForRepeats (int repeats)
 
static int RepeatsForCode (int byte_code)
 
static int RootArrayConstantFromByteCode (int byte_code)
 

Static Protected Attributes

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 145 of file serialize.h.

Member Enumeration Documentation

◆ HowToCode

Enumerator
kPlain 
kFromCode 
kHowToCodeMask 

Definition at line 176 of file serialize.h.

176  {
177  kPlain = 0, // Straight pointer.
178  // What this means depends on the architecture:
179  kFromCode = 0x40, // A pointer inlined in code.
180  kHowToCodeMask = 0x40
181  };

◆ Where

Enumerator
kNewObject 
kRootArray 
kPartialSnapshotCache 
kExternalReference 
kSkip 
kBuiltin 
kAttachedReference 
kNop 
kBackref 
kBackrefWithSkip 
kPointedToMask 

Definition at line 157 of file serialize.h.

157  {
158  kNewObject = 0, // Object is next in snapshot.
159  // 1-7 One per space.
160  kRootArray = 0x9, // Object is found in root array.
161  kPartialSnapshotCache = 0xa, // Object is in the cache.
162  kExternalReference = 0xb, // Pointer to an external reference.
163  kSkip = 0xc, // Skip n bytes.
164  kBuiltin = 0xd, // Builtin code object.
165  kAttachedReference = 0xe, // Object is described in an attached list.
166  kNop = 0xf, // Does nothing, used to pad.
167  kBackref = 0x10, // Object is described relative to end.
168  // 0x11-0x17 One per space.
169  kBackrefWithSkip = 0x18, // Object is described relative to end.
170  // 0x19-0x1f One per space.
171  // 0x20-0x3f Used by misc. tags below.
172  kPointedToMask = 0x3f
173  };

◆ WhereToPoint

Enumerator
kStartOfObject 
kInnerPointer 
kWhereToPointMask 

Definition at line 191 of file serialize.h.

191  {
192  kStartOfObject = 0,
193  kInnerPointer = 0x80, // First insn in code object or payload of cell.
194  kWhereToPointMask = 0x80
195  };

◆ WithSkip

Enumerator
kNoSkipDistance 
kHasSkipDistance 
kWithSkipMask 

Definition at line 184 of file serialize.h.

Member Function Documentation

◆ CodeForRepeats()

static int v8::internal::SerializerDeserializer::CodeForRepeats ( int  repeats)
inlinestaticprotected

Definition at line 217 of file serialize.h.

217  {
218  DCHECK(repeats >= 1 && repeats <= kMaxRepeats);
219  return 0x72 + repeats;
220  }
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK, and kMaxRepeats.

Referenced by v8::internal::Serializer::ObjectSerializer::VisitPointers().

+ Here is the caller graph for this function:

◆ Iterate()

void v8::internal::SerializerDeserializer::Iterate ( Isolate isolate,
ObjectVisitor visitor 
)
static

Definition at line 1293 of file serialize.cc.

1294  {
1295  if (isolate->serializer_enabled()) return;
1296  for (int i = 0; ; i++) {
1297  if (isolate->serialize_partial_snapshot_cache_length() <= i) {
1298  // Extend the array ready to get a value from the visitor when
1299  // deserializing.
1300  isolate->PushToPartialSnapshotCache(Smi::FromInt(0));
1301  }
1302  Object** cache = isolate->serialize_partial_snapshot_cache();
1303  visitor->VisitPointers(&cache[i], &cache[i + 1]);
1304  // Sentinel is the undefined object, which is a root so it will not normally
1305  // be found in the cache.
1306  if (cache[i] == isolate->heap()->undefined_value()) {
1307  break;
1308  }
1309  }
1310 }
static Smi * FromInt(int value)
Definition: objects-inl.h:1321
kSerializedDataOffset Object
Definition: objects-inl.h:5322

References v8::internal::Smi::FromInt(), v8::internal::Isolate::heap(), v8::internal::Isolate::PushToPartialSnapshotCache(), and v8::internal::Isolate::serializer_enabled().

Referenced by v8::internal::Heap::IterateStrongRoots().

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

◆ nop()

static int v8::internal::SerializerDeserializer::nop ( )
inlinestatic

Definition at line 149 of file serialize.h.

149 { return kNop; }

References kNop.

◆ RepeatsForCode()

static int v8::internal::SerializerDeserializer::RepeatsForCode ( int  byte_code)
inlinestaticprotected

Definition at line 221 of file serialize.h.

221  {
222  DCHECK(byte_code >= kConstantRepeat && byte_code <= 0x7f);
223  return byte_code - 0x72;
224  }

References DCHECK, and kConstantRepeat.

Referenced by v8::internal::Deserializer::ReadChunk().

+ Here is the caller graph for this function:

◆ RootArrayConstantFromByteCode()

static int v8::internal::SerializerDeserializer::RootArrayConstantFromByteCode ( int  byte_code)
inlinestaticprotected

Definition at line 228 of file serialize.h.

228  {
229  return byte_code & 0x1f;
230  }

Referenced by v8::internal::Deserializer::ReadChunk().

+ Here is the caller graph for this function:

◆ STATIC_ASSERT()

v8::internal::SerializerDeserializer::STATIC_ASSERT ( kNumberOfSpaces<=kSpaceMask 1)
protected

Referenced by v8::internal::CodeSerializer::Deserialize(), and v8::internal::Deserializer::ReadChunk().

+ Here is the caller graph for this function:

Member Data Documentation

◆ kAnyOldSpace

const int v8::internal::SerializerDeserializer::kAnyOldSpace = -1
staticprotected

Definition at line 232 of file serialize.h.

◆ kConstantRepeat

const int v8::internal::SerializerDeserializer::kConstantRepeat = 0x73
staticprotected

Definition at line 214 of file serialize.h.

Referenced by v8::internal::Deserializer::ReadChunk(), and RepeatsForCode().

◆ kMaxRepeats

const int v8::internal::SerializerDeserializer::kMaxRepeats = 0x7f - 0x72
staticprotected

◆ kNativesStringResource

const int v8::internal::SerializerDeserializer::kNativesStringResource = 0x71
staticprotected

◆ kNumberOfPreallocatedSpaces

const int v8::internal::SerializerDeserializer::kNumberOfPreallocatedSpaces = LO_SPACE
static

◆ kNumberOfSpaces

◆ kRawData

const int v8::internal::SerializerDeserializer::kRawData = 0x20
staticprotected

◆ kRepeat

const int v8::internal::SerializerDeserializer::kRepeat = 0x72
staticprotected

◆ kRootArrayConstants

const int v8::internal::SerializerDeserializer::kRootArrayConstants = 0xa0
staticprotected

◆ kRootArrayNumberOfConstantEncodings

const int v8::internal::SerializerDeserializer::kRootArrayNumberOfConstantEncodings = 0x20
staticprotected

◆ kSpaceMask

const int v8::internal::SerializerDeserializer::kSpaceMask = 7
staticprotected

Definition at line 235 of file serialize.h.

◆ kSynchronize

const int v8::internal::SerializerDeserializer::kSynchronize = 0x70
staticprotected

Definition at line 209 of file serialize.h.

Referenced by v8::internal::Deserializer::ReadChunk().


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