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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 // Make sure all builtin scripts are cached. | 391 // Make sure all builtin scripts are cached. |
392 { HandleScope scope(isolate); | 392 { HandleScope scope(isolate); |
393 for (int i = 0; i < i::Natives::GetBuiltinsCount(); i++) { | 393 for (int i = 0; i < i::Natives::GetBuiltinsCount(); i++) { |
394 i::Isolate::Current()->bootstrapper()->NativesSourceLookup(i); | 394 i::Isolate::Current()->bootstrapper()->NativesSourceLookup(i); |
395 } | 395 } |
396 } | 396 } |
397 // If we don't do this then we end up with a stray root pointing at the | 397 // If we don't do this then we end up with a stray root pointing at the |
398 // context even after we have disposed of the context. | 398 // context even after we have disposed of the context. |
399 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags, "mksnapshot"); | 399 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags, "mksnapshot"); |
400 i::Object* raw_context = *v8::Utils::OpenPersistent(context); | 400 i::Object* raw_context = *v8::Utils::OpenPersistent(context); |
401 context.Dispose(isolate); | 401 context.Dispose(); |
402 CppByteSink sink(argv[1]); | 402 CppByteSink sink(argv[1]); |
403 // This results in a somewhat smaller snapshot, probably because it gets rid | 403 // This results in a somewhat smaller snapshot, probably because it gets rid |
404 // of some things that are cached between garbage collections. | 404 // of some things that are cached between garbage collections. |
405 i::StartupSerializer ser(&sink); | 405 i::StartupSerializer ser(&sink); |
406 ser.SerializeStrongReferences(); | 406 ser.SerializeStrongReferences(); |
407 | 407 |
408 i::PartialSerializer partial_ser(&ser, sink.partial_sink()); | 408 i::PartialSerializer partial_ser(&ser, sink.partial_sink()); |
409 partial_ser.Serialize(&raw_context); | 409 partial_ser.Serialize(&raw_context); |
410 | 410 |
411 ser.SerializeWeakReferences(); | 411 ser.SerializeWeakReferences(); |
(...skipping 21 matching lines...) Expand all Loading... |
433 "", | 433 "", |
434 ser.CurrentAllocationAddress(i::NEW_SPACE), | 434 ser.CurrentAllocationAddress(i::NEW_SPACE), |
435 ser.CurrentAllocationAddress(i::OLD_POINTER_SPACE), | 435 ser.CurrentAllocationAddress(i::OLD_POINTER_SPACE), |
436 ser.CurrentAllocationAddress(i::OLD_DATA_SPACE), | 436 ser.CurrentAllocationAddress(i::OLD_DATA_SPACE), |
437 ser.CurrentAllocationAddress(i::CODE_SPACE), | 437 ser.CurrentAllocationAddress(i::CODE_SPACE), |
438 ser.CurrentAllocationAddress(i::MAP_SPACE), | 438 ser.CurrentAllocationAddress(i::MAP_SPACE), |
439 ser.CurrentAllocationAddress(i::CELL_SPACE), | 439 ser.CurrentAllocationAddress(i::CELL_SPACE), |
440 ser.CurrentAllocationAddress(i::PROPERTY_CELL_SPACE)); | 440 ser.CurrentAllocationAddress(i::PROPERTY_CELL_SPACE)); |
441 return 0; | 441 return 0; |
442 } | 442 } |
OLD | NEW |