V8 Project
v8::internal::Snapshot Class Reference

#include <snapshot.h>

+ Collaboration diagram for v8::internal::Snapshot:

Static Public Member Functions

static bool Initialize (Isolate *isolate)
 
static bool HaveASnapshotToStartFrom ()
 
static Handle< ContextNewContextFromSnapshot (Isolate *isolate)
 
static const bytedata ()
 
static int size ()
 
static int raw_size ()
 
static void set_raw_data (const byte *raw_data)
 
static const bytecontext_data ()
 
static int context_size ()
 
static int context_raw_size ()
 
static void set_context_raw_data (const byte *context_raw_data)
 

Private Member Functions

 DISALLOW_IMPLICIT_CONSTRUCTORS (Snapshot)
 

Static Private Member Functions

static void ReserveSpaceForLinkedInSnapshot (Deserializer *deserializer)
 

Static Private Attributes

static const byte data_ [] = { 0 }
 
static const byteraw_data_ = NULL
 
static const byte context_data_ [] = { 0 }
 
static const bytecontext_raw_data_ = NULL
 
static const int new_space_used_ = 0
 
static const int pointer_space_used_ = 0
 
static const int data_space_used_ = 0
 
static const int code_space_used_ = 0
 
static const int map_space_used_ = 0
 
static const int cell_space_used_ = 0
 
static const int property_cell_space_used_ = 0
 
static const int lo_space_used_ = 0
 
static const int context_new_space_used_ = 0
 
static const int context_pointer_space_used_ = 0
 
static const int context_data_space_used_ = 0
 
static const int context_code_space_used_ = 0
 
static const int context_map_space_used_ = 0
 
static const int context_cell_space_used_ = 0
 
static const int context_property_cell_space_used_ = 0
 
static const int context_lo_space_used_ = 0
 
static const int size_ = 0
 
static const int raw_size_ = 0
 
static const int context_size_ = 0
 
static const int context_raw_size_ = 0
 

Detailed Description

Definition at line 13 of file snapshot.h.

Member Function Documentation

◆ context_data()

static const byte* v8::internal::Snapshot::context_data ( )
inlinestatic

Definition at line 31 of file snapshot.h.

31 { return context_data_; }
static const byte context_data_[]
Definition: snapshot.h:42

References context_data_.

Referenced by v8::V8::GetCompressedStartupData().

+ Here is the caller graph for this function:

◆ context_raw_size()

static int v8::internal::Snapshot::context_raw_size ( )
inlinestatic

Definition at line 33 of file snapshot.h.

33 { return context_raw_size_; }
static const int context_raw_size_
Definition: snapshot.h:63

References context_raw_size_.

Referenced by v8::V8::GetCompressedStartupData(), and v8::V8::SetDecompressedStartupData().

+ Here is the caller graph for this function:

◆ context_size()

static int v8::internal::Snapshot::context_size ( )
inlinestatic

Definition at line 32 of file snapshot.h.

32 { return context_size_; }
static const int context_size_
Definition: snapshot.h:62

References context_size_.

Referenced by v8::V8::GetCompressedStartupData().

+ Here is the caller graph for this function:

◆ data()

static const byte* v8::internal::Snapshot::data ( )
inlinestatic

Definition at line 25 of file snapshot.h.

25 { return data_; }
static const byte data_[]
Definition: snapshot.h:40

References data_.

Referenced by v8::V8::GetCompressedStartupData().

+ Here is the caller graph for this function:

◆ DISALLOW_IMPLICIT_CONSTRUCTORS()

v8::internal::Snapshot::DISALLOW_IMPLICIT_CONSTRUCTORS ( Snapshot  )
private

◆ HaveASnapshotToStartFrom()

bool v8::internal::Snapshot::HaveASnapshotToStartFrom ( )
static

Definition at line 49 of file snapshot-common.cc.

49  {
50  return size_ != 0;
51 }
static const int size_
Definition: snapshot.h:60

References size_.

Referenced by v8::internal::Heap::ConfigureHeap(), and v8::internal::FullCodeGenerator::Initialize().

+ Here is the caller graph for this function:

◆ Initialize()

bool v8::internal::Snapshot::Initialize ( Isolate isolate)
static

Definition at line 29 of file snapshot-common.cc.

29  {
30  if (size_ > 0) {
31  base::ElapsedTimer timer;
32  if (FLAG_profile_deserialization) {
33  timer.Start();
34  }
35  SnapshotByteSource source(raw_data_, raw_size_);
36  Deserializer deserializer(&source);
37  ReserveSpaceForLinkedInSnapshot(&deserializer);
38  bool success = isolate->Init(&deserializer);
39  if (FLAG_profile_deserialization) {
40  double ms = timer.Elapsed().InMillisecondsF();
41  PrintF("[Snapshot loading and deserialization took %0.3f ms]\n", ms);
42  }
43  return success;
44  }
45  return false;
46 }
static const int raw_size_
Definition: snapshot.h:61
static void ReserveSpaceForLinkedInSnapshot(Deserializer *deserializer)
static const byte * raw_data_
Definition: snapshot.h:41
void PrintF(const char *format,...)
Definition: utils.cc:80

References v8::internal::Isolate::Init(), v8::internal::PrintF(), raw_data_, raw_size_, ReserveSpaceForLinkedInSnapshot(), and size_.

Referenced by v8::Isolate::New().

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

◆ NewContextFromSnapshot()

Handle< Context > v8::internal::Snapshot::NewContextFromSnapshot ( Isolate isolate)
static

Definition at line 54 of file snapshot-common.cc.

54  {
55  if (context_size_ == 0) {
56  return Handle<Context>();
57  }
58  SnapshotByteSource source(context_raw_data_,
60  Deserializer deserializer(&source);
61  Object* root;
62  deserializer.set_reservation(NEW_SPACE, context_new_space_used_);
63  deserializer.set_reservation(OLD_POINTER_SPACE, context_pointer_space_used_);
64  deserializer.set_reservation(OLD_DATA_SPACE, context_data_space_used_);
65  deserializer.set_reservation(CODE_SPACE, context_code_space_used_);
66  deserializer.set_reservation(MAP_SPACE, context_map_space_used_);
67  deserializer.set_reservation(CELL_SPACE, context_cell_space_used_);
68  deserializer.set_reservation(PROPERTY_CELL_SPACE,
70  deserializer.set_reservation(LO_SPACE, context_lo_space_used_);
71  deserializer.DeserializePartial(isolate, &root);
72  CHECK(root->IsContext());
73  return Handle<Context>(Context::cast(root));
74 }
static Context * cast(Object *context)
Definition: contexts.h:255
static const int context_map_space_used_
Definition: snapshot.h:56
static const int context_data_space_used_
Definition: snapshot.h:54
static const int context_property_cell_space_used_
Definition: snapshot.h:58
static const byte * context_raw_data_
Definition: snapshot.h:43
static const int context_new_space_used_
Definition: snapshot.h:52
static const int context_lo_space_used_
Definition: snapshot.h:59
static const int context_code_space_used_
Definition: snapshot.h:55
static const int context_cell_space_used_
Definition: snapshot.h:57
static const int context_pointer_space_used_
Definition: snapshot.h:53
#define CHECK(condition)
Definition: logging.h:36
kSerializedDataOffset Object
Definition: objects-inl.h:5322
@ OLD_DATA_SPACE
Definition: globals.h:361
@ PROPERTY_CELL_SPACE
Definition: globals.h:365
@ OLD_POINTER_SPACE
Definition: globals.h:360

References v8::internal::Context::cast(), v8::internal::CELL_SPACE, CHECK, v8::internal::CODE_SPACE, context_cell_space_used_, context_code_space_used_, context_data_space_used_, context_lo_space_used_, context_map_space_used_, context_new_space_used_, context_pointer_space_used_, context_property_cell_space_used_, context_raw_data_, context_raw_size_, context_size_, v8::internal::Deserializer::DeserializePartial(), v8::internal::LO_SPACE, v8::internal::MAP_SPACE, v8::internal::NEW_SPACE, v8::internal::OLD_DATA_SPACE, v8::internal::OLD_POINTER_SPACE, v8::internal::PROPERTY_CELL_SPACE, and v8::internal::Deserializer::set_reservation().

+ Here is the call graph for this function:

◆ raw_size()

static int v8::internal::Snapshot::raw_size ( )
inlinestatic

Definition at line 27 of file snapshot.h.

27 { return raw_size_; }

References raw_size_.

Referenced by v8::V8::GetCompressedStartupData(), and v8::V8::SetDecompressedStartupData().

+ Here is the caller graph for this function:

◆ ReserveSpaceForLinkedInSnapshot()

void v8::internal::Snapshot::ReserveSpaceForLinkedInSnapshot ( Deserializer deserializer)
staticprivate

Definition at line 17 of file snapshot-common.cc.

17  {
18  deserializer->set_reservation(NEW_SPACE, new_space_used_);
19  deserializer->set_reservation(OLD_POINTER_SPACE, pointer_space_used_);
20  deserializer->set_reservation(OLD_DATA_SPACE, data_space_used_);
21  deserializer->set_reservation(CODE_SPACE, code_space_used_);
22  deserializer->set_reservation(MAP_SPACE, map_space_used_);
23  deserializer->set_reservation(CELL_SPACE, cell_space_used_);
24  deserializer->set_reservation(PROPERTY_CELL_SPACE, property_cell_space_used_);
25  deserializer->set_reservation(LO_SPACE, lo_space_used_);
26 }
static const int pointer_space_used_
Definition: snapshot.h:45
static const int cell_space_used_
Definition: snapshot.h:49
static const int data_space_used_
Definition: snapshot.h:46
static const int lo_space_used_
Definition: snapshot.h:51
static const int map_space_used_
Definition: snapshot.h:48
static const int code_space_used_
Definition: snapshot.h:47
static const int new_space_used_
Definition: snapshot.h:44
static const int property_cell_space_used_
Definition: snapshot.h:50

References v8::internal::CELL_SPACE, cell_space_used_, v8::internal::CODE_SPACE, code_space_used_, data_space_used_, v8::internal::LO_SPACE, lo_space_used_, v8::internal::MAP_SPACE, map_space_used_, v8::internal::NEW_SPACE, new_space_used_, v8::internal::OLD_DATA_SPACE, v8::internal::OLD_POINTER_SPACE, pointer_space_used_, v8::internal::PROPERTY_CELL_SPACE, property_cell_space_used_, and v8::internal::Deserializer::set_reservation().

Referenced by Initialize().

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

◆ set_context_raw_data()

static void v8::internal::Snapshot::set_context_raw_data ( const byte context_raw_data)
inlinestatic

Definition at line 34 of file snapshot.h.

35  {
36  context_raw_data_ = context_raw_data;
37  }

References context_raw_data_.

Referenced by v8::V8::SetDecompressedStartupData().

+ Here is the caller graph for this function:

◆ set_raw_data()

static void v8::internal::Snapshot::set_raw_data ( const byte raw_data)
inlinestatic

Definition at line 28 of file snapshot.h.

28  {
29  raw_data_ = raw_data;
30  }

References raw_data_.

Referenced by v8::V8::SetDecompressedStartupData().

+ Here is the caller graph for this function:

◆ size()

static int v8::internal::Snapshot::size ( )
inlinestatic

Definition at line 26 of file snapshot.h.

26 { return size_; }

References size_.

Referenced by v8::V8::GetCompressedStartupData().

+ Here is the caller graph for this function:

Member Data Documentation

◆ cell_space_used_

const int v8::internal::Snapshot::cell_space_used_ = 0
staticprivate

Definition at line 49 of file snapshot.h.

Referenced by ReserveSpaceForLinkedInSnapshot().

◆ code_space_used_

const int v8::internal::Snapshot::code_space_used_ = 0
staticprivate

Definition at line 47 of file snapshot.h.

Referenced by ReserveSpaceForLinkedInSnapshot().

◆ context_cell_space_used_

const int v8::internal::Snapshot::context_cell_space_used_ = 0
staticprivate

Definition at line 57 of file snapshot.h.

Referenced by NewContextFromSnapshot().

◆ context_code_space_used_

const int v8::internal::Snapshot::context_code_space_used_ = 0
staticprivate

Definition at line 55 of file snapshot.h.

Referenced by NewContextFromSnapshot().

◆ context_data_

const byte v8::internal::Snapshot::context_data_ = { 0 }
staticprivate

Definition at line 42 of file snapshot.h.

Referenced by context_data().

◆ context_data_space_used_

const int v8::internal::Snapshot::context_data_space_used_ = 0
staticprivate

Definition at line 54 of file snapshot.h.

Referenced by NewContextFromSnapshot().

◆ context_lo_space_used_

const int v8::internal::Snapshot::context_lo_space_used_ = 0
staticprivate

Definition at line 59 of file snapshot.h.

Referenced by NewContextFromSnapshot().

◆ context_map_space_used_

const int v8::internal::Snapshot::context_map_space_used_ = 0
staticprivate

Definition at line 56 of file snapshot.h.

Referenced by NewContextFromSnapshot().

◆ context_new_space_used_

const int v8::internal::Snapshot::context_new_space_used_ = 0
staticprivate

Definition at line 52 of file snapshot.h.

Referenced by NewContextFromSnapshot().

◆ context_pointer_space_used_

const int v8::internal::Snapshot::context_pointer_space_used_ = 0
staticprivate

Definition at line 53 of file snapshot.h.

Referenced by NewContextFromSnapshot().

◆ context_property_cell_space_used_

const int v8::internal::Snapshot::context_property_cell_space_used_ = 0
staticprivate

Definition at line 58 of file snapshot.h.

Referenced by NewContextFromSnapshot().

◆ context_raw_data_

const byte * v8::internal::Snapshot::context_raw_data_ = NULL
staticprivate

Definition at line 43 of file snapshot.h.

Referenced by NewContextFromSnapshot(), and set_context_raw_data().

◆ context_raw_size_

const int v8::internal::Snapshot::context_raw_size_ = 0
staticprivate

Definition at line 63 of file snapshot.h.

Referenced by context_raw_size(), and NewContextFromSnapshot().

◆ context_size_

const int v8::internal::Snapshot::context_size_ = 0
staticprivate

Definition at line 62 of file snapshot.h.

Referenced by context_size(), and NewContextFromSnapshot().

◆ data_

const byte v8::internal::Snapshot::data_ = { 0 }
staticprivate

Definition at line 40 of file snapshot.h.

Referenced by data().

◆ data_space_used_

const int v8::internal::Snapshot::data_space_used_ = 0
staticprivate

Definition at line 46 of file snapshot.h.

Referenced by ReserveSpaceForLinkedInSnapshot().

◆ lo_space_used_

const int v8::internal::Snapshot::lo_space_used_ = 0
staticprivate

Definition at line 51 of file snapshot.h.

Referenced by ReserveSpaceForLinkedInSnapshot().

◆ map_space_used_

const int v8::internal::Snapshot::map_space_used_ = 0
staticprivate

Definition at line 48 of file snapshot.h.

Referenced by ReserveSpaceForLinkedInSnapshot().

◆ new_space_used_

const int v8::internal::Snapshot::new_space_used_ = 0
staticprivate

Definition at line 44 of file snapshot.h.

Referenced by ReserveSpaceForLinkedInSnapshot().

◆ pointer_space_used_

const int v8::internal::Snapshot::pointer_space_used_ = 0
staticprivate

Definition at line 45 of file snapshot.h.

Referenced by ReserveSpaceForLinkedInSnapshot().

◆ property_cell_space_used_

const int v8::internal::Snapshot::property_cell_space_used_ = 0
staticprivate

Definition at line 50 of file snapshot.h.

Referenced by ReserveSpaceForLinkedInSnapshot().

◆ raw_data_

const byte * v8::internal::Snapshot::raw_data_ = NULL
staticprivate

Definition at line 41 of file snapshot.h.

Referenced by Initialize(), and set_raw_data().

◆ raw_size_

const int v8::internal::Snapshot::raw_size_ = 0
staticprivate

Definition at line 61 of file snapshot.h.

Referenced by Initialize(), and raw_size().

◆ size_

const int v8::internal::Snapshot::size_ = 0
staticprivate

Definition at line 60 of file snapshot.h.

Referenced by HaveASnapshotToStartFrom(), Initialize(), and size().


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