| Index: src/snapshot-external.cc
|
| diff --git a/src/snapshot-external.cc b/src/snapshot-external.cc
|
| index b75e232295096aa124a537b4aa1d0fb4e8f16734..75f5caa858636b50c1c8bc8ed34702b538f5658e 100644
|
| --- a/src/snapshot-external.cc
|
| +++ b/src/snapshot-external.cc
|
| @@ -18,25 +18,8 @@ struct SnapshotImpl {
|
| public:
|
| const byte* data;
|
| int size;
|
| - int new_space_used;
|
| - int pointer_space_used;
|
| - int data_space_used;
|
| - int code_space_used;
|
| - int map_space_used;
|
| - int cell_space_used;
|
| - int property_cell_space_used;
|
| - int lo_space_used;
|
| -
|
| const byte* context_data;
|
| int context_size;
|
| - int context_new_space_used;
|
| - int context_pointer_space_used;
|
| - int context_data_space_used;
|
| - int context_code_space_used;
|
| - int context_map_space_used;
|
| - int context_cell_space_used;
|
| - int context_property_cell_space_used;
|
| - int context_lo_space_used;
|
| };
|
|
|
|
|
| @@ -49,25 +32,14 @@ bool Snapshot::HaveASnapshotToStartFrom() {
|
|
|
|
|
| bool Snapshot::Initialize(Isolate* isolate) {
|
| - if (!HaveASnapshotToStartFrom())
|
| - return false;
|
| -
|
| + if (!HaveASnapshotToStartFrom()) return false;
|
| base::ElapsedTimer timer;
|
| - if (FLAG_profile_deserialization) {
|
| - timer.Start();
|
| - }
|
| - SnapshotByteSource source(snapshot_impl_->data, snapshot_impl_->size);
|
| - Deserializer deserializer(&source);
|
| - deserializer.AddReservation(NEW_SPACE, snapshot_impl_->new_space_used);
|
| - deserializer.AddReservation(OLD_POINTER_SPACE,
|
| - snapshot_impl_->pointer_space_used);
|
| - deserializer.AddReservation(OLD_DATA_SPACE, snapshot_impl_->data_space_used);
|
| - deserializer.AddReservation(CODE_SPACE, snapshot_impl_->code_space_used);
|
| - deserializer.AddReservation(MAP_SPACE, snapshot_impl_->map_space_used);
|
| - deserializer.AddReservation(CELL_SPACE, snapshot_impl_->cell_space_used);
|
| - deserializer.AddReservation(PROPERTY_CELL_SPACE,
|
| - snapshot_impl_->property_cell_space_used);
|
| - deserializer.AddReservation(LO_SPACE, snapshot_impl_->lo_space_used);
|
| + if (FLAG_profile_deserialization) timer.Start();
|
| +
|
| +
|
| + SerializedSnapshotData snapshot_data(snapshot_impl_->data,
|
| + snapshot_impl_->size);
|
| + Deserializer deserializer(&snapshot_data);
|
| bool success = isolate->Init(&deserializer);
|
| if (FLAG_profile_deserialization) {
|
| double ms = timer.Elapsed().InMillisecondsF();
|
| @@ -78,27 +50,11 @@ bool Snapshot::Initialize(Isolate* isolate) {
|
|
|
|
|
| Handle<Context> Snapshot::NewContextFromSnapshot(Isolate* isolate) {
|
| - if (!HaveASnapshotToStartFrom())
|
| - return Handle<Context>();
|
| -
|
| - SnapshotByteSource source(snapshot_impl_->context_data,
|
| - snapshot_impl_->context_size);
|
| - Deserializer deserializer(&source);
|
| - deserializer.AddReservation(NEW_SPACE,
|
| - snapshot_impl_->context_new_space_used);
|
| - deserializer.AddReservation(OLD_POINTER_SPACE,
|
| - snapshot_impl_->context_pointer_space_used);
|
| - deserializer.AddReservation(OLD_DATA_SPACE,
|
| - snapshot_impl_->context_data_space_used);
|
| - deserializer.AddReservation(CODE_SPACE,
|
| - snapshot_impl_->context_code_space_used);
|
| - deserializer.AddReservation(MAP_SPACE,
|
| - snapshot_impl_->context_map_space_used);
|
| - deserializer.AddReservation(CELL_SPACE,
|
| - snapshot_impl_->context_cell_space_used);
|
| - deserializer.AddReservation(PROPERTY_CELL_SPACE,
|
| - snapshot_impl_->context_property_cell_space_used);
|
| - deserializer.AddReservation(LO_SPACE, snapshot_impl_->context_lo_space_used);
|
| + if (!HaveASnapshotToStartFrom()) return Handle<Context>();
|
| +
|
| + SerializedSnapshotData snapshot_data(snapshot_impl_->context_data,
|
| + snapshot_impl_->context_size);
|
| + Deserializer deserializer(&snapshot_data);
|
| Object* root;
|
| deserializer.DeserializePartial(isolate, &root);
|
| CHECK(root->IsContext());
|
| @@ -115,29 +71,10 @@ void SetSnapshotFromFile(StartupData* snapshot_blob) {
|
| snapshot_impl_ = new SnapshotImpl;
|
| SnapshotByteSource source(reinterpret_cast<const byte*>(snapshot_blob->data),
|
| snapshot_blob->raw_size);
|
| -
|
| bool success = source.GetBlob(&snapshot_impl_->data,
|
| &snapshot_impl_->size);
|
| - snapshot_impl_->new_space_used = source.GetInt();
|
| - snapshot_impl_->pointer_space_used = source.GetInt();
|
| - snapshot_impl_->data_space_used = source.GetInt();
|
| - snapshot_impl_->code_space_used = source.GetInt();
|
| - snapshot_impl_->map_space_used = source.GetInt();
|
| - snapshot_impl_->cell_space_used = source.GetInt();
|
| - snapshot_impl_->property_cell_space_used = source.GetInt();
|
| - snapshot_impl_->lo_space_used = source.GetInt();
|
| -
|
| success &= source.GetBlob(&snapshot_impl_->context_data,
|
| &snapshot_impl_->context_size);
|
| - snapshot_impl_->context_new_space_used = source.GetInt();
|
| - snapshot_impl_->context_pointer_space_used = source.GetInt();
|
| - snapshot_impl_->context_data_space_used = source.GetInt();
|
| - snapshot_impl_->context_code_space_used = source.GetInt();
|
| - snapshot_impl_->context_map_space_used = source.GetInt();
|
| - snapshot_impl_->context_cell_space_used = source.GetInt();
|
| - snapshot_impl_->context_property_cell_space_used = source.GetInt();
|
| - snapshot_impl_->context_lo_space_used = source.GetInt();
|
| -
|
| DCHECK(success);
|
| }
|
|
|
|
|