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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 } | 380 } |
381 // Make sure all builtin scripts are cached. | 381 // Make sure all builtin scripts are cached. |
382 { HandleScope scope(isolate); | 382 { HandleScope scope(isolate); |
383 for (int i = 0; i < i::Natives::GetBuiltinsCount(); i++) { | 383 for (int i = 0; i < i::Natives::GetBuiltinsCount(); i++) { |
384 i::Isolate::Current()->bootstrapper()->NativesSourceLookup(i); | 384 i::Isolate::Current()->bootstrapper()->NativesSourceLookup(i); |
385 } | 385 } |
386 } | 386 } |
387 // If we don't do this then we end up with a stray root pointing at the | 387 // If we don't do this then we end up with a stray root pointing at the |
388 // context even after we have disposed of the context. | 388 // context even after we have disposed of the context. |
389 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags, "mksnapshot"); | 389 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags, "mksnapshot"); |
390 i::Object* raw_context = *(v8::Utils::OpenHandle(*context)); | 390 i::Object* raw_context = *v8::Utils::OpenPersistent(context); |
391 context.Dispose(isolate); | 391 context.Dispose(isolate); |
392 CppByteSink sink(argv[1]); | 392 CppByteSink sink(argv[1]); |
393 // This results in a somewhat smaller snapshot, probably because it gets rid | 393 // This results in a somewhat smaller snapshot, probably because it gets rid |
394 // of some things that are cached between garbage collections. | 394 // of some things that are cached between garbage collections. |
395 i::StartupSerializer ser(&sink); | 395 i::StartupSerializer ser(&sink); |
396 ser.SerializeStrongReferences(); | 396 ser.SerializeStrongReferences(); |
397 | 397 |
398 i::PartialSerializer partial_ser(&ser, sink.partial_sink()); | 398 i::PartialSerializer partial_ser(&ser, sink.partial_sink()); |
399 partial_ser.Serialize(&raw_context); | 399 partial_ser.Serialize(&raw_context); |
400 | 400 |
(...skipping 20 matching lines...) Expand all Loading... |
421 sink.WriteSpaceUsed( | 421 sink.WriteSpaceUsed( |
422 "", | 422 "", |
423 ser.CurrentAllocationAddress(i::NEW_SPACE), | 423 ser.CurrentAllocationAddress(i::NEW_SPACE), |
424 ser.CurrentAllocationAddress(i::OLD_POINTER_SPACE), | 424 ser.CurrentAllocationAddress(i::OLD_POINTER_SPACE), |
425 ser.CurrentAllocationAddress(i::OLD_DATA_SPACE), | 425 ser.CurrentAllocationAddress(i::OLD_DATA_SPACE), |
426 ser.CurrentAllocationAddress(i::CODE_SPACE), | 426 ser.CurrentAllocationAddress(i::CODE_SPACE), |
427 ser.CurrentAllocationAddress(i::MAP_SPACE), | 427 ser.CurrentAllocationAddress(i::MAP_SPACE), |
428 ser.CurrentAllocationAddress(i::CELL_SPACE)); | 428 ser.CurrentAllocationAddress(i::CELL_SPACE)); |
429 return 0; | 429 return 0; |
430 } | 430 } |
OLD | NEW |