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 <signal.h> | 6 #include <signal.h> |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
11 #include "include/libplatform/libplatform.h" | 11 #include "include/libplatform/libplatform.h" |
12 #include "src/assembler.h" | 12 #include "src/assembler.h" |
13 #include "src/base/platform/platform.h" | 13 #include "src/base/platform/platform.h" |
14 #include "src/bootstrapper.h" | 14 #include "src/bootstrapper.h" |
15 #include "src/flags.h" | 15 #include "src/flags.h" |
16 #include "src/list.h" | 16 #include "src/list.h" |
17 #include "src/natives.h" | 17 #include "src/snapshot/natives.h" |
18 #include "src/serialize.h" | 18 #include "src/snapshot/serialize.h" |
19 | 19 |
20 | 20 |
21 using namespace v8; | 21 using namespace v8; |
22 | 22 |
23 class SnapshotWriter { | 23 class SnapshotWriter { |
24 public: | 24 public: |
25 explicit SnapshotWriter(const char* snapshot_file) | 25 explicit SnapshotWriter(const char* snapshot_file) |
26 : fp_(GetFileDescriptorOrDie(snapshot_file)), | 26 : fp_(GetFileDescriptorOrDie(snapshot_file)), |
27 startup_blob_file_(NULL) {} | 27 startup_blob_file_(NULL) {} |
28 | 28 |
(...skipping 28 matching lines...) Expand all Loading... |
57 void WriteSnapshotFile(const i::Vector<const i::byte>& blob) const { | 57 void WriteSnapshotFile(const i::Vector<const i::byte>& blob) const { |
58 WriteFilePrefix(); | 58 WriteFilePrefix(); |
59 WriteData(blob); | 59 WriteData(blob); |
60 WriteFileSuffix(); | 60 WriteFileSuffix(); |
61 } | 61 } |
62 | 62 |
63 void WriteFilePrefix() const { | 63 void WriteFilePrefix() const { |
64 fprintf(fp_, "// Autogenerated snapshot file. Do not edit.\n\n"); | 64 fprintf(fp_, "// Autogenerated snapshot file. Do not edit.\n\n"); |
65 fprintf(fp_, "#include \"src/v8.h\"\n"); | 65 fprintf(fp_, "#include \"src/v8.h\"\n"); |
66 fprintf(fp_, "#include \"src/base/platform/platform.h\"\n\n"); | 66 fprintf(fp_, "#include \"src/base/platform/platform.h\"\n\n"); |
67 fprintf(fp_, "#include \"src/snapshot.h\"\n\n"); | 67 fprintf(fp_, "#include \"src/snapshot/snapshot.h\"\n\n"); |
68 fprintf(fp_, "namespace v8 {\n"); | 68 fprintf(fp_, "namespace v8 {\n"); |
69 fprintf(fp_, "namespace internal {\n\n"); | 69 fprintf(fp_, "namespace internal {\n\n"); |
70 } | 70 } |
71 | 71 |
72 void WriteFileSuffix() const { | 72 void WriteFileSuffix() const { |
73 fprintf(fp_, "const v8::StartupData* Snapshot::DefaultSnapshotBlob() {\n"); | 73 fprintf(fp_, "const v8::StartupData* Snapshot::DefaultSnapshotBlob() {\n"); |
74 fprintf(fp_, " return &blob;\n"); | 74 fprintf(fp_, " return &blob;\n"); |
75 fprintf(fp_, "}\n\n"); | 75 fprintf(fp_, "}\n\n"); |
76 fprintf(fp_, "} // namespace internal\n"); | 76 fprintf(fp_, "} // namespace internal\n"); |
77 fprintf(fp_, "} // namespace v8\n"); | 77 fprintf(fp_, "} // namespace v8\n"); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 writer.WriteSnapshot(blob); | 164 writer.WriteSnapshot(blob); |
165 delete[] extra_code; | 165 delete[] extra_code; |
166 delete[] blob.data; | 166 delete[] blob.data; |
167 } | 167 } |
168 | 168 |
169 V8::Dispose(); | 169 V8::Dispose(); |
170 V8::ShutdownPlatform(); | 170 V8::ShutdownPlatform(); |
171 delete platform; | 171 delete platform; |
172 return 0; | 172 return 0; |
173 } | 173 } |
OLD | NEW |