Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(778)

Unified Diff: src/mksnapshot.cc

Issue 653033002: Break deserializer reservations into chunks that fit onto a page. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments and rebase Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/list.h ('k') | src/serialize.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « src/list.h ('k') | src/serialize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698