Index: src/mksnapshot.cc |
diff --git a/src/mksnapshot.cc b/src/mksnapshot.cc |
index 58e8669b5bf43d21d95858ae7e90962340e8501f..0737c9e3f5e484bf1aa3ac0abdf44cf459f5a665 100644 |
--- a/src/mksnapshot.cc |
+++ b/src/mksnapshot.cc |
@@ -91,14 +91,25 @@ class SnapshotWriter { |
i::byte* snapshot_bytes = snapshot_data.begin(); |
sink.PutBlob(snapshot_bytes, snapshot_data.length(), "snapshot"); |
- for (size_t i = 0; i < arraysize(spaces); ++i) |
- sink.PutInt(serializer.CurrentAllocationAddress(spaces[i]), "spaces"); |
+ for (size_t i = 0; i < arraysize(spaces); ++i) { |
+ i::Vector<const uint32_t> chunks = |
+ serializer.FinalAllocationChunks(spaces[i]); |
+ // For the start-up snapshot, none of the reservations has more than |
+ // one chunk (reservation for each space fits onto a single page). |
+ CHECK_EQ(1, chunks.length()); |
+ sink.PutInt(chunks[0], "spaces"); |
+ } |
i::byte* context_bytes = context_snapshot_data.begin(); |
sink.PutBlob(context_bytes, context_snapshot_data.length(), "context"); |
- for (size_t i = 0; i < arraysize(spaces); ++i) |
- sink.PutInt(context_serializer.CurrentAllocationAddress(spaces[i]), |
- "spaces"); |
+ for (size_t i = 0; i < arraysize(spaces); ++i) { |
+ i::Vector<const uint32_t> chunks = |
+ context_serializer.FinalAllocationChunks(spaces[i]); |
+ // For the context snapshot, none of the reservations has more than |
+ // one chunk (reservation for each space fits onto a single page). |
+ CHECK_EQ(1, chunks.length()); |
+ sink.PutInt(chunks[0], "spaces"); |
+ } |
size_t written = fwrite(startup_blob.begin(), 1, startup_blob.length(), |
startup_blob_file_); |
@@ -203,8 +214,12 @@ class SnapshotWriter { |
void WriteSizeVar(const i::Serializer& ser, const char* prefix, |
const char* name, int space) const { |
- fprintf(fp_, "const int Snapshot::%s%s_space_used_ = %d;\n", |
- prefix, name, ser.CurrentAllocationAddress(space)); |
+ i::Vector<const uint32_t> chunks = ser.FinalAllocationChunks(space); |
+ // For the start-up snapshot, none of the reservations has more than |
+ // one chunk (total reservation fits into a single page). |
+ CHECK_EQ(1, chunks.length()); |
+ fprintf(fp_, "const int Snapshot::%s%s_space_used_ = %d;\n", prefix, name, |
+ chunks[0]); |
} |
void WriteSnapshotData(const i::List<i::byte>* data) const { |
@@ -416,6 +431,9 @@ int main(int argc, char** argv) { |
context_ser.Serialize(&raw_context); |
ser.SerializeWeakReferences(); |
+ context_ser.FinalizeAllocation(); |
+ ser.FinalizeAllocation(); |
+ |
{ |
SnapshotWriter writer(argv[1]); |
if (i::FLAG_raw_file && i::FLAG_raw_context_file) |