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

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

Issue 2164383002: Speculative fix for timeouts (hangs) in (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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/vm/heap.cc » ('j') | 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 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 intptr_t len = -1; 1104 intptr_t len = -1;
1105 DartUtils::ReadFile(buffer, &len, file); 1105 DartUtils::ReadFile(buffer, &len, file);
1106 if ((*buffer == NULL) || (len == -1)) { 1106 if ((*buffer == NULL) || (len == -1)) {
1107 fprintf(stderr, 1107 fprintf(stderr,
1108 "Error: Unable to read snapshot file %s\n", qualified_filename); 1108 "Error: Unable to read snapshot file %s\n", qualified_filename);
1109 fflush(stderr); 1109 fflush(stderr);
1110 Platform::Exit(kErrorExitCode); 1110 Platform::Exit(kErrorExitCode);
1111 } 1111 }
1112 DartUtils::CloseFile(file); 1112 DartUtils::CloseFile(file);
1113 if (concat != NULL) { 1113 if (concat != NULL) {
1114 delete concat; 1114 delete[] concat;
1115 } 1115 }
1116 } 1116 }
1117 1117
1118 1118
1119 static void ReadExecutableSnapshotFile(const char* snapshot_directory, 1119 static void ReadExecutableSnapshotFile(const char* snapshot_directory,
1120 const char* filename, 1120 const char* filename,
1121 const uint8_t** buffer) { 1121 const uint8_t** buffer) {
1122 char* concat = NULL; 1122 char* concat = NULL;
1123 const char* qualified_filename; 1123 const char* qualified_filename;
1124 if ((snapshot_directory != NULL) && (strlen(snapshot_directory) > 0)) { 1124 if ((snapshot_directory != NULL) && (strlen(snapshot_directory) > 0)) {
1125 intptr_t len = snprintf(NULL, 0, "%s/%s", snapshot_directory, filename); 1125 intptr_t len = snprintf(NULL, 0, "%s/%s", snapshot_directory, filename);
1126 concat = new char[len + 1]; 1126 concat = new char[len + 1];
1127 snprintf(concat, len + 1, "%s/%s", snapshot_directory, filename); 1127 snprintf(concat, len + 1, "%s/%s", snapshot_directory, filename);
1128 qualified_filename = concat; 1128 qualified_filename = concat;
1129 } else { 1129 } else {
1130 qualified_filename = filename; 1130 qualified_filename = filename;
1131 } 1131 }
1132 1132
1133 intptr_t len = -1; 1133 intptr_t len = -1;
1134 *buffer = reinterpret_cast<uint8_t*>( 1134 *buffer = reinterpret_cast<uint8_t*>(
1135 DartUtils::MapExecutable(qualified_filename, &len)); 1135 DartUtils::MapExecutable(qualified_filename, &len));
1136 if ((*buffer == NULL) || (len == -1)) { 1136 if ((*buffer == NULL) || (len == -1)) {
1137 fprintf(stderr, 1137 fprintf(stderr,
1138 "Error: Unable to read snapshot file %s\n", qualified_filename); 1138 "Error: Unable to read snapshot file %s\n", qualified_filename);
1139 fflush(stderr); 1139 fflush(stderr);
1140 Platform::Exit(kErrorExitCode); 1140 Platform::Exit(kErrorExitCode);
1141 } 1141 }
1142 if (concat != NULL) { 1142 if (concat != NULL) {
1143 delete concat; 1143 delete[] concat;
1144 } 1144 }
1145 } 1145 }
1146 1146
1147 1147
1148 static void* LoadLibrarySymbol(const char* snapshot_directory, 1148 static void* LoadLibrarySymbol(const char* snapshot_directory,
1149 const char* libname, 1149 const char* libname,
1150 const char* symname) { 1150 const char* symname) {
1151 char* concat = NULL; 1151 char* concat = NULL;
1152 const char* qualified_libname; 1152 const char* qualified_libname;
1153 if ((snapshot_directory != NULL) && (strlen(snapshot_directory) > 0)) { 1153 if ((snapshot_directory != NULL) && (strlen(snapshot_directory) > 0)) {
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1745 Platform::Exit(Process::GlobalExitCode()); 1745 Platform::Exit(Process::GlobalExitCode());
1746 } 1746 }
1747 1747
1748 } // namespace bin 1748 } // namespace bin
1749 } // namespace dart 1749 } // namespace dart
1750 1750
1751 int main(int argc, char** argv) { 1751 int main(int argc, char** argv) {
1752 dart::bin::main(argc, argv); 1752 dart::bin::main(argc, argv);
1753 UNREACHABLE(); 1753 UNREACHABLE();
1754 } 1754 }
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698