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

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

Issue 2327693002: Add --parse-all option in order to benchmark and measure the scanner/parser performance. (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « no previous file | runtime/include/dart_native_api.h » ('j') | runtime/vm/compiler.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 // Value of the --packages flag. 72 // Value of the --packages flag.
73 // (This pointer points into an argv buffer and does not need to be 73 // (This pointer points into an argv buffer and does not need to be
74 // free'd.) 74 // free'd.)
75 static const char* commandline_packages_file = NULL; 75 static const char* commandline_packages_file = NULL;
76 76
77 77
78 // Global flag that is used to indicate that we want to compile all the 78 // Global flag that is used to indicate that we want to compile all the
79 // dart functions and not run anything. 79 // dart functions and not run anything.
80 static bool compile_all = false; 80 static bool compile_all = false;
81 static bool parse_all = false;
81 82
82 83
83 // Global flag that is used to indicate that we want to use blobs/mmap instead 84 // Global flag that is used to indicate that we want to use blobs/mmap instead
84 // of assembly/shared libraries for precompilation. 85 // of assembly/shared libraries for precompilation.
85 static bool use_blobs = false; 86 static bool use_blobs = false;
86 87
87 88
88 // Global flag that is used to indicate that we want to compile everything in 89 // Global flag that is used to indicate that we want to compile everything in
89 // the same way as precompilation before main, then continue running in the 90 // the same way as precompilation before main, then continue running in the
90 // same process. 91 // same process.
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 CommandLineOptions* vm_options) { 318 CommandLineOptions* vm_options) {
318 ASSERT(arg != NULL); 319 ASSERT(arg != NULL);
319 if (*arg != '\0') { 320 if (*arg != '\0') {
320 return false; 321 return false;
321 } 322 }
322 compile_all = true; 323 compile_all = true;
323 return true; 324 return true;
324 } 325 }
325 326
326 327
328 static bool ProcessParseAllOption(const char* arg,
329 CommandLineOptions* vm_options) {
330 ASSERT(arg != NULL);
331 if (*arg != '\0') {
332 return false;
333 }
334 parse_all = true;
335 return true;
336 }
337
338
327 static bool ProcessUseBlobsOption(const char* arg, 339 static bool ProcessUseBlobsOption(const char* arg,
328 CommandLineOptions* vm_options) { 340 CommandLineOptions* vm_options) {
329 ASSERT(arg != NULL); 341 ASSERT(arg != NULL);
330 if (*arg != '\0') { 342 if (*arg != '\0') {
331 return false; 343 return false;
332 } 344 }
333 use_blobs = true; 345 use_blobs = true;
334 return true; 346 return true;
335 } 347 }
336 348
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 { "-h", ProcessHelpOption }, 515 { "-h", ProcessHelpOption },
504 { "--help", ProcessHelpOption }, 516 { "--help", ProcessHelpOption },
505 { "--packages=", ProcessPackagesOption }, 517 { "--packages=", ProcessPackagesOption },
506 { "--package-root=", ProcessPackageRootOption }, 518 { "--package-root=", ProcessPackageRootOption },
507 { "-v", ProcessVerboseOption }, 519 { "-v", ProcessVerboseOption },
508 { "--verbose", ProcessVerboseOption }, 520 { "--verbose", ProcessVerboseOption },
509 { "--version", ProcessVersionOption }, 521 { "--version", ProcessVersionOption },
510 522
511 // VM specific options to the standalone dart program. 523 // VM specific options to the standalone dart program.
512 { "--compile_all", ProcessCompileAllOption }, 524 { "--compile_all", ProcessCompileAllOption },
525 { "--parse_all", ProcessParseAllOption },
513 { "--enable-vm-service", ProcessEnableVmServiceOption }, 526 { "--enable-vm-service", ProcessEnableVmServiceOption },
514 { "--disable-service-origin-check", ProcessDisableServiceOriginCheckOption }, 527 { "--disable-service-origin-check", ProcessDisableServiceOriginCheckOption },
515 { "--observe", ProcessObserveOption }, 528 { "--observe", ProcessObserveOption },
516 { "--snapshot=", ProcessSnapshotFilenameOption }, 529 { "--snapshot=", ProcessSnapshotFilenameOption },
517 { "--snapshot-kind=", ProcessSnapshotKindOption }, 530 { "--snapshot-kind=", ProcessSnapshotKindOption },
518 { "--run-app-snapshot=", ProcessRunAppSnapshotOption }, 531 { "--run-app-snapshot=", ProcessRunAppSnapshotOption },
519 { "--use-blobs", ProcessUseBlobsOption }, 532 { "--use-blobs", ProcessUseBlobsOption },
520 { "--trace-loading", ProcessTraceLoadingOption }, 533 { "--trace-loading", ProcessTraceLoadingOption },
521 { "--hot-reload-test-mode", ProcessHotReloadTestModeOption }, 534 { "--hot-reload-test-mode", ProcessHotReloadTestModeOption },
522 { "--hot-reload-rollback-test-mode", ProcessHotReloadRollbackTestModeOption }, 535 { "--hot-reload-rollback-test-mode", ProcessHotReloadRollbackTestModeOption },
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 if (Dart_IsServiceIsolate(isolate)) { 801 if (Dart_IsServiceIsolate(isolate)) {
789 // If this is the service isolate, load embedder specific bits and return. 802 // If this is the service isolate, load embedder specific bits and return.
790 bool skip_library_load = run_app_snapshot; 803 bool skip_library_load = run_app_snapshot;
791 if (!VmService::Setup(vm_service_server_ip, 804 if (!VmService::Setup(vm_service_server_ip,
792 vm_service_server_port, 805 vm_service_server_port,
793 skip_library_load, 806 skip_library_load,
794 vm_service_dev_mode)) { 807 vm_service_dev_mode)) {
795 *error = strdup(VmService::GetErrorMessage()); 808 *error = strdup(VmService::GetErrorMessage());
796 return NULL; 809 return NULL;
797 } 810 }
811 #if 0
hausner 2016/09/09 16:31:07 Maybe remove this entirely in a separate change?
siva 2016/09/23 00:04:03 Removed the #if 0 ... #endif as I added a --parse-
798 if (compile_all) { 812 if (compile_all) {
799 result = Dart_CompileAll(); 813 result = Dart_CompileAll();
800 CHECK_RESULT(result); 814 CHECK_RESULT(result);
801 } 815 }
816 #endif
802 Dart_ExitScope(); 817 Dart_ExitScope();
803 Dart_ExitIsolate(); 818 Dart_ExitIsolate();
804 return isolate; 819 return isolate;
805 } 820 }
806 821
807 // Prepare builtin and other core libraries for use to resolve URIs. 822 // Prepare builtin and other core libraries for use to resolve URIs.
808 // Set up various closures, e.g: printing, timers etc. 823 // Set up various closures, e.g: printing, timers etc.
809 // Set up 'package root' for URI resolution. 824 // Set up 'package root' for URI resolution.
810 result = DartUtils::PrepareForScriptLoading(false, trace_loading); 825 result = DartUtils::PrepareForScriptLoading(false, trace_loading);
811 CHECK_RESULT(result); 826 CHECK_RESULT(result);
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 "VM service loading failed: %s\n", 1471 "VM service loading failed: %s\n",
1457 VmService::GetErrorMessage()); 1472 VmService::GetErrorMessage());
1458 fflush(stderr); 1473 fflush(stderr);
1459 exit(kErrorExitCode); 1474 exit(kErrorExitCode);
1460 } 1475 }
1461 } 1476 }
1462 1477
1463 if (compile_all) { 1478 if (compile_all) {
1464 result = Dart_CompileAll(); 1479 result = Dart_CompileAll();
1465 CHECK_RESULT(result); 1480 CHECK_RESULT(result);
1481 Dart_ExitScope();
hausner 2016/09/09 17:30:51 This will actually break tests that execute the co
siva 2016/09/23 00:04:03 Removed this as compile_all is unchanged.
1482 // Shutdown the isolate.
1483 Dart_ShutdownIsolate();
1484 return false;
1485 }
1486
1487 if (parse_all) {
1488 result = Dart_ParseAll();
1489 CHECK_RESULT(result);
1490 Dart_ExitScope();
1491 // Shutdown the isolate.
1492 Dart_ShutdownIsolate();
1493 return false;
1466 } 1494 }
1467 1495
1468 if (is_noopt || (gen_snapshot_kind == kAppAOT)) { 1496 if (is_noopt || (gen_snapshot_kind == kAppAOT)) {
1469 Dart_QualifiedFunctionName standalone_entry_points[] = { 1497 Dart_QualifiedFunctionName standalone_entry_points[] = {
1470 { "dart:_builtin", "::", "_getMainClosure" }, 1498 { "dart:_builtin", "::", "_getMainClosure" },
1471 { "dart:_builtin", "::", "_getPrintClosure" }, 1499 { "dart:_builtin", "::", "_getPrintClosure" },
1472 { "dart:_builtin", "::", "_getUriBaseClosure" }, 1500 { "dart:_builtin", "::", "_getUriBaseClosure" },
1473 { "dart:_builtin", "::", "_resolveInWorkingDirectory" }, 1501 { "dart:_builtin", "::", "_resolveInWorkingDirectory" },
1474 { "dart:_builtin", "::", "_setWorkingDirectory" }, 1502 { "dart:_builtin", "::", "_setWorkingDirectory" },
1475 { "dart:_builtin", "::", "_setPackageRoot" }, 1503 { "dart:_builtin", "::", "_setPackageRoot" },
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1817 Platform::Exit(Process::GlobalExitCode()); 1845 Platform::Exit(Process::GlobalExitCode());
1818 } 1846 }
1819 1847
1820 } // namespace bin 1848 } // namespace bin
1821 } // namespace dart 1849 } // namespace dart
1822 1850
1823 int main(int argc, char** argv) { 1851 int main(int argc, char** argv) {
1824 dart::bin::main(argc, argv); 1852 dart::bin::main(argc, argv);
1825 UNREACHABLE(); 1853 UNREACHABLE();
1826 } 1854 }
OLDNEW
« no previous file with comments | « no previous file | runtime/include/dart_native_api.h » ('j') | runtime/vm/compiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698