Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(405)

Side by Side Diff: runtime/bin/main.cc

Issue 1661703002: VM: Replace dart --noopt with new binary target dart_noopt. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 if ((precompiled_snapshot_directory[0] == '=') || 336 if ((precompiled_snapshot_directory[0] == '=') ||
337 (precompiled_snapshot_directory[0] == ':')) { 337 (precompiled_snapshot_directory[0] == ':')) {
338 precompiled_snapshot_directory = &precompiled_snapshot_directory[1]; 338 precompiled_snapshot_directory = &precompiled_snapshot_directory[1];
339 } 339 }
340 has_run_precompiled_snapshot = true; 340 has_run_precompiled_snapshot = true;
341 vm_options->AddArgument("--precompilation"); 341 vm_options->AddArgument("--precompilation");
342 return true; 342 return true;
343 } 343 }
344 344
345 345
346 static bool ProcessNooptOption(
347 const char* arg,
348 CommandLineOptions* vm_options) {
349 ASSERT(arg != NULL);
350 if (*arg != '\0') {
351 return false;
352 }
353 has_noopt = true;
354 vm_options->AddArgument("--precompilation");
355 return true;
356 }
357
358
359 static bool ProcessScriptSnapshotOptionHelper(const char* filename, 346 static bool ProcessScriptSnapshotOptionHelper(const char* filename,
360 bool* snapshot_option) { 347 bool* snapshot_option) {
361 *snapshot_option = false; 348 *snapshot_option = false;
362 if ((filename != NULL) && (strlen(filename) != 0)) { 349 if ((filename != NULL) && (strlen(filename) != 0)) {
363 // Ensure that we are already running using a full snapshot. 350 // Ensure that we are already running using a full snapshot.
364 if (isolate_snapshot_buffer == NULL) { 351 if (isolate_snapshot_buffer == NULL) {
365 Log::PrintErr("Script snapshots cannot be generated in this version of" 352 Log::PrintErr("Script snapshots cannot be generated in this version of"
366 " dart\n"); 353 " dart\n");
367 return false; 354 return false;
368 } 355 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 { "--packages=", ProcessPackagesOption }, 467 { "--packages=", ProcessPackagesOption },
481 { "--package-root=", ProcessPackageRootOption }, 468 { "--package-root=", ProcessPackageRootOption },
482 { "-v", ProcessVerboseOption }, 469 { "-v", ProcessVerboseOption },
483 { "--verbose", ProcessVerboseOption }, 470 { "--verbose", ProcessVerboseOption },
484 { "--version", ProcessVersionOption }, 471 { "--version", ProcessVersionOption },
485 472
486 // VM specific options to the standalone dart program. 473 // VM specific options to the standalone dart program.
487 { "--compile_all", ProcessCompileAllOption }, 474 { "--compile_all", ProcessCompileAllOption },
488 { "--enable-vm-service", ProcessEnableVmServiceOption }, 475 { "--enable-vm-service", ProcessEnableVmServiceOption },
489 { "--gen-precompiled-snapshot", ProcessGenPrecompiledSnapshotOption }, 476 { "--gen-precompiled-snapshot", ProcessGenPrecompiledSnapshotOption },
490 { "--noopt", ProcessNooptOption },
491 { "--observe", ProcessObserveOption }, 477 { "--observe", ProcessObserveOption },
492 { "--run-precompiled-snapshot", ProcessRunPrecompiledSnapshotOption }, 478 { "--run-precompiled-snapshot", ProcessRunPrecompiledSnapshotOption },
493 { "--shutdown", ProcessShutdownOption }, 479 { "--shutdown", ProcessShutdownOption },
494 { "--snapshot=", ProcessScriptSnapshotOption }, 480 { "--snapshot=", ProcessScriptSnapshotOption },
495 { "--snapshot-after-run=", ProcessScriptSnapshotAfterRunOption }, 481 { "--snapshot-after-run=", ProcessScriptSnapshotAfterRunOption },
496 { "--trace-loading", ProcessTraceLoadingOption }, 482 { "--trace-loading", ProcessTraceLoadingOption },
497 { NULL, NULL } 483 { NULL, NULL }
498 }; 484 };
499 485
500 486
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 OSError err; 1439 OSError err;
1454 fprintf(stderr, "Error determining current directory: %s\n", err.message()); 1440 fprintf(stderr, "Error determining current directory: %s\n", err.message());
1455 fflush(stderr); 1441 fflush(stderr);
1456 Platform::Exit(kErrorExitCode); 1442 Platform::Exit(kErrorExitCode);
1457 } 1443 }
1458 1444
1459 if (generate_script_snapshot) { 1445 if (generate_script_snapshot) {
1460 vm_options.AddArgument("--load_deferred_eagerly"); 1446 vm_options.AddArgument("--load_deferred_eagerly");
1461 } 1447 }
1462 1448
1449 #if defined(DART_PRECOMPILER) && !defined(DART_NO_SNAPSHOT)
1450 // Always set --precompilation with dart_noopt, unless already set by these
1451 // command line options.
1452 if (!has_gen_precompiled_snapshot &&
1453 !has_run_precompiled_snapshot) {
1454 has_noopt = true;
1455 vm_options.AddArgument("--precompilation");
1456 }
1457 #endif
1458
1463 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); 1459 Dart_SetVMFlags(vm_options.count(), vm_options.arguments());
1464 1460
1465 // Start event handler. 1461 // Start event handler.
1466 TimerUtils::InitOnce(); 1462 TimerUtils::InitOnce();
1467 EventHandler::Start(); 1463 EventHandler::Start();
1468 1464
1469 const uint8_t* instructions_snapshot = NULL; 1465 const uint8_t* instructions_snapshot = NULL;
1470 if (has_run_precompiled_snapshot) { 1466 if (has_run_precompiled_snapshot) {
1471 instructions_snapshot = reinterpret_cast<const uint8_t*>( 1467 instructions_snapshot = reinterpret_cast<const uint8_t*>(
1472 LoadLibrarySymbol(kPrecompiledLibraryName, kPrecompiledSymbolName)); 1468 LoadLibrarySymbol(kPrecompiledLibraryName, kPrecompiledSymbolName));
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 Platform::Exit(Process::GlobalExitCode()); 1533 Platform::Exit(Process::GlobalExitCode());
1538 } 1534 }
1539 1535
1540 } // namespace bin 1536 } // namespace bin
1541 } // namespace dart 1537 } // namespace dart
1542 1538
1543 int main(int argc, char** argv) { 1539 int main(int argc, char** argv) {
1544 dart::bin::main(argc, argv); 1540 dart::bin::main(argc, argv);
1545 UNREACHABLE(); 1541 UNREACHABLE();
1546 } 1542 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698