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 // 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 } | 392 } |
393 } | 393 } |
394 // Make sure all builtin scripts are cached. | 394 // Make sure all builtin scripts are cached. |
395 { HandleScope scope(isolate); | 395 { HandleScope scope(isolate); |
396 for (int i = 0; i < i::Natives::GetBuiltinsCount(); i++) { | 396 for (int i = 0; i < i::Natives::GetBuiltinsCount(); i++) { |
397 internal_isolate->bootstrapper()->NativesSourceLookup(i); | 397 internal_isolate->bootstrapper()->NativesSourceLookup(i); |
398 } | 398 } |
399 } | 399 } |
400 // If we don't do this then we end up with a stray root pointing at the | 400 // If we don't do this then we end up with a stray root pointing at the |
401 // context even after we have disposed of the context. | 401 // context even after we have disposed of the context. |
402 internal_isolate->heap()->CollectAllGarbage( | 402 internal_isolate->heap()->CollectAllAvailableGarbage("mksnapshot"); |
403 i::Heap::kNoGCFlags, "mksnapshot"); | |
404 i::Object* raw_context = *v8::Utils::OpenPersistent(context); | 403 i::Object* raw_context = *v8::Utils::OpenPersistent(context); |
405 context.Reset(); | 404 context.Reset(); |
406 | 405 |
407 // This results in a somewhat smaller snapshot, probably because it gets | 406 // This results in a somewhat smaller snapshot, probably because it gets |
408 // rid of some things that are cached between garbage collections. | 407 // rid of some things that are cached between garbage collections. |
409 i::List<i::byte> snapshot_data; | 408 i::List<i::byte> snapshot_data; |
410 i::ListSnapshotSink snapshot_sink(&snapshot_data); | 409 i::ListSnapshotSink snapshot_sink(&snapshot_data); |
411 i::StartupSerializer ser(internal_isolate, &snapshot_sink); | 410 i::StartupSerializer ser(internal_isolate, &snapshot_sink); |
412 ser.SerializeStrongReferences(); | 411 ser.SerializeStrongReferences(); |
413 | 412 |
(...skipping 16 matching lines...) Expand all Loading... |
430 writer.WriteSnapshot(snapshot_data, ser, context_data, context_ser); | 429 writer.WriteSnapshot(snapshot_data, ser, context_data, context_ser); |
431 } | 430 } |
432 } | 431 } |
433 | 432 |
434 isolate->Dispose(); | 433 isolate->Dispose(); |
435 V8::Dispose(); | 434 V8::Dispose(); |
436 V8::ShutdownPlatform(); | 435 V8::ShutdownPlatform(); |
437 delete platform; | 436 delete platform; |
438 return 0; | 437 return 0; |
439 } | 438 } |
OLD | NEW |