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

Side by Side Diff: src/mksnapshot.cc

Issue 581223004: Support large objects in the serializer/deserializer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap/spaces.cc ('k') | src/serialize.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <errno.h> 5 #include <errno.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #ifdef COMPRESS_STARTUP_DATA_BZ2 7 #ifdef COMPRESS_STARTUP_DATA_BZ2
8 #include <bzlib.h> 8 #include <bzlib.h>
9 #endif 9 #endif
10 #include <signal.h> 10 #include <signal.h>
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 void MaybeWriteStartupBlob(const i::List<i::byte>& snapshot_data, 77 void MaybeWriteStartupBlob(const i::List<i::byte>& snapshot_data,
78 const i::Serializer& serializer, 78 const i::Serializer& serializer,
79 const i::List<i::byte>& context_snapshot_data, 79 const i::List<i::byte>& context_snapshot_data,
80 const i::Serializer& context_serializer) const { 80 const i::Serializer& context_serializer) const {
81 if (!startup_blob_file_) 81 if (!startup_blob_file_)
82 return; 82 return;
83 83
84 i::List<i::byte> startup_blob; 84 i::List<i::byte> startup_blob;
85 i::ListSnapshotSink sink(&startup_blob); 85 i::ListSnapshotSink sink(&startup_blob);
86 86
87 int spaces[] = { 87 int spaces[] = {i::NEW_SPACE, i::OLD_POINTER_SPACE,
88 i::NEW_SPACE, i::OLD_POINTER_SPACE, i::OLD_DATA_SPACE, i::CODE_SPACE, 88 i::OLD_DATA_SPACE, i::CODE_SPACE,
89 i::MAP_SPACE, i::CELL_SPACE, i::PROPERTY_CELL_SPACE 89 i::MAP_SPACE, i::CELL_SPACE,
90 }; 90 i::PROPERTY_CELL_SPACE, i::LO_SPACE};
91 91
92 i::byte* snapshot_bytes = snapshot_data.begin(); 92 i::byte* snapshot_bytes = snapshot_data.begin();
93 sink.PutBlob(snapshot_bytes, snapshot_data.length(), "snapshot"); 93 sink.PutBlob(snapshot_bytes, snapshot_data.length(), "snapshot");
94 for (size_t i = 0; i < arraysize(spaces); ++i) 94 for (size_t i = 0; i < arraysize(spaces); ++i)
95 sink.PutInt(serializer.CurrentAllocationAddress(spaces[i]), "spaces"); 95 sink.PutInt(serializer.CurrentAllocationAddress(spaces[i]), "spaces");
96 96
97 i::byte* context_bytes = context_snapshot_data.begin(); 97 i::byte* context_bytes = context_snapshot_data.begin();
98 sink.PutBlob(context_bytes, context_snapshot_data.length(), "context"); 98 sink.PutBlob(context_bytes, context_snapshot_data.length(), "context");
99 for (size_t i = 0; i < arraysize(spaces); ++i) 99 for (size_t i = 0; i < arraysize(spaces); ++i)
100 sink.PutInt(context_serializer.CurrentAllocationAddress(spaces[i]), 100 sink.PutInt(context_serializer.CurrentAllocationAddress(spaces[i]),
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } 190 }
191 191
192 void WriteMeta(const char* prefix, const i::Serializer& ser) const { 192 void WriteMeta(const char* prefix, const i::Serializer& ser) const {
193 WriteSizeVar(ser, prefix, "new", i::NEW_SPACE); 193 WriteSizeVar(ser, prefix, "new", i::NEW_SPACE);
194 WriteSizeVar(ser, prefix, "pointer", i::OLD_POINTER_SPACE); 194 WriteSizeVar(ser, prefix, "pointer", i::OLD_POINTER_SPACE);
195 WriteSizeVar(ser, prefix, "data", i::OLD_DATA_SPACE); 195 WriteSizeVar(ser, prefix, "data", i::OLD_DATA_SPACE);
196 WriteSizeVar(ser, prefix, "code", i::CODE_SPACE); 196 WriteSizeVar(ser, prefix, "code", i::CODE_SPACE);
197 WriteSizeVar(ser, prefix, "map", i::MAP_SPACE); 197 WriteSizeVar(ser, prefix, "map", i::MAP_SPACE);
198 WriteSizeVar(ser, prefix, "cell", i::CELL_SPACE); 198 WriteSizeVar(ser, prefix, "cell", i::CELL_SPACE);
199 WriteSizeVar(ser, prefix, "property_cell", i::PROPERTY_CELL_SPACE); 199 WriteSizeVar(ser, prefix, "property_cell", i::PROPERTY_CELL_SPACE);
200 WriteSizeVar(ser, prefix, "lo", i::LO_SPACE);
200 fprintf(fp_, "\n"); 201 fprintf(fp_, "\n");
201 } 202 }
202 203
203 void WriteSizeVar(const i::Serializer& ser, const char* prefix, 204 void WriteSizeVar(const i::Serializer& ser, const char* prefix,
204 const char* name, int space) const { 205 const char* name, int space) const {
205 fprintf(fp_, "const int Snapshot::%s%s_space_used_ = %d;\n", 206 fprintf(fp_, "const int Snapshot::%s%s_space_used_ = %d;\n",
206 prefix, name, ser.CurrentAllocationAddress(space)); 207 prefix, name, ser.CurrentAllocationAddress(space));
207 } 208 }
208 209
209 void WriteSnapshotData(const i::List<i::byte>* data) const { 210 void WriteSnapshotData(const i::List<i::byte>* data) const {
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 writer.WriteSnapshot(snapshot_data, ser, context_data, context_ser); 430 writer.WriteSnapshot(snapshot_data, ser, context_data, context_ser);
430 } 431 }
431 } 432 }
432 433
433 isolate->Dispose(); 434 isolate->Dispose();
434 V8::Dispose(); 435 V8::Dispose();
435 V8::ShutdownPlatform(); 436 V8::ShutdownPlatform();
436 delete platform; 437 delete platform;
437 return 0; 438 return 0;
438 } 439 }
OLDNEW
« no previous file with comments | « src/heap/spaces.cc ('k') | src/serialize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698