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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 Persistent<Context> context = v8::Context::New(); | 187 Persistent<Context> context = v8::Context::New(); |
188 // Make sure all builtin scripts are cached. | 188 // Make sure all builtin scripts are cached. |
189 { HandleScope scope; | 189 { HandleScope scope; |
190 for (int i = 0; i < i::Natives::GetBuiltinsCount(); i++) { | 190 for (int i = 0; i < i::Natives::GetBuiltinsCount(); i++) { |
191 i::Bootstrapper::NativesSourceLookup(i); | 191 i::Bootstrapper::NativesSourceLookup(i); |
192 } | 192 } |
193 } | 193 } |
194 context.Dispose(); | 194 context.Dispose(); |
195 CppByteSink sink(argv[1]); | 195 CppByteSink sink(argv[1]); |
196 i::Serializer2 ser(&sink); | 196 i::Serializer2 ser(&sink); |
| 197 i::Heap::CollectAllGarbage(false); |
197 ser.Serialize(); | 198 ser.Serialize(); |
198 return 0; | 199 return 0; |
199 } | 200 } |
200 | 201 |
201 | 202 |
202 int main(int argc, char** argv) { | 203 int main(int argc, char** argv) { |
203 #ifdef ENABLE_LOGGING_AND_PROFILING | 204 #ifdef ENABLE_LOGGING_AND_PROFILING |
204 // By default, log code create information in the snapshot. | 205 // By default, log code create information in the snapshot. |
205 i::FLAG_log_code = true; | 206 i::FLAG_log_code = true; |
206 #endif | 207 #endif |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 v8::internal::byte* bytes; | 241 v8::internal::byte* bytes; |
241 int len; | 242 int len; |
242 ser.Finalize(&bytes, &len); | 243 ser.Finalize(&bytes, &len); |
243 | 244 |
244 WriteInternalSnapshotToFile(argv[1], bytes, len); | 245 WriteInternalSnapshotToFile(argv[1], bytes, len); |
245 | 246 |
246 i::DeleteArray(bytes); | 247 i::DeleteArray(bytes); |
247 | 248 |
248 return 0; | 249 return 0; |
249 } | 250 } |
OLD | NEW |