| 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> |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 if (snapshot_filename == NULL) { | 218 if (snapshot_filename == NULL) { |
| 219 fprintf(stderr, "No snapshot output file specified\n"); | 219 fprintf(stderr, "No snapshot output file specified\n"); |
| 220 return 255; | 220 return 255; |
| 221 } | 221 } |
| 222 | 222 |
| 223 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); | 223 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); |
| 224 | 224 |
| 225 // Initialize the Dart VM. | 225 // Initialize the Dart VM. |
| 226 // Note: We don't expect isolates to be created from dart code during | 226 // Note: We don't expect isolates to be created from dart code during |
| 227 // snapshot generation. | 227 // snapshot generation. |
| 228 Dart_Initialize(NULL); | 228 Dart_Initialize(NULL, NULL); |
| 229 | 229 |
| 230 char* error; | 230 char* error; |
| 231 Dart_Isolate isolate = Dart_CreateIsolate(NULL, NULL, &error); | 231 Dart_Isolate isolate = Dart_CreateIsolate(NULL, NULL, &error); |
| 232 if (isolate == NULL) { | 232 if (isolate == NULL) { |
| 233 fprintf(stderr, "%s", error); | 233 fprintf(stderr, "%s", error); |
| 234 free(error); | 234 free(error); |
| 235 exit(255); | 235 exit(255); |
| 236 } | 236 } |
| 237 | 237 |
| 238 Dart_Handle result; | 238 Dart_Handle result; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 268 exit(255); | 268 exit(255); |
| 269 } | 269 } |
| 270 // Now write the snapshot out to specified file and exit. | 270 // Now write the snapshot out to specified file and exit. |
| 271 WriteSnapshotFile(buffer, size); | 271 WriteSnapshotFile(buffer, size); |
| 272 Dart_ExitScope(); | 272 Dart_ExitScope(); |
| 273 | 273 |
| 274 // Shutdown the isolate. | 274 // Shutdown the isolate. |
| 275 Dart_ShutdownIsolate(); | 275 Dart_ShutdownIsolate(); |
| 276 return 0; | 276 return 0; |
| 277 } | 277 } |
| OLD | NEW |