| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 if (snapshot_filename == NULL) { | 248 if (snapshot_filename == NULL) { |
| 249 fprintf(stderr, "No snapshot output file specified\n"); | 249 fprintf(stderr, "No snapshot output file specified\n"); |
| 250 return 255; | 250 return 255; |
| 251 } | 251 } |
| 252 | 252 |
| 253 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); | 253 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); |
| 254 | 254 |
| 255 // Initialize the Dart VM. | 255 // Initialize the Dart VM. |
| 256 // Note: We don't expect isolates to be created from dart code during | 256 // Note: We don't expect isolates to be created from dart code during |
| 257 // snapshot generation. | 257 // snapshot generation. |
| 258 Dart_Initialize(NULL, NULL); | 258 Dart_Initialize(NULL, NULL, NULL); |
| 259 | 259 |
| 260 char* error; | 260 char* error; |
| 261 Dart_Isolate isolate = Dart_CreateIsolate(NULL, NULL, NULL, NULL, &error); | 261 Dart_Isolate isolate = Dart_CreateIsolate(NULL, NULL, NULL, NULL, &error); |
| 262 if (isolate == NULL) { | 262 if (isolate == NULL) { |
| 263 fprintf(stderr, "%s", error); | 263 fprintf(stderr, "%s", error); |
| 264 free(error); | 264 free(error); |
| 265 exit(255); | 265 exit(255); |
| 266 } | 266 } |
| 267 | 267 |
| 268 Dart_Handle result; | 268 Dart_Handle result; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 exit(255); | 320 exit(255); |
| 321 } | 321 } |
| 322 // Now write the snapshot out to specified file and exit. | 322 // Now write the snapshot out to specified file and exit. |
| 323 WriteSnapshotFile(buffer, size); | 323 WriteSnapshotFile(buffer, size); |
| 324 Dart_ExitScope(); | 324 Dart_ExitScope(); |
| 325 | 325 |
| 326 // Shutdown the isolate. | 326 // Shutdown the isolate. |
| 327 Dart_ShutdownIsolate(); | 327 Dart_ShutdownIsolate(); |
| 328 return 0; | 328 return 0; |
| 329 } | 329 } |
| OLD | NEW |