| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| 11 | 11 |
| 12 #include "include/dart_api.h" | 12 #include "include/dart_api.h" |
| 13 | 13 |
| 14 #include "bin/builtin.h" | 14 #include "bin/builtin.h" |
| 15 #include "bin/dartutils.h" | 15 #include "bin/dartutils.h" |
| 16 #include "bin/file.h" | 16 #include "bin/file.h" |
| 17 #include "bin/globals.h" | 17 |
| 18 #include "platform/globals.h" |
| 18 | 19 |
| 19 // Global state that indicates whether a snapshot is to be created and | 20 // Global state that indicates whether a snapshot is to be created and |
| 20 // if so which file to write the snapshot into. | 21 // if so which file to write the snapshot into. |
| 21 static const char* snapshot_filename = NULL; | 22 static const char* snapshot_filename = NULL; |
| 22 | 23 |
| 23 | 24 |
| 24 // Global state which contains a pointer to the script name for which | 25 // Global state which contains a pointer to the script name for which |
| 25 // a snapshot needs to be created (NULL would result in the creation | 26 // a snapshot needs to be created (NULL would result in the creation |
| 26 // of a generic snapshot that contains only the corelibs). | 27 // of a generic snapshot that contains only the corelibs). |
| 27 static char* app_script_name = NULL; | 28 static char* app_script_name = NULL; |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 exit(255); | 268 exit(255); |
| 268 } | 269 } |
| 269 // Now write the snapshot out to specified file and exit. | 270 // Now write the snapshot out to specified file and exit. |
| 270 WriteSnapshotFile(buffer, size); | 271 WriteSnapshotFile(buffer, size); |
| 271 Dart_ExitScope(); | 272 Dart_ExitScope(); |
| 272 | 273 |
| 273 // Shutdown the isolate. | 274 // Shutdown the isolate. |
| 274 Dart_ShutdownIsolate(); | 275 Dart_ShutdownIsolate(); |
| 275 return 0; | 276 return 0; |
| 276 } | 277 } |
| OLD | NEW |