OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 fprintf(fp_, | 159 fprintf(fp_, |
160 "const byte* Snapshot::raw_data_ = Snapshot::data_;\n"); | 160 "const byte* Snapshot::raw_data_ = Snapshot::data_;\n"); |
161 fprintf(fp_, | 161 fprintf(fp_, |
162 "const int Snapshot::raw_size_ = Snapshot::size_;\n\n"); | 162 "const int Snapshot::raw_size_ = Snapshot::size_;\n\n"); |
163 #endif | 163 #endif |
164 fprintf(fp_, "} } // namespace v8::internal\n"); | 164 fprintf(fp_, "} } // namespace v8::internal\n"); |
165 fclose(fp_); | 165 fclose(fp_); |
166 } | 166 } |
167 | 167 |
168 void WriteSpaceUsed( | 168 void WriteSpaceUsed( |
169 const char* prefix, | |
170 int new_space_used, | 169 int new_space_used, |
171 int pointer_space_used, | 170 int pointer_space_used, |
172 int data_space_used, | 171 int data_space_used, |
173 int code_space_used, | 172 int code_space_used, |
174 int map_space_used, | 173 int map_space_used, |
175 int cell_space_used) { | 174 int cell_space_used, |
| 175 int large_space_used) { |
| 176 fprintf(fp_, "const int Snapshot::new_space_used_ = %d;\n", new_space_used); |
176 fprintf(fp_, | 177 fprintf(fp_, |
177 "const int Snapshot::%snew_space_used_ = %d;\n", | 178 "const int Snapshot::pointer_space_used_ = %d;\n", |
178 prefix, | |
179 new_space_used); | |
180 fprintf(fp_, | |
181 "const int Snapshot::%spointer_space_used_ = %d;\n", | |
182 prefix, | |
183 pointer_space_used); | 179 pointer_space_used); |
184 fprintf(fp_, | 180 fprintf(fp_, |
185 "const int Snapshot::%sdata_space_used_ = %d;\n", | 181 "const int Snapshot::data_space_used_ = %d;\n", |
186 prefix, | |
187 data_space_used); | 182 data_space_used); |
188 fprintf(fp_, | 183 fprintf(fp_, |
189 "const int Snapshot::%scode_space_used_ = %d;\n", | 184 "const int Snapshot::code_space_used_ = %d;\n", |
190 prefix, | |
191 code_space_used); | 185 code_space_used); |
| 186 fprintf(fp_, "const int Snapshot::map_space_used_ = %d;\n", map_space_used); |
192 fprintf(fp_, | 187 fprintf(fp_, |
193 "const int Snapshot::%smap_space_used_ = %d;\n", | 188 "const int Snapshot::cell_space_used_ = %d;\n", |
194 prefix, | 189 cell_space_used); |
195 map_space_used); | |
196 fprintf(fp_, | 190 fprintf(fp_, |
197 "const int Snapshot::%scell_space_used_ = %d;\n", | 191 "const int Snapshot::large_space_used_ = %d;\n", |
198 prefix, | 192 large_space_used); |
199 cell_space_used); | |
200 } | 193 } |
201 | 194 |
202 void WritePartialSnapshot() { | 195 void WritePartialSnapshot() { |
203 int length = partial_sink_.Position(); | 196 int length = partial_sink_.Position(); |
204 fprintf(fp_, "};\n\n"); | 197 fprintf(fp_, "};\n\n"); |
205 fprintf(fp_, "const int Snapshot::context_size_ = %d;\n", length); | 198 fprintf(fp_, "const int Snapshot::context_size_ = %d;\n", length); |
206 #ifdef COMPRESS_STARTUP_DATA_BZ2 | 199 #ifdef COMPRESS_STARTUP_DATA_BZ2 |
207 fprintf(fp_, | 200 fprintf(fp_, |
208 "const int Snapshot::context_raw_size_ = %d;\n", | 201 "const int Snapshot::context_raw_size_ = %d;\n", |
209 partial_sink_.raw_size()); | 202 partial_sink_.raw_size()); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 BZip2Compressor compressor; | 393 BZip2Compressor compressor; |
401 if (!sink.Compress(&compressor)) | 394 if (!sink.Compress(&compressor)) |
402 return 1; | 395 return 1; |
403 if (!sink.partial_sink()->Compress(&compressor)) | 396 if (!sink.partial_sink()->Compress(&compressor)) |
404 return 1; | 397 return 1; |
405 #endif | 398 #endif |
406 sink.WriteSnapshot(); | 399 sink.WriteSnapshot(); |
407 sink.WritePartialSnapshot(); | 400 sink.WritePartialSnapshot(); |
408 | 401 |
409 sink.WriteSpaceUsed( | 402 sink.WriteSpaceUsed( |
410 "context_", | |
411 partial_ser.CurrentAllocationAddress(i::NEW_SPACE), | 403 partial_ser.CurrentAllocationAddress(i::NEW_SPACE), |
412 partial_ser.CurrentAllocationAddress(i::OLD_POINTER_SPACE), | 404 partial_ser.CurrentAllocationAddress(i::OLD_POINTER_SPACE), |
413 partial_ser.CurrentAllocationAddress(i::OLD_DATA_SPACE), | 405 partial_ser.CurrentAllocationAddress(i::OLD_DATA_SPACE), |
414 partial_ser.CurrentAllocationAddress(i::CODE_SPACE), | 406 partial_ser.CurrentAllocationAddress(i::CODE_SPACE), |
415 partial_ser.CurrentAllocationAddress(i::MAP_SPACE), | 407 partial_ser.CurrentAllocationAddress(i::MAP_SPACE), |
416 partial_ser.CurrentAllocationAddress(i::CELL_SPACE)); | 408 partial_ser.CurrentAllocationAddress(i::CELL_SPACE), |
417 sink.WriteSpaceUsed( | 409 partial_ser.CurrentAllocationAddress(i::LO_SPACE)); |
418 "", | |
419 ser.CurrentAllocationAddress(i::NEW_SPACE), | |
420 ser.CurrentAllocationAddress(i::OLD_POINTER_SPACE), | |
421 ser.CurrentAllocationAddress(i::OLD_DATA_SPACE), | |
422 ser.CurrentAllocationAddress(i::CODE_SPACE), | |
423 ser.CurrentAllocationAddress(i::MAP_SPACE), | |
424 ser.CurrentAllocationAddress(i::CELL_SPACE)); | |
425 return 0; | 410 return 0; |
426 } | 411 } |
OLD | NEW |