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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 i::List<i::byte> startup_blob; | 84 i::List<i::byte> startup_blob; |
85 i::ListSnapshotSink sink(&startup_blob); | 85 i::ListSnapshotSink sink(&startup_blob); |
86 | 86 |
87 int spaces[] = { | 87 int spaces[] = { |
88 i::NEW_SPACE, i::OLD_POINTER_SPACE, i::OLD_DATA_SPACE, i::CODE_SPACE, | 88 i::NEW_SPACE, i::OLD_POINTER_SPACE, i::OLD_DATA_SPACE, i::CODE_SPACE, |
89 i::MAP_SPACE, i::CELL_SPACE, i::PROPERTY_CELL_SPACE | 89 i::MAP_SPACE, i::CELL_SPACE, i::PROPERTY_CELL_SPACE |
90 }; | 90 }; |
91 | 91 |
92 i::byte* snapshot_bytes = snapshot_data.begin(); | 92 i::byte* snapshot_bytes = snapshot_data.begin(); |
93 sink.PutBlob(snapshot_bytes, snapshot_data.length(), "snapshot"); | 93 sink.PutBlob(snapshot_bytes, snapshot_data.length(), "snapshot"); |
94 for (size_t i = 0; i < ARRAY_SIZE(spaces); ++i) | 94 for (size_t i = 0; i < arraysize(spaces); ++i) |
95 sink.PutInt(serializer.CurrentAllocationAddress(spaces[i]), "spaces"); | 95 sink.PutInt(serializer.CurrentAllocationAddress(spaces[i]), "spaces"); |
96 | 96 |
97 i::byte* context_bytes = context_snapshot_data.begin(); | 97 i::byte* context_bytes = context_snapshot_data.begin(); |
98 sink.PutBlob(context_bytes, context_snapshot_data.length(), "context"); | 98 sink.PutBlob(context_bytes, context_snapshot_data.length(), "context"); |
99 for (size_t i = 0; i < ARRAY_SIZE(spaces); ++i) | 99 for (size_t i = 0; i < arraysize(spaces); ++i) |
100 sink.PutInt(context_serializer.CurrentAllocationAddress(spaces[i]), | 100 sink.PutInt(context_serializer.CurrentAllocationAddress(spaces[i]), |
101 "spaces"); | 101 "spaces"); |
102 | 102 |
103 size_t written = fwrite(startup_blob.begin(), 1, startup_blob.length(), | 103 size_t written = fwrite(startup_blob.begin(), 1, startup_blob.length(), |
104 startup_blob_file_); | 104 startup_blob_file_); |
105 if (written != (size_t)startup_blob.length()) { | 105 if (written != (size_t)startup_blob.length()) { |
106 i::PrintF("Writing snapshot file failed.. Aborting.\n"); | 106 i::PrintF("Writing snapshot file failed.. Aborting.\n"); |
107 exit(1); | 107 exit(1); |
108 } | 108 } |
109 } | 109 } |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 writer.WriteSnapshot(snapshot_data, ser, context_data, context_ser); | 426 writer.WriteSnapshot(snapshot_data, ser, context_data, context_ser); |
427 } | 427 } |
428 } | 428 } |
429 | 429 |
430 isolate->Dispose(); | 430 isolate->Dispose(); |
431 V8::Dispose(); | 431 V8::Dispose(); |
432 V8::ShutdownPlatform(); | 432 V8::ShutdownPlatform(); |
433 delete platform; | 433 delete platform; |
434 return 0; | 434 return 0; |
435 } | 435 } |
OLD | NEW |