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