V8 Project
v8::internal::SnapshotByteSink Class Referenceabstract

Sink to write snapshot files to. More...

#include <snapshot-source-sink.h>

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

Public Member Functions

virtual ~SnapshotByteSink ()
 
virtual void Put (byte b, const char *description)=0
 
virtual void PutSection (int b, const char *description)
 
void PutInt (uintptr_t integer, const char *description)
 
void PutRaw (byte *data, int number_of_bytes, const char *description)
 
void PutBlob (byte *data, int number_of_bytes, const char *description)
 
virtual int Position ()=0
 

Detailed Description

Sink to write snapshot files to.

Subclasses must implement actual storage or i/o.

Definition at line 71 of file snapshot-source-sink.h.

Constructor & Destructor Documentation

◆ ~SnapshotByteSink()

virtual v8::internal::SnapshotByteSink::~SnapshotByteSink ( )
inlinevirtual

Definition at line 73 of file snapshot-source-sink.h.

73 { }

Member Function Documentation

◆ Position()

virtual int v8::internal::SnapshotByteSink::Position ( )
pure virtual

Implemented in v8::internal::ListSnapshotSink, v8::internal::DebugSnapshotSink, and v8::internal::DummySnapshotSink.

Referenced by v8::internal::DebugSnapshotSink::Position(), and v8::internal::Serializer::ObjectSerializer::Serialize().

+ Here is the caller graph for this function:

◆ Put()

◆ PutBlob()

void v8::internal::SnapshotByteSink::PutBlob ( byte data,
int  number_of_bytes,
const char *  description 
)

Definition at line 62 of file snapshot-source-sink.cc.

63  {
64  PutInt(number_of_bytes, description);
65  PutRaw(data, number_of_bytes, description);
66 }
void PutRaw(byte *data, int number_of_bytes, const char *description)
void PutInt(uintptr_t integer, const char *description)

Referenced by SnapshotWriter::MaybeWriteStartupBlob().

+ Here is the caller graph for this function:

◆ PutInt()

void v8::internal::SnapshotByteSink::PutInt ( uintptr_t  integer,
const char *  description 
)

Definition at line 41 of file snapshot-source-sink.cc.

41  {
42  DCHECK(integer < 1 << 30);
43  integer <<= 2;
44  int bytes = 1;
45  if (integer > 0xff) bytes = 2;
46  if (integer > 0xffff) bytes = 3;
47  if (integer > 0xffffff) bytes = 4;
48  integer |= (bytes - 1);
49  Put(static_cast<int>(integer & 0xff), "IntPart1");
50  if (bytes > 1) Put(static_cast<int>((integer >> 8) & 0xff), "IntPart2");
51  if (bytes > 2) Put(static_cast<int>((integer >> 16) & 0xff), "IntPart3");
52  if (bytes > 3) Put(static_cast<int>((integer >> 24) & 0xff), "IntPart4");
53 }
virtual void Put(byte b, const char *description)=0
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK.

Referenced by SnapshotWriter::MaybeWriteStartupBlob(), v8::internal::Serializer::ObjectSerializer::OutputRawData(), v8::internal::Serializer::PutRoot(), v8::internal::Serializer::ObjectSerializer::Serialize(), v8::internal::CodeSerializer::SerializeBuiltin(), v8::internal::CodeSerializer::SerializeCodeStub(), v8::internal::PartialSerializer::SerializeObject(), v8::internal::StartupSerializer::SerializeObject(), v8::internal::CodeSerializer::SerializeObject(), v8::internal::Serializer::SerializeReferenceToPreviousObject(), v8::internal::CodeSerializer::SerializeSourceObject(), v8::internal::Serializer::ObjectSerializer::VisitExternalReference(), v8::internal::Serializer::VisitPointers(), v8::internal::Serializer::ObjectSerializer::VisitPointers(), and v8::internal::Serializer::ObjectSerializer::VisitRuntimeEntry().

+ Here is the caller graph for this function:

◆ PutRaw()

void v8::internal::SnapshotByteSink::PutRaw ( byte data,
int  number_of_bytes,
const char *  description 
)

Definition at line 55 of file snapshot-source-sink.cc.

56  {
57  for (int i = 0; i < number_of_bytes; ++i) {
58  Put(data[i], description);
59  }
60 }

◆ PutSection()

virtual void v8::internal::SnapshotByteSink::PutSection ( int  b,
const char *  description 
)
inlinevirtual

Definition at line 75 of file snapshot-source-sink.h.

75  {
76  DCHECK_LE(b, kMaxUInt8);
77  Put(static_cast<byte>(b), description);
78  }
#define DCHECK_LE(v1, v2)
Definition: logging.h:210
const int kMaxUInt8
Definition: globals.h:113

References DCHECK_LE, v8::internal::kMaxUInt8, and Put().

Referenced by v8::internal::Serializer::ObjectSerializer::OutputRawData(), and v8::internal::Serializer::ObjectSerializer::VisitExternalOneByteString().

+ 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: