Index: src/snapshot-external.cc |
diff --git a/src/snapshot-external.cc b/src/snapshot-external.cc |
index 1e5aec9250600c643a5e78942714eda64490f790..b75e232295096aa124a537b4aa1d0fb4e8f16734 100644 |
--- a/src/snapshot-external.cc |
+++ b/src/snapshot-external.cc |
@@ -18,8 +18,25 @@ |
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; |
}; |
@@ -32,13 +49,25 @@ |
bool Snapshot::Initialize(Isolate* isolate) { |
- if (!HaveASnapshotToStartFrom()) return false; |
+ if (!HaveASnapshotToStartFrom()) |
+ return false; |
+ |
base::ElapsedTimer timer; |
- if (FLAG_profile_deserialization) timer.Start(); |
- |
- |
- SnapshotData snapshot_data(snapshot_impl_->data, snapshot_impl_->size); |
- Deserializer deserializer(&snapshot_data); |
+ 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); |
bool success = isolate->Init(&deserializer); |
if (FLAG_profile_deserialization) { |
double ms = timer.Elapsed().InMillisecondsF(); |
@@ -49,11 +78,27 @@ |
Handle<Context> Snapshot::NewContextFromSnapshot(Isolate* isolate) { |
- if (!HaveASnapshotToStartFrom()) return Handle<Context>(); |
+ if (!HaveASnapshotToStartFrom()) |
+ return Handle<Context>(); |
- SnapshotData snapshot_data(snapshot_impl_->context_data, |
- snapshot_impl_->context_size); |
- Deserializer deserializer(&snapshot_data); |
+ 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); |
Object* root; |
deserializer.DeserializePartial(isolate, &root); |
CHECK(root->IsContext()); |
@@ -70,10 +115,29 @@ |
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); |
} |