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

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

Issue 1902073003: VM: Remove redundant build target dart_product. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 " dart_bootstrap\n"); 403 " dart_bootstrap\n");
404 return false; 404 return false;
405 } 405 }
406 return ProcessSnapshotOptionHelper(filename, 406 return ProcessSnapshotOptionHelper(filename,
407 &generate_full_snapshot_after_run); 407 &generate_full_snapshot_after_run);
408 } 408 }
409 409
410 410
411 static bool ProcessRunFullSnapshotOption( 411 static bool ProcessRunFullSnapshotOption(
412 const char* filename, CommandLineOptions* vm_options) { 412 const char* filename, CommandLineOptions* vm_options) {
413 #ifndef DART_PRODUCT_BINARY 413 #if !defined(PRODUCT)
414 Log::PrintErr("Full Application snapshots can only be be run with" 414 Log::PrintErr("Full Application snapshots can only be be run with"
415 " dart_product\n"); 415 " product mode\n");
416 return false; 416 return false;
417 #else 417 #else
418 return ProcessSnapshotOptionHelper(filename, &run_full_snapshot); 418 return ProcessSnapshotOptionHelper(filename, &run_full_snapshot);
419 #endif // defined(DART_PRODUCT_BINARY) 419 #endif // defined(PRODUCT)
420 } 420 }
421 421
422 422
423 static bool ProcessEnableVmServiceOption(const char* option_value, 423 static bool ProcessEnableVmServiceOption(const char* option_value,
424 CommandLineOptions* vm_options) { 424 CommandLineOptions* vm_options) {
425 ASSERT(option_value != NULL); 425 ASSERT(option_value != NULL);
426 426
427 if (!ExtractPortAndIP(option_value, 427 if (!ExtractPortAndIP(option_value,
428 &vm_service_server_port, 428 &vm_service_server_port,
429 &vm_service_server_ip, 429 &vm_service_server_ip,
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 // Returns true on success, false on failure. 739 // Returns true on success, false on failure.
740 static Dart_Isolate CreateIsolateAndSetupHelper(const char* script_uri, 740 static Dart_Isolate CreateIsolateAndSetupHelper(const char* script_uri,
741 const char* main, 741 const char* main,
742 const char* package_root, 742 const char* package_root,
743 const char* packages_config, 743 const char* packages_config,
744 Dart_IsolateFlags* flags, 744 Dart_IsolateFlags* flags,
745 char** error, 745 char** error,
746 int* exit_code) { 746 int* exit_code) {
747 ASSERT(script_uri != NULL); 747 ASSERT(script_uri != NULL);
748 748
749 #if defined(DART_PRODUCT_BINARY) 749 #if defined(PRODUCT)
750 const bool run_service_isolate = false;
751 #elif defined(PRODUCT)
752 const bool run_service_isolate = !run_full_snapshot && 750 const bool run_service_isolate = !run_full_snapshot &&
753 !run_precompiled_snapshot; 751 !run_precompiled_snapshot;
754 #else 752 #else
755 const bool run_service_isolate = !run_full_snapshot; 753 const bool run_service_isolate = !run_full_snapshot;
756 #endif 754 #endif // PRODUCT
757 if (!run_service_isolate && 755 if (!run_service_isolate &&
758 (strcmp(script_uri, DART_VM_SERVICE_ISOLATE_NAME) == 0)) { 756 (strcmp(script_uri, DART_VM_SERVICE_ISOLATE_NAME) == 0)) {
759 // We do not create a service isolate when running a full application 757 // We do not create a service isolate when running a full application
760 // snapshot or a precompiled snapshot in product mode. 758 // snapshot or a precompiled snapshot in product mode.
761 return NULL; 759 return NULL;
762 } 760 }
763 761
764 IsolateData* isolate_data = new IsolateData(script_uri, 762 IsolateData* isolate_data = new IsolateData(script_uri,
765 package_root, 763 package_root,
766 packages_config); 764 packages_config);
(...skipping 13 matching lines...) Expand all
780 if (isolate_snapshot_buffer != NULL) { 778 if (isolate_snapshot_buffer != NULL) {
781 // Setup the native resolver as the snapshot does not carry it. 779 // Setup the native resolver as the snapshot does not carry it.
782 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); 780 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary);
783 Builtin::SetNativeResolver(Builtin::kIOLibrary); 781 Builtin::SetNativeResolver(Builtin::kIOLibrary);
784 } 782 }
785 783
786 // Set up the library tag handler for this isolate. 784 // Set up the library tag handler for this isolate.
787 Dart_Handle result = Dart_SetLibraryTagHandler(DartUtils::LibraryTagHandler); 785 Dart_Handle result = Dart_SetLibraryTagHandler(DartUtils::LibraryTagHandler);
788 CHECK_RESULT(result); 786 CHECK_RESULT(result);
789 787
790 #if defined(DART_PRODUCT_BINARY)
791 ASSERT(!Dart_IsServiceIsolate(isolate));
792 #else
793 if (Dart_IsServiceIsolate(isolate)) { 788 if (Dart_IsServiceIsolate(isolate)) {
794 // If this is the service isolate, load embedder specific bits and return. 789 // If this is the service isolate, load embedder specific bits and return.
795 if (!VmService::Setup(vm_service_server_ip, 790 if (!VmService::Setup(vm_service_server_ip,
796 vm_service_server_port, 791 vm_service_server_port,
797 run_precompiled_snapshot)) { 792 run_precompiled_snapshot)) {
798 *error = strdup(VmService::GetErrorMessage()); 793 *error = strdup(VmService::GetErrorMessage());
799 return NULL; 794 return NULL;
800 } 795 }
801 if (compile_all) { 796 if (compile_all) {
802 result = Dart_CompileAll(); 797 result = Dart_CompileAll();
803 CHECK_RESULT(result); 798 CHECK_RESULT(result);
804 } 799 }
805 Dart_ExitScope(); 800 Dart_ExitScope();
806 Dart_ExitIsolate(); 801 Dart_ExitIsolate();
807 return isolate; 802 return isolate;
808 } 803 }
809 #endif // defined(DART_PRODUCT_BINARY)
810 804
811 // Prepare builtin and other core libraries for use to resolve URIs. 805 // Prepare builtin and other core libraries for use to resolve URIs.
812 // Set up various closures, e.g: printing, timers etc. 806 // Set up various closures, e.g: printing, timers etc.
813 // Set up 'package root' for URI resolution. 807 // Set up 'package root' for URI resolution.
814 result = DartUtils::PrepareForScriptLoading(false, trace_loading); 808 result = DartUtils::PrepareForScriptLoading(false, trace_loading);
815 CHECK_RESULT(result); 809 CHECK_RESULT(result);
816 810
817 if (!run_precompiled_snapshot && !run_full_snapshot) { 811 if (!run_precompiled_snapshot && !run_full_snapshot) {
818 // Set up the load port provided by the service isolate so that we can 812 // Set up the load port provided by the service isolate so that we can
819 // load scripts. 813 // load scripts.
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 GenerateScriptSnapshot(); 1294 GenerateScriptSnapshot();
1301 } else { 1295 } else {
1302 // Lookup the library of the root script. 1296 // Lookup the library of the root script.
1303 Dart_Handle root_lib = Dart_RootLibrary(); 1297 Dart_Handle root_lib = Dart_RootLibrary();
1304 // Import the root library into the builtin library so that we can easily 1298 // Import the root library into the builtin library so that we can easily
1305 // lookup the main entry point exported from the root library. 1299 // lookup the main entry point exported from the root library.
1306 IsolateData* isolate_data = 1300 IsolateData* isolate_data =
1307 reinterpret_cast<IsolateData*>(Dart_IsolateData(isolate)); 1301 reinterpret_cast<IsolateData*>(Dart_IsolateData(isolate));
1308 result = Dart_LibraryImportLibrary( 1302 result = Dart_LibraryImportLibrary(
1309 isolate_data->builtin_lib(), root_lib, Dart_Null()); 1303 isolate_data->builtin_lib(), root_lib, Dart_Null());
1310 #if !defined(DART_PRODUCT_BINARY) && !defined(PRODUCT) 1304 #if !defined(PRODUCT)
1311 if (is_noopt || gen_precompiled_snapshot) { 1305 if (is_noopt || gen_precompiled_snapshot) {
1312 // Load the embedder's portion of the VM service's Dart code so it will 1306 // Load the embedder's portion of the VM service's Dart code so it will
1313 // be included in the precompiled snapshot. 1307 // be included in the precompiled snapshot.
1314 if (!VmService::LoadForGenPrecompiled()) { 1308 if (!VmService::LoadForGenPrecompiled()) {
1315 fprintf(stderr, 1309 fprintf(stderr,
1316 "VM service loading failed: %s\n", 1310 "VM service loading failed: %s\n",
1317 VmService::GetErrorMessage()); 1311 VmService::GetErrorMessage());
1318 fflush(stderr); 1312 fflush(stderr);
1319 exit(kErrorExitCode); 1313 exit(kErrorExitCode);
1320 } 1314 }
1321 } 1315 }
1322 #endif // !DART_PRODUCT_BINARY 1316 #endif // PRODUCT
1323 1317
1324 if (compile_all) { 1318 if (compile_all) {
1325 result = Dart_CompileAll(); 1319 result = Dart_CompileAll();
1326 CHECK_RESULT(result); 1320 CHECK_RESULT(result);
1327 } 1321 }
1328 1322
1329 if (is_noopt || gen_precompiled_snapshot) { 1323 if (is_noopt || gen_precompiled_snapshot) {
1330 Dart_QualifiedFunctionName standalone_entry_points[] = { 1324 Dart_QualifiedFunctionName standalone_entry_points[] = {
1331 { "dart:_builtin", "::", "_getMainClosure" }, 1325 { "dart:_builtin", "::", "_getMainClosure" },
1332 { "dart:_builtin", "::", "_getPrintClosure" }, 1326 { "dart:_builtin", "::", "_getPrintClosure" },
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1705 Platform::Exit(Process::GlobalExitCode()); 1699 Platform::Exit(Process::GlobalExitCode());
1706 } 1700 }
1707 1701
1708 } // namespace bin 1702 } // namespace bin
1709 } // namespace dart 1703 } // namespace dart
1710 1704
1711 int main(int argc, char** argv) { 1705 int main(int argc, char** argv) {
1712 dart::bin::main(argc, argv); 1706 dart::bin::main(argc, argv);
1713 UNREACHABLE(); 1707 UNREACHABLE();
1714 } 1708 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698