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

Unified Diff: runtime/bin/main.cc

Issue 1373873004: Make --noopt behave like an in-place precompilation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: sync + enable checked mode Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/include/dart_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/main.cc
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index 09dfbf006925ce505345810846f3ab2638d0a81c..459775215493ec212b3e1fbba2d6cb92a0ddea2e 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -81,6 +81,12 @@ static bool has_gen_precompiled_snapshot = false;
static bool has_run_precompiled_snapshot = false;
+// Global flag that is used to indicate that we want to compile everything in
+// the same way as precompilation before main, then continue running in the
+// same process.
+static bool has_noopt = false;
+
+
extern const char* kPrecompiledLibraryName;
extern const char* kPrecompiledSymbolName;
static const char* kPrecompiledVmIsolateName = "precompiled.vmisolate";
@@ -326,7 +332,7 @@ static bool ProcessGenPrecompiledSnapshotOption(
return false;
}
has_gen_precompiled_snapshot = true;
- vm_options->AddArgument("--precompile");
+ vm_options->AddArgument("--precompilation");
return true;
}
@@ -339,7 +345,20 @@ static bool ProcessRunPrecompiledSnapshotOption(
return false;
}
has_run_precompiled_snapshot = true;
- vm_options->AddArgument("--precompile");
+ vm_options->AddArgument("--precompilation");
+ return true;
+}
+
+
+static bool ProcessNooptOption(
+ const char* arg,
+ CommandLineOptions* vm_options) {
+ ASSERT(arg != NULL);
+ if (*arg != '\0') {
+ return false;
+ }
+ has_noopt = true;
+ vm_options->AddArgument("--precompilation");
return true;
}
@@ -483,6 +502,7 @@ static struct {
{ "--debug", ProcessDebugOption },
{ "--enable-vm-service", ProcessEnableVmServiceOption },
{ "--gen-precompiled-snapshot", ProcessGenPrecompiledSnapshotOption },
+ { "--noopt", ProcessNooptOption },
{ "--observe", ProcessObserveOption },
{ "--run-precompiled-snapshot", ProcessRunPrecompiledSnapshotOption },
{ "--shutdown", ProcessShutdownOption },
@@ -887,9 +907,6 @@ static void PrintUsage() {
" enables the VM service and listens on specified port for connections\n"
" (default port number is 8181)\n"
"\n"
-"--noopt\n"
-" run unoptimized code only\n"
-"\n"
"The following options are only used for VM development and may\n"
"be changed in any future version:\n");
const char* print_flags = "--print_flags";
@@ -1254,7 +1271,7 @@ void main(int argc, char** argv) {
ASSERT(!Dart_IsError(builtin_lib));
result = Dart_LibraryImportLibrary(builtin_lib, root_lib, Dart_Null());
- if (has_gen_precompiled_snapshot) {
+ if (has_noopt || has_gen_precompiled_snapshot) {
Dart_QualifiedFunctionName standalone_entry_points[] = {
{ "dart:_builtin", "::", "_getMainClosure" },
{ "dart:_builtin", "::", "_getPrintClosure" },
@@ -1280,9 +1297,12 @@ void main(int argc, char** argv) {
{ NULL, NULL, NULL } // Must be terminated with NULL entries.
};
- result = Dart_Precompile(standalone_entry_points);
+ const bool reset_fields = has_gen_precompiled_snapshot;
+ result = Dart_Precompile(standalone_entry_points, reset_fields);
DartExitOnError(result);
+ }
+ if (has_gen_precompiled_snapshot) {
uint8_t* vm_isolate_buffer = NULL;
intptr_t vm_isolate_size = 0;
uint8_t* isolate_buffer = NULL;
« no previous file with comments | « no previous file | runtime/include/dart_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698