| 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 } else { | 283 } else { |
| 284 // This is a generic dart snapshot which needs builtin library setup. | 284 // This is a generic dart snapshot which needs builtin library setup. |
| 285 library = LoadGenericSnapshotCreationScript(Builtin::kBuiltinLibrary); | 285 library = LoadGenericSnapshotCreationScript(Builtin::kBuiltinLibrary); |
| 286 VerifyLoaded(library); | 286 VerifyLoaded(library); |
| 287 library = LoadGenericSnapshotCreationScript(Builtin::kIOLibrary); | 287 library = LoadGenericSnapshotCreationScript(Builtin::kIOLibrary); |
| 288 VerifyLoaded(library); | 288 VerifyLoaded(library); |
| 289 library = LoadGenericSnapshotCreationScript(Builtin::kJsonLibrary); | 289 library = LoadGenericSnapshotCreationScript(Builtin::kJsonLibrary); |
| 290 VerifyLoaded(library); | 290 VerifyLoaded(library); |
| 291 library = LoadGenericSnapshotCreationScript(Builtin::kUriLibrary); | 291 library = LoadGenericSnapshotCreationScript(Builtin::kUriLibrary); |
| 292 VerifyLoaded(library); | 292 VerifyLoaded(library); |
| 293 library = LoadGenericSnapshotCreationScript(Builtin::kUtf8Library); | 293 library = LoadGenericSnapshotCreationScript(Builtin::kUtfLibrary); |
| 294 VerifyLoaded(library); | 294 VerifyLoaded(library); |
| 295 } | 295 } |
| 296 | 296 |
| 297 uint8_t* buffer = NULL; | 297 uint8_t* buffer = NULL; |
| 298 intptr_t size = 0; | 298 intptr_t size = 0; |
| 299 // First create the snapshot. | 299 // First create the snapshot. |
| 300 result = Dart_CreateSnapshot(&buffer, &size); | 300 result = Dart_CreateSnapshot(&buffer, &size); |
| 301 if (Dart_IsError(result)) { | 301 if (Dart_IsError(result)) { |
| 302 const char* err_msg = Dart_GetError(result); | 302 const char* err_msg = Dart_GetError(result); |
| 303 fprintf(stderr, "Error while creating snapshot: %s\n", err_msg); | 303 fprintf(stderr, "Error while creating snapshot: %s\n", err_msg); |
| 304 Dart_ExitScope(); | 304 Dart_ExitScope(); |
| 305 Dart_ShutdownIsolate(); | 305 Dart_ShutdownIsolate(); |
| 306 exit(255); | 306 exit(255); |
| 307 } | 307 } |
| 308 // Now write the snapshot out to specified file and exit. | 308 // Now write the snapshot out to specified file and exit. |
| 309 WriteSnapshotFile(buffer, size); | 309 WriteSnapshotFile(buffer, size); |
| 310 Dart_ExitScope(); | 310 Dart_ExitScope(); |
| 311 | 311 |
| 312 // Shutdown the isolate. | 312 // Shutdown the isolate. |
| 313 Dart_ShutdownIsolate(); | 313 Dart_ShutdownIsolate(); |
| 314 return 0; | 314 return 0; |
| 315 } | 315 } |
| OLD | NEW |