| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 | 267 |
| 268 ASSERT(snapshot_filename != NULL); | 268 ASSERT(snapshot_filename != NULL); |
| 269 // Load up the script before a snapshot is created. | 269 // Load up the script before a snapshot is created. |
| 270 if (app_script_name != NULL) { | 270 if (app_script_name != NULL) { |
| 271 // Load the specified script. | 271 // Load the specified script. |
| 272 library = LoadSnapshotCreationScript(app_script_name); | 272 library = LoadSnapshotCreationScript(app_script_name); |
| 273 VerifyLoaded(library); | 273 VerifyLoaded(library); |
| 274 } else { | 274 } else { |
| 275 // Load a dummy script as the script to setup the tag handler. | 275 // Load a dummy script as the script to setup the tag handler. |
| 276 Dart_Handle empty_string = Dart_NewString(""); | 276 Dart_Handle empty_string = Dart_NewString(""); |
| 277 Dart_Handle import_map = Dart_NewList(0); | 277 library = Dart_LoadScript(empty_string, |
| 278 Dart_Handle lib = Dart_LoadScript(empty_string, | |
| 279 empty_string, | 278 empty_string, |
| 280 BuiltinLibraryTagHandler, | 279 BuiltinLibraryTagHandler, |
| 281 import_map); | 280 Dart_Null()); |
| 282 USE(lib); | 281 VerifyLoaded(library); |
| 283 // This is a generic dart snapshot which needs builtin library setup. | 282 // This is a generic dart snapshot which needs builtin library setup. |
| 284 library = LoadGenericSnapshotCreationScript(Builtin::kBuiltinLibrary); | 283 library = LoadGenericSnapshotCreationScript(Builtin::kBuiltinLibrary); |
| 285 VerifyLoaded(library); | 284 VerifyLoaded(library); |
| 286 library = LoadGenericSnapshotCreationScript(Builtin::kIOLibrary); | 285 library = LoadGenericSnapshotCreationScript(Builtin::kIOLibrary); |
| 287 VerifyLoaded(library); | 286 VerifyLoaded(library); |
| 288 library = LoadGenericSnapshotCreationScript(Builtin::kJsonLibrary); | 287 library = LoadGenericSnapshotCreationScript(Builtin::kJsonLibrary); |
| 289 VerifyLoaded(library); | 288 VerifyLoaded(library); |
| 290 library = LoadGenericSnapshotCreationScript(Builtin::kUriLibrary); | 289 library = LoadGenericSnapshotCreationScript(Builtin::kUriLibrary); |
| 291 VerifyLoaded(library); | 290 VerifyLoaded(library); |
| 292 library = LoadGenericSnapshotCreationScript(Builtin::kUtf8Library); | 291 library = LoadGenericSnapshotCreationScript(Builtin::kUtf8Library); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 305 exit(255); | 304 exit(255); |
| 306 } | 305 } |
| 307 // Now write the snapshot out to specified file and exit. | 306 // Now write the snapshot out to specified file and exit. |
| 308 WriteSnapshotFile(buffer, size); | 307 WriteSnapshotFile(buffer, size); |
| 309 Dart_ExitScope(); | 308 Dart_ExitScope(); |
| 310 | 309 |
| 311 // Shutdown the isolate. | 310 // Shutdown the isolate. |
| 312 Dart_ShutdownIsolate(); | 311 Dart_ShutdownIsolate(); |
| 313 return 0; | 312 return 0; |
| 314 } | 313 } |
| OLD | NEW |