| 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 } | 324 } |
| 325 | 325 |
| 326 if (snapshot_filename == NULL) { | 326 if (snapshot_filename == NULL) { |
| 327 fprintf(stderr, "No snapshot output file specified\n"); | 327 fprintf(stderr, "No snapshot output file specified\n"); |
| 328 return 255; | 328 return 255; |
| 329 } | 329 } |
| 330 | 330 |
| 331 // Initialize the Dart VM (TODO(asiva) - remove const_cast once | 331 // Initialize the Dart VM (TODO(asiva) - remove const_cast once |
| 332 // dart API is fixed to take a const char** in Dart_Initialize). | 332 // dart API is fixed to take a const char** in Dart_Initialize). |
| 333 Dart_Initialize(vm_options.count(), | 333 Dart_Initialize(vm_options.count(), |
| 334 const_cast<char**>(vm_options.arguments()), | 334 vm_options.arguments(), |
| 335 SnapshotCreateCallback); | 335 SnapshotCreateCallback); |
| 336 | 336 |
| 337 // Create an isolate. As a side effect, SnapshotCreateCallback | 337 // Create an isolate. As a side effect, SnapshotCreateCallback |
| 338 // gets called, which loads the script (if one is specified), its libraries | 338 // gets called, which loads the script (if one is specified), its libraries |
| 339 // and writes out a snapshot. | 339 // and writes out a snapshot. |
| 340 Dart_Isolate isolate = Dart_CreateIsolate(NULL, script_name); | 340 Dart_Isolate isolate = Dart_CreateIsolate(NULL, script_name); |
| 341 if (isolate == NULL) { | 341 if (isolate == NULL) { |
| 342 return 255; | 342 return 255; |
| 343 } | 343 } |
| 344 | 344 |
| 345 // Shutdown the isolate. | 345 // Shutdown the isolate. |
| 346 Dart_ShutdownIsolate(); | 346 Dart_ShutdownIsolate(); |
| 347 return 0; | 347 return 0; |
| 348 } | 348 } |
| OLD | NEW |