Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: runtime/bin/gen_snapshot.cc

Issue 1800863002: Cleanup in //runtime/bin (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Windows fixes Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Generate a snapshot file after loading all the scripts specified on the 5 // Generate a snapshot file after loading all the scripts specified on the
6 // command line. 6 // command line.
7 7
8 #include <stdio.h>
8 #include <stdlib.h> 9 #include <stdlib.h>
9 #include <string.h> 10 #include <string.h>
10 #include <stdio.h>
11 11
12 #include <cstdarg> 12 #include <cstdarg>
13 13
14 #include "include/dart_api.h"
15
16 #include "bin/builtin.h" 14 #include "bin/builtin.h"
17 #include "bin/dartutils.h" 15 #include "bin/dartutils.h"
18 #include "bin/eventhandler.h" 16 #include "bin/eventhandler.h"
19 #include "bin/file.h" 17 #include "bin/file.h"
20 #include "bin/log.h" 18 #include "bin/log.h"
21 #include "bin/thread.h" 19 #include "bin/thread.h"
22 #include "bin/utils.h" 20 #include "bin/utils.h"
23 #include "bin/vmservice_impl.h" 21 #include "bin/vmservice_impl.h"
24 22
23 #include "include/dart_api.h"
24
25 #include "platform/globals.h" 25 #include "platform/globals.h"
26 26
27
28 namespace dart { 27 namespace dart {
29 namespace bin { 28 namespace bin {
30 29
31 #define CHECK_RESULT(result) \ 30 #define CHECK_RESULT(result) \
32 if (Dart_IsError(result)) { \ 31 if (Dart_IsError(result)) { \
33 Log::PrintErr("Error: %s", Dart_GetError(result)); \ 32 Log::PrintErr("Error: %s", Dart_GetError(result)); \
34 Dart_ExitScope(); \ 33 Dart_ExitScope(); \
35 Dart_ShutdownIsolate(); \ 34 Dart_ShutdownIsolate(); \
36 exit(255); \ 35 exit(255); \
37 } \ 36 } \
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 if (vm_isolate_snapshot_filename == NULL) { 173 if (vm_isolate_snapshot_filename == NULL) {
175 Log::PrintErr("No vm isolate snapshot output file specified.\n\n"); 174 Log::PrintErr("No vm isolate snapshot output file specified.\n\n");
176 return -1; 175 return -1;
177 } 176 }
178 177
179 if (isolate_snapshot_filename == NULL) { 178 if (isolate_snapshot_filename == NULL) {
180 Log::PrintErr("No isolate snapshot output file specified.\n\n"); 179 Log::PrintErr("No isolate snapshot output file specified.\n\n");
181 return -1; 180 return -1;
182 } 181 }
183 182
184 if (instructions_snapshot_filename != NULL && 183 if ((instructions_snapshot_filename != NULL) &&
185 embedder_entry_points_manifest == NULL) { 184 (embedder_entry_points_manifest == NULL)) {
186 Log::PrintErr( 185 Log::PrintErr(
187 "Specifying an instructions snapshot filename indicates precompilation" 186 "Specifying an instructions snapshot filename indicates precompilation"
188 ". But no embedder entry points manifest was specified.\n\n"); 187 ". But no embedder entry points manifest was specified.\n\n");
189 return -1; 188 return -1;
190 } 189 }
191 190
192 if (embedder_entry_points_manifest != NULL && 191 if ((embedder_entry_points_manifest != NULL) &&
193 instructions_snapshot_filename == NULL) { 192 (instructions_snapshot_filename == NULL)) {
194 Log::PrintErr( 193 Log::PrintErr(
195 "Specifying the embedder entry points manifest indicates " 194 "Specifying the embedder entry points manifest indicates "
196 "precompilation. But no instuctions snapshot was specified.\n\n"); 195 "precompilation. But no instuctions snapshot was specified.\n\n");
197 return -1; 196 return -1;
198 } 197 }
199 198
200 return 0; 199 return 0;
201 } 200 }
202 201
203 202
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 820
822 // The entries allocation must be explicitly cleaned up via 821 // The entries allocation must be explicitly cleaned up via
823 // |CleanupEntryPointsCollection| 822 // |CleanupEntryPointsCollection|
824 return entries; 823 return entries;
825 } 824 }
826 825
827 826
828 static Dart_QualifiedFunctionName* ParseEntryPointsManifestIfPresent() { 827 static Dart_QualifiedFunctionName* ParseEntryPointsManifestIfPresent() {
829 Dart_QualifiedFunctionName* entries = 828 Dart_QualifiedFunctionName* entries =
830 ParseEntryPointsManifestFile(embedder_entry_points_manifest); 829 ParseEntryPointsManifestFile(embedder_entry_points_manifest);
831 if (entries == NULL && IsSnapshottingForPrecompilation()) { 830 if ((entries == NULL) && IsSnapshottingForPrecompilation()) {
832 Log::PrintErr( 831 Log::PrintErr(
833 "Could not find native embedder entry points during precompilation\n"); 832 "Could not find native embedder entry points during precompilation\n");
834 exit(255); 833 exit(255);
835 } 834 }
836 return entries; 835 return entries;
837 } 836 }
838 837
839 838
840 static void CreateAndWriteSnapshot() { 839 static void CreateAndWriteSnapshot() {
841 ASSERT(!IsSnapshottingForPrecompilation()); 840 ASSERT(!IsSnapshottingForPrecompilation());
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 EventHandler::Stop(); 1151 EventHandler::Stop();
1153 return 0; 1152 return 0;
1154 } 1153 }
1155 1154
1156 } // namespace bin 1155 } // namespace bin
1157 } // namespace dart 1156 } // namespace dart
1158 1157
1159 int main(int argc, char** argv) { 1158 int main(int argc, char** argv) {
1160 return dart::bin::main(argc, argv); 1159 return dart::bin::main(argc, argv);
1161 } 1160 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698