| 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 #include <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <string.h> | 6 #include <string.h> |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
| 10 #include "include/dart_tools_api.h" | 10 #include "include/dart_tools_api.h" |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 " dart_no_snapshot.\n"); | 333 " dart_no_snapshot.\n"); |
| 334 return false; | 334 return false; |
| 335 } | 335 } |
| 336 ASSERT(arg != NULL); | 336 ASSERT(arg != NULL); |
| 337 if ((arg[0] == '=') || (arg[0] == ':')) { | 337 if ((arg[0] == '=') || (arg[0] == ':')) { |
| 338 precompiled_snapshot_directory = &arg[1]; | 338 precompiled_snapshot_directory = &arg[1]; |
| 339 } else { | 339 } else { |
| 340 precompiled_snapshot_directory = arg; | 340 precompiled_snapshot_directory = arg; |
| 341 } | 341 } |
| 342 gen_precompiled_snapshot = true; | 342 gen_precompiled_snapshot = true; |
| 343 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 344 // The precompiled runtime has FLAG_precompilation set as const. |
| 343 vm_options->AddArgument("--precompilation"); | 345 vm_options->AddArgument("--precompilation"); |
| 346 #endif |
| 344 return true; | 347 return true; |
| 345 } | 348 } |
| 346 | 349 |
| 347 | 350 |
| 348 static bool ProcessRunPrecompiledSnapshotOption( | 351 static bool ProcessRunPrecompiledSnapshotOption( |
| 349 const char* arg, | 352 const char* arg, |
| 350 CommandLineOptions* vm_options) { | 353 CommandLineOptions* vm_options) { |
| 351 ASSERT(arg != NULL); | 354 ASSERT(arg != NULL); |
| 352 precompiled_snapshot_directory = arg; | 355 precompiled_snapshot_directory = arg; |
| 353 if ((precompiled_snapshot_directory[0] == '=') || | 356 if ((precompiled_snapshot_directory[0] == '=') || |
| 354 (precompiled_snapshot_directory[0] == ':')) { | 357 (precompiled_snapshot_directory[0] == ':')) { |
| 355 precompiled_snapshot_directory = &precompiled_snapshot_directory[1]; | 358 precompiled_snapshot_directory = &precompiled_snapshot_directory[1]; |
| 356 } | 359 } |
| 357 run_precompiled_snapshot = true; | 360 run_precompiled_snapshot = true; |
| 361 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 362 // The precompiled runtime has FLAG_precompilation set as const. |
| 358 vm_options->AddArgument("--precompilation"); | 363 vm_options->AddArgument("--precompilation"); |
| 364 #endif |
| 359 return true; | 365 return true; |
| 360 } | 366 } |
| 361 | 367 |
| 362 | 368 |
| 363 static bool ProcessSnapshotOptionHelper(const char* filename, | 369 static bool ProcessSnapshotOptionHelper(const char* filename, |
| 364 bool* snapshot_option) { | 370 bool* snapshot_option) { |
| 365 ASSERT((filename != NULL) && (strlen(filename) != 0)); | 371 ASSERT((filename != NULL) && (strlen(filename) != 0)); |
| 366 snapshot_filename = filename; | 372 snapshot_filename = filename; |
| 367 *snapshot_option = true; | 373 *snapshot_option = true; |
| 368 if (generate_script_snapshot && generate_full_snapshot_after_run) { | 374 if (generate_script_snapshot && generate_full_snapshot_after_run) { |
| (...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1549 | 1555 |
| 1550 Thread::InitOnce(); | 1556 Thread::InitOnce(); |
| 1551 | 1557 |
| 1552 if (!DartUtils::SetOriginalWorkingDirectory()) { | 1558 if (!DartUtils::SetOriginalWorkingDirectory()) { |
| 1553 OSError err; | 1559 OSError err; |
| 1554 fprintf(stderr, "Error determining current directory: %s\n", err.message()); | 1560 fprintf(stderr, "Error determining current directory: %s\n", err.message()); |
| 1555 fflush(stderr); | 1561 fflush(stderr); |
| 1556 Platform::Exit(kErrorExitCode); | 1562 Platform::Exit(kErrorExitCode); |
| 1557 } | 1563 } |
| 1558 | 1564 |
| 1565 #if !defined(PRODUCT) |
| 1566 // Constant true in PRODUCT mode. |
| 1559 if (generate_script_snapshot || | 1567 if (generate_script_snapshot || |
| 1560 generate_full_snapshot_after_run || | 1568 generate_full_snapshot_after_run || |
| 1561 run_full_snapshot) { | 1569 run_full_snapshot) { |
| 1562 vm_options.AddArgument("--load_deferred_eagerly"); | 1570 vm_options.AddArgument("--load_deferred_eagerly"); |
| 1563 } | 1571 } |
| 1572 #endif |
| 1564 | 1573 |
| 1565 #if defined(DART_PRECOMPILER) && !defined(DART_NO_SNAPSHOT) | 1574 #if defined(DART_PRECOMPILER) && !defined(DART_NO_SNAPSHOT) |
| 1566 // Always set --precompilation with dart_noopt. | 1575 // Always set --precompilation with dart_noopt. |
| 1567 ASSERT(!gen_precompiled_snapshot && !run_precompiled_snapshot); | 1576 ASSERT(!gen_precompiled_snapshot && !run_precompiled_snapshot); |
| 1568 vm_options.AddArgument("--precompilation"); | 1577 vm_options.AddArgument("--precompilation"); |
| 1569 #endif | 1578 #endif |
| 1570 | 1579 |
| 1571 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); | 1580 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); |
| 1572 | 1581 |
| 1573 // Start event handler. | 1582 // Start event handler. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1666 Platform::Exit(Process::GlobalExitCode()); | 1675 Platform::Exit(Process::GlobalExitCode()); |
| 1667 } | 1676 } |
| 1668 | 1677 |
| 1669 } // namespace bin | 1678 } // namespace bin |
| 1670 } // namespace dart | 1679 } // namespace dart |
| 1671 | 1680 |
| 1672 int main(int argc, char** argv) { | 1681 int main(int argc, char** argv) { |
| 1673 dart::bin::main(argc, argv); | 1682 dart::bin::main(argc, argv); |
| 1674 UNREACHABLE(); | 1683 UNREACHABLE(); |
| 1675 } | 1684 } |
| OLD | NEW |