Index: src/snapshot-common.cc |
diff --git a/src/snapshot-common.cc b/src/snapshot-common.cc |
index f06f38a19983665b1f233251a3a0692169601688..b152ad354b660f16b82bb4c8edee84eaf0342237 100644 |
--- a/src/snapshot-common.cc |
+++ b/src/snapshot-common.cc |
@@ -14,14 +14,27 @@ |
namespace v8 { |
namespace internal { |
+void Snapshot::ReserveSpaceForLinkedInSnapshot(Deserializer* deserializer) { |
+ deserializer->AddReservation(NEW_SPACE, new_space_used_); |
+ deserializer->AddReservation(OLD_POINTER_SPACE, pointer_space_used_); |
+ deserializer->AddReservation(OLD_DATA_SPACE, data_space_used_); |
+ deserializer->AddReservation(CODE_SPACE, code_space_used_); |
+ deserializer->AddReservation(MAP_SPACE, map_space_used_); |
+ deserializer->AddReservation(CELL_SPACE, cell_space_used_); |
+ deserializer->AddReservation(PROPERTY_CELL_SPACE, property_cell_space_used_); |
+ deserializer->AddReservation(LO_SPACE, lo_space_used_); |
+} |
+ |
bool Snapshot::Initialize(Isolate* isolate) { |
if (size_ > 0) { |
base::ElapsedTimer timer; |
- if (FLAG_profile_deserialization) timer.Start(); |
- |
- SnapshotData snapshot_data(data_, size_); |
- Deserializer deserializer(&snapshot_data); |
+ if (FLAG_profile_deserialization) { |
+ timer.Start(); |
+ } |
+ SnapshotByteSource source(raw_data_, raw_size_); |
+ Deserializer deserializer(&source); |
+ ReserveSpaceForLinkedInSnapshot(&deserializer); |
bool success = isolate->Init(&deserializer); |
if (FLAG_profile_deserialization) { |
double ms = timer.Elapsed().InMillisecondsF(); |
@@ -39,11 +52,22 @@ |
Handle<Context> Snapshot::NewContextFromSnapshot(Isolate* isolate) { |
- if (context_size_ == 0) return Handle<Context>(); |
- |
- SnapshotData snapshot_data(context_data_, context_size_); |
- Deserializer deserializer(&snapshot_data); |
+ if (context_size_ == 0) { |
+ return Handle<Context>(); |
+ } |
+ SnapshotByteSource source(context_raw_data_, |
+ context_raw_size_); |
+ Deserializer deserializer(&source); |
Object* root; |
+ deserializer.AddReservation(NEW_SPACE, context_new_space_used_); |
+ deserializer.AddReservation(OLD_POINTER_SPACE, context_pointer_space_used_); |
+ deserializer.AddReservation(OLD_DATA_SPACE, context_data_space_used_); |
+ deserializer.AddReservation(CODE_SPACE, context_code_space_used_); |
+ deserializer.AddReservation(MAP_SPACE, context_map_space_used_); |
+ deserializer.AddReservation(CELL_SPACE, context_cell_space_used_); |
+ deserializer.AddReservation(PROPERTY_CELL_SPACE, |
+ context_property_cell_space_used_); |
+ deserializer.AddReservation(LO_SPACE, context_lo_space_used_); |
deserializer.DeserializePartial(isolate, &root); |
CHECK(root->IsContext()); |
return Handle<Context>(Context::cast(root)); |