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

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

Issue 2759533002: Remove legacy restart code (Closed)
Patch Set: asiva review Created 3 years, 9 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 | « runtime/bin/gen_snapshot.cc ('k') | runtime/include/dart_api.h » ('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 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 } 754 }
755 755
756 756
757 #define CHECK_RESULT(result) \ 757 #define CHECK_RESULT(result) \
758 if (Dart_IsError(result)) { \ 758 if (Dart_IsError(result)) { \
759 *error = strdup(Dart_GetError(result)); \ 759 *error = strdup(Dart_GetError(result)); \
760 if (Dart_IsCompilationError(result)) { \ 760 if (Dart_IsCompilationError(result)) { \
761 *exit_code = kCompilationErrorExitCode; \ 761 *exit_code = kCompilationErrorExitCode; \
762 } else if (Dart_IsApiError(result)) { \ 762 } else if (Dart_IsApiError(result)) { \
763 *exit_code = kApiErrorExitCode; \ 763 *exit_code = kApiErrorExitCode; \
764 } else if (Dart_IsVMRestartRequest(result)) { \
765 *exit_code = kRestartRequestExitCode; \
766 } else { \ 764 } else { \
767 *exit_code = kErrorExitCode; \ 765 *exit_code = kErrorExitCode; \
768 } \ 766 } \
769 Dart_ExitScope(); \ 767 Dart_ExitScope(); \
770 Dart_ShutdownIsolate(); \ 768 Dart_ShutdownIsolate(); \
771 return NULL; \ 769 return NULL; \
772 } 770 }
773 771
774 772
775 static void SnapshotOnExitHook(int64_t exit_code) { 773 static void SnapshotOnExitHook(int64_t exit_code) {
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 if (use_blobs) { 1206 if (use_blobs) {
1209 Snapshot::GenerateAppAOTAsBlobs(snapshot_filename); 1207 Snapshot::GenerateAppAOTAsBlobs(snapshot_filename);
1210 } else { 1208 } else {
1211 Snapshot::GenerateAppAOTAsAssembly(snapshot_filename); 1209 Snapshot::GenerateAppAOTAsAssembly(snapshot_filename);
1212 } 1210 }
1213 } 1211 }
1214 1212
1215 1213
1216 #define CHECK_RESULT(result) \ 1214 #define CHECK_RESULT(result) \
1217 if (Dart_IsError(result)) { \ 1215 if (Dart_IsError(result)) { \
1218 if (Dart_IsVMRestartRequest(result)) { \
1219 Dart_ExitScope(); \
1220 Dart_ShutdownIsolate(); \
1221 return true; \
1222 } \
1223 const int exit_code = Dart_IsCompilationError(result) \ 1216 const int exit_code = Dart_IsCompilationError(result) \
1224 ? kCompilationErrorExitCode \ 1217 ? kCompilationErrorExitCode \
1225 : kErrorExitCode; \ 1218 : kErrorExitCode; \
1226 ErrorExit(exit_code, "%s\n", Dart_GetError(result)); \ 1219 ErrorExit(exit_code, "%s\n", Dart_GetError(result)); \
1227 } 1220 }
1228 1221
1229 1222
1230 static void WriteFile(const char* filename, 1223 static void WriteFile(const char* filename,
1231 const uint8_t* buffer, 1224 const uint8_t* buffer,
1232 const intptr_t size) { 1225 const intptr_t size) {
(...skipping 13 matching lines...) Expand all
1246 // the specified application script. 1239 // the specified application script.
1247 char* error = NULL; 1240 char* error = NULL;
1248 bool is_main_isolate = true; 1241 bool is_main_isolate = true;
1249 int exit_code = 0; 1242 int exit_code = 0;
1250 char* isolate_name = BuildIsolateName(script_name, "main"); 1243 char* isolate_name = BuildIsolateName(script_name, "main");
1251 Dart_Isolate isolate = CreateIsolateAndSetupHelper( 1244 Dart_Isolate isolate = CreateIsolateAndSetupHelper(
1252 is_main_isolate, script_name, "main", commandline_package_root, 1245 is_main_isolate, script_name, "main", commandline_package_root,
1253 commandline_packages_file, NULL, &error, &exit_code); 1246 commandline_packages_file, NULL, &error, &exit_code);
1254 if (isolate == NULL) { 1247 if (isolate == NULL) {
1255 delete[] isolate_name; 1248 delete[] isolate_name;
1256 if (exit_code == kRestartRequestExitCode) {
1257 free(error);
1258 return true;
1259 }
1260 Log::PrintErr("%s\n", error); 1249 Log::PrintErr("%s\n", error);
1261 free(error); 1250 free(error);
1262 error = NULL; 1251 error = NULL;
1263 Process::TerminateExitCodeHandler(); 1252 Process::TerminateExitCodeHandler();
1264 error = Dart_Cleanup(); 1253 error = Dart_Cleanup();
1265 if (error != NULL) { 1254 if (error != NULL) {
1266 Log::PrintErr("VM cleanup failed: %s\n", error); 1255 Log::PrintErr("VM cleanup failed: %s\n", error);
1267 free(error); 1256 free(error);
1268 } 1257 }
1269 EventHandler::Stop(); 1258 EventHandler::Stop();
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 Dart_LookupLibrary(Dart_NewStringFromCString("dart:isolate")); 1393 Dart_LookupLibrary(Dart_NewStringFromCString("dart:isolate"));
1405 result = Dart_Invoke(isolate_lib, 1394 result = Dart_Invoke(isolate_lib,
1406 Dart_NewStringFromCString("_startMainIsolate"), 1395 Dart_NewStringFromCString("_startMainIsolate"),
1407 kNumIsolateArgs, isolate_args); 1396 kNumIsolateArgs, isolate_args);
1408 CHECK_RESULT(result); 1397 CHECK_RESULT(result);
1409 1398
1410 // Keep handling messages until the last active receive port is closed. 1399 // Keep handling messages until the last active receive port is closed.
1411 result = Dart_RunLoop(); 1400 result = Dart_RunLoop();
1412 // Generate an app snapshot after execution if specified. 1401 // Generate an app snapshot after execution if specified.
1413 if (gen_snapshot_kind == kAppJIT) { 1402 if (gen_snapshot_kind == kAppJIT) {
1414 if (!Dart_IsCompilationError(result) && 1403 if (!Dart_IsCompilationError(result)) {
1415 !Dart_IsVMRestartRequest(result)) {
1416 Snapshot::GenerateAppJIT(snapshot_filename); 1404 Snapshot::GenerateAppJIT(snapshot_filename);
1417 } 1405 }
1418 } 1406 }
1419 CHECK_RESULT(result); 1407 CHECK_RESULT(result);
1420 1408
1421 if (save_feedback_filename != NULL) { 1409 if (save_feedback_filename != NULL) {
1422 uint8_t* buffer = NULL; 1410 uint8_t* buffer = NULL;
1423 intptr_t size = 0; 1411 intptr_t size = 0;
1424 result = Dart_SaveJITFeedback(&buffer, &size); 1412 result = Dart_SaveJITFeedback(&buffer, &size);
1425 if (Dart_IsError(result)) { 1413 if (Dart_IsError(result)) {
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1679 Platform::Exit(Process::GlobalExitCode()); 1667 Platform::Exit(Process::GlobalExitCode());
1680 } 1668 }
1681 1669
1682 } // namespace bin 1670 } // namespace bin
1683 } // namespace dart 1671 } // namespace dart
1684 1672
1685 int main(int argc, char** argv) { 1673 int main(int argc, char** argv) {
1686 dart::bin::main(argc, argv); 1674 dart::bin::main(argc, argv);
1687 UNREACHABLE(); 1675 UNREACHABLE();
1688 } 1676 }
OLDNEW
« no previous file with comments | « runtime/bin/gen_snapshot.cc ('k') | runtime/include/dart_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698