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

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

Issue 2838973002: Fix broken precompiled runtime build. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
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 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 // Returns newly created Isolate on success, NULL on failure. 817 // Returns newly created Isolate on success, NULL on failure.
818 static Dart_Isolate CreateIsolateAndSetupHelper(bool is_main_isolate, 818 static Dart_Isolate CreateIsolateAndSetupHelper(bool is_main_isolate,
819 const char* script_uri, 819 const char* script_uri,
820 const char* main, 820 const char* main,
821 const char* package_root, 821 const char* package_root,
822 const char* packages_config, 822 const char* packages_config,
823 Dart_IsolateFlags* flags, 823 Dart_IsolateFlags* flags,
824 char** error, 824 char** error,
825 int* exit_code) { 825 int* exit_code) {
826 ASSERT(script_uri != NULL); 826 ASSERT(script_uri != NULL);
827 const bool is_service_isolate =
828 strcmp(script_uri, DART_VM_SERVICE_ISOLATE_NAME) == 0;
829 const bool is_kernel_isolate = 827 const bool is_kernel_isolate =
830 strcmp(script_uri, DART_KERNEL_ISOLATE_NAME) == 0; 828 strcmp(script_uri, DART_KERNEL_ISOLATE_NAME) == 0;
831 if (is_kernel_isolate) { 829 if (is_kernel_isolate) {
832 if (!use_dart_frontend) { 830 if (!use_dart_frontend) {
833 *error = strdup("Kernel isolate not supported."); 831 *error = strdup("Kernel isolate not supported.");
834 return NULL; 832 return NULL;
835 } 833 }
836 script_uri = frontend_filename; 834 script_uri = frontend_filename;
837 if (packages_config == NULL) { 835 if (packages_config == NULL) {
838 packages_config = commandline_packages_file; 836 packages_config = commandline_packages_file;
(...skipping 29 matching lines...) Expand all
868 const uint8_t* ignore_vm_snapshot_instructions; 866 const uint8_t* ignore_vm_snapshot_instructions;
869 app_snapshot->SetBuffers( 867 app_snapshot->SetBuffers(
870 &ignore_vm_snapshot_data, &ignore_vm_snapshot_instructions, 868 &ignore_vm_snapshot_data, &ignore_vm_snapshot_instructions,
871 &isolate_snapshot_data, &isolate_snapshot_instructions); 869 &isolate_snapshot_data, &isolate_snapshot_instructions);
872 } 870 }
873 } 871 }
874 #endif 872 #endif
875 873
876 void* kernel_platform = NULL; 874 void* kernel_platform = NULL;
877 void* kernel_program = NULL; 875 void* kernel_program = NULL;
876 #if !defined(DART_PRECOMPILED_RUNTIME)
877 const bool is_service_isolate =
878 strcmp(script_uri, DART_VM_SERVICE_ISOLATE_NAME) == 0;
878 if (!is_kernel_isolate && !is_service_isolate) { 879 if (!is_kernel_isolate && !is_service_isolate) {
879 const uint8_t* platform_file = NULL; 880 const uint8_t* platform_file = NULL;
880 if (use_platform_binary) { 881 if (use_platform_binary) {
881 intptr_t platform_length = -1; 882 intptr_t platform_length = -1;
882 bool success = TryReadKernel(platform_binary_filename, &platform_file, 883 bool success = TryReadKernel(platform_binary_filename, &platform_file,
883 &platform_length); 884 &platform_length);
884 if (!success) { 885 if (!success) {
885 *error = strdup("The platform binary is not a valid Dart Kernel file."); 886 *error = strdup("The platform binary is not a valid Dart Kernel file.");
886 *exit_code = kErrorExitCode; 887 *exit_code = kErrorExitCode;
887 return NULL; 888 return NULL;
(...skipping 18 matching lines...) Expand all
906 break; 907 break;
907 case Dart_KernelCompilationStatus_Crash: 908 case Dart_KernelCompilationStatus_Crash:
908 *exit_code = kDartFrontendErrorExitCode; 909 *exit_code = kDartFrontendErrorExitCode;
909 break; 910 break;
910 case Dart_KernelCompilationStatus_Unknown: 911 case Dart_KernelCompilationStatus_Unknown:
911 *exit_code = kErrorExitCode; 912 *exit_code = kErrorExitCode;
912 break; 913 break;
913 } 914 }
914 if (!is_kernel) { 915 if (!is_kernel) {
915 free(const_cast<uint8_t*>(platform_file)); 916 free(const_cast<uint8_t*>(platform_file));
916 delete reinterpret_cast<dart::kernel::Program*>(kernel_platform); 917 delete reinterpret_cast<kernel::Program*>(kernel_platform);
917 return NULL; 918 return NULL;
918 } 919 }
919 } else if (!isolate_run_app_snapshot) { 920 } else if (!isolate_run_app_snapshot) {
920 is_kernel = TryReadKernel(script_uri, &kernel_file, &kernel_length); 921 is_kernel = TryReadKernel(script_uri, &kernel_file, &kernel_length);
921 } 922 }
922 923
923 if (is_kernel) { 924 if (is_kernel) {
924 kernel_program = Dart_ReadKernelBinary(kernel_file, kernel_length); 925 kernel_program = Dart_ReadKernelBinary(kernel_file, kernel_length);
925 } 926 }
926 } 927 }
928 #endif // !defined(DART_PRECOMPILED_RUNTIME)
927 929
928 IsolateData* isolate_data = 930 IsolateData* isolate_data =
929 new IsolateData(script_uri, package_root, packages_config, app_snapshot); 931 new IsolateData(script_uri, package_root, packages_config, app_snapshot);
930 if (is_main_isolate && (snapshot_deps_filename != NULL)) { 932 if (is_main_isolate && (snapshot_deps_filename != NULL)) {
931 isolate_data->set_dependencies(new MallocGrowableArray<char*>()); 933 isolate_data->set_dependencies(new MallocGrowableArray<char*>());
932 } 934 }
933 Dart_Isolate isolate = 935 Dart_Isolate isolate =
934 kernel_platform != NULL 936 kernel_platform != NULL
935 ? Dart_CreateIsolateFromKernel(script_uri, main, kernel_platform, 937 ? Dart_CreateIsolateFromKernel(script_uri, main, kernel_platform,
936 flags, isolate_data, error) 938 flags, isolate_data, error)
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
1754 Platform::Exit(Process::GlobalExitCode()); 1756 Platform::Exit(Process::GlobalExitCode());
1755 } 1757 }
1756 1758
1757 } // namespace bin 1759 } // namespace bin
1758 } // namespace dart 1760 } // namespace dart
1759 1761
1760 int main(int argc, char** argv) { 1762 int main(int argc, char** argv) {
1761 dart::bin::main(argc, argv); 1763 dart::bin::main(argc, argv);
1762 UNREACHABLE(); 1764 UNREACHABLE();
1763 } 1765 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698