| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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> |
| 11 | 11 |
| 12 #include "include/dart_api.h" | 12 #include "include/dart_api.h" |
| 13 | 13 |
| 14 #include "bin/builtin.h" | 14 #include "bin/builtin.h" |
| 15 #include "bin/dartutils.h" | 15 #include "bin/dartutils.h" |
| 16 #include "bin/file.h" | 16 #include "bin/file.h" |
| 17 #include "bin/log.h" | 17 #include "bin/log.h" |
| 18 #include "bin/thread.h" |
| 18 | 19 |
| 19 #include "platform/globals.h" | 20 #include "platform/globals.h" |
| 20 | 21 |
| 21 | 22 |
| 22 namespace dart { | 23 namespace dart { |
| 23 namespace bin { | 24 namespace bin { |
| 24 | 25 |
| 25 #define CHECK_RESULT(result) \ | 26 #define CHECK_RESULT(result) \ |
| 26 if (Dart_IsError(result)) { \ | 27 if (Dart_IsError(result)) { \ |
| 27 free(snapshot_buffer); \ | 28 free(snapshot_buffer); \ |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 | 489 |
| 489 // Parse command line arguments. | 490 // Parse command line arguments. |
| 490 if (ParseArguments(argc, | 491 if (ParseArguments(argc, |
| 491 argv, | 492 argv, |
| 492 &vm_options, | 493 &vm_options, |
| 493 &app_script_name) < 0) { | 494 &app_script_name) < 0) { |
| 494 PrintUsage(); | 495 PrintUsage(); |
| 495 return 255; | 496 return 255; |
| 496 } | 497 } |
| 497 | 498 |
| 499 Thread::InitOnce(); |
| 498 DartUtils::SetOriginalWorkingDirectory(); | 500 DartUtils::SetOriginalWorkingDirectory(); |
| 499 | 501 |
| 500 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); | 502 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); |
| 501 | 503 |
| 502 // Initialize the Dart VM. | 504 // Initialize the Dart VM. |
| 503 // Note: We don't expect isolates to be created from dart code during | 505 // Note: We don't expect isolates to be created from dart code during |
| 504 // snapshot generation. | 506 // snapshot generation. |
| 505 if (!Dart_Initialize(NULL, NULL, NULL, NULL, | 507 if (!Dart_Initialize(NULL, NULL, NULL, NULL, |
| 506 DartUtils::OpenFile, | 508 DartUtils::OpenFile, |
| 507 DartUtils::ReadFile, | 509 DartUtils::ReadFile, |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 } | 583 } |
| 582 return 0; | 584 return 0; |
| 583 } | 585 } |
| 584 | 586 |
| 585 } // namespace bin | 587 } // namespace bin |
| 586 } // namespace dart | 588 } // namespace dart |
| 587 | 589 |
| 588 int main(int argc, char** argv) { | 590 int main(int argc, char** argv) { |
| 589 return dart::bin::main(argc, argv); | 591 return dart::bin::main(argc, argv); |
| 590 } | 592 } |
| OLD | NEW |