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, |
169 int new_space_used, | 170 int new_space_used, |
170 int pointer_space_used, | 171 int pointer_space_used, |
171 int data_space_used, | 172 int data_space_used, |
172 int code_space_used, | 173 int code_space_used, |
173 int map_space_used, | 174 int map_space_used, |
174 int cell_space_used, | 175 int cell_space_used) { |
175 int large_space_used) { | |
176 fprintf(fp_, "const int Snapshot::new_space_used_ = %d;\n", new_space_used); | |
177 fprintf(fp_, | 176 fprintf(fp_, |
178 "const int Snapshot::pointer_space_used_ = %d;\n", | 177 "const int Snapshot::%snew_space_used_ = %d;\n", |
| 178 prefix, |
| 179 new_space_used); |
| 180 fprintf(fp_, |
| 181 "const int Snapshot::%spointer_space_used_ = %d;\n", |
| 182 prefix, |
179 pointer_space_used); | 183 pointer_space_used); |
180 fprintf(fp_, | 184 fprintf(fp_, |
181 "const int Snapshot::data_space_used_ = %d;\n", | 185 "const int Snapshot::%sdata_space_used_ = %d;\n", |
| 186 prefix, |
182 data_space_used); | 187 data_space_used); |
183 fprintf(fp_, | 188 fprintf(fp_, |
184 "const int Snapshot::code_space_used_ = %d;\n", | 189 "const int Snapshot::%scode_space_used_ = %d;\n", |
| 190 prefix, |
185 code_space_used); | 191 code_space_used); |
186 fprintf(fp_, "const int Snapshot::map_space_used_ = %d;\n", map_space_used); | |
187 fprintf(fp_, | 192 fprintf(fp_, |
188 "const int Snapshot::cell_space_used_ = %d;\n", | 193 "const int Snapshot::%smap_space_used_ = %d;\n", |
| 194 prefix, |
| 195 map_space_used); |
| 196 fprintf(fp_, |
| 197 "const int Snapshot::%scell_space_used_ = %d;\n", |
| 198 prefix, |
189 cell_space_used); | 199 cell_space_used); |
190 fprintf(fp_, | |
191 "const int Snapshot::large_space_used_ = %d;\n", | |
192 large_space_used); | |
193 } | 200 } |
194 | 201 |
195 void WritePartialSnapshot() { | 202 void WritePartialSnapshot() { |
196 int length = partial_sink_.Position(); | 203 int length = partial_sink_.Position(); |
197 fprintf(fp_, "};\n\n"); | 204 fprintf(fp_, "};\n\n"); |
198 fprintf(fp_, "const int Snapshot::context_size_ = %d;\n", length); | 205 fprintf(fp_, "const int Snapshot::context_size_ = %d;\n", length); |
199 #ifdef COMPRESS_STARTUP_DATA_BZ2 | 206 #ifdef COMPRESS_STARTUP_DATA_BZ2 |
200 fprintf(fp_, | 207 fprintf(fp_, |
201 "const int Snapshot::context_raw_size_ = %d;\n", | 208 "const int Snapshot::context_raw_size_ = %d;\n", |
202 partial_sink_.raw_size()); | 209 partial_sink_.raw_size()); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 BZip2Compressor compressor; | 400 BZip2Compressor compressor; |
394 if (!sink.Compress(&compressor)) | 401 if (!sink.Compress(&compressor)) |
395 return 1; | 402 return 1; |
396 if (!sink.partial_sink()->Compress(&compressor)) | 403 if (!sink.partial_sink()->Compress(&compressor)) |
397 return 1; | 404 return 1; |
398 #endif | 405 #endif |
399 sink.WriteSnapshot(); | 406 sink.WriteSnapshot(); |
400 sink.WritePartialSnapshot(); | 407 sink.WritePartialSnapshot(); |
401 | 408 |
402 sink.WriteSpaceUsed( | 409 sink.WriteSpaceUsed( |
| 410 "context_", |
403 partial_ser.CurrentAllocationAddress(i::NEW_SPACE), | 411 partial_ser.CurrentAllocationAddress(i::NEW_SPACE), |
404 partial_ser.CurrentAllocationAddress(i::OLD_POINTER_SPACE), | 412 partial_ser.CurrentAllocationAddress(i::OLD_POINTER_SPACE), |
405 partial_ser.CurrentAllocationAddress(i::OLD_DATA_SPACE), | 413 partial_ser.CurrentAllocationAddress(i::OLD_DATA_SPACE), |
406 partial_ser.CurrentAllocationAddress(i::CODE_SPACE), | 414 partial_ser.CurrentAllocationAddress(i::CODE_SPACE), |
407 partial_ser.CurrentAllocationAddress(i::MAP_SPACE), | 415 partial_ser.CurrentAllocationAddress(i::MAP_SPACE), |
408 partial_ser.CurrentAllocationAddress(i::CELL_SPACE), | 416 partial_ser.CurrentAllocationAddress(i::CELL_SPACE)); |
409 partial_ser.CurrentAllocationAddress(i::LO_SPACE)); | 417 sink.WriteSpaceUsed( |
| 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)); |
410 return 0; | 425 return 0; |
411 } | 426 } |
OLD | NEW |