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