Index: src/d8.cc |
diff --git a/src/d8.cc b/src/d8.cc |
index 5a5238011aea88af32d8506d90d1fb3060bd1174..d527315f4cfabae98861adb015012122341ccc12 100644 |
--- a/src/d8.cc |
+++ b/src/d8.cc |
@@ -1,4 +1,4 @@ |
-// Copyright 2009 the V8 project authors. All rights reserved. |
+// Copyright 2011 the V8 project authors. All rights reserved. |
// Redistribution and use in source and binary forms, with or without |
// modification, are permitted provided that the following conditions are |
// met: |
@@ -921,7 +921,7 @@ int Shell::Main(int argc, char* argv[]) { |
// optimization in the last run. |
bool FLAG_stress_opt = false; |
bool FLAG_stress_deopt = false; |
- bool run_shell = (argc == 1); |
+ bool FLAG_run_shell = false; |
for (int i = 0; i < argc; i++) { |
if (strcmp(argv[i], "--stress-opt") == 0) { |
@@ -935,13 +935,17 @@ int Shell::Main(int argc, char* argv[]) { |
FLAG_stress_opt = false; |
FLAG_stress_deopt = false; |
} else if (strcmp(argv[i], "--shell") == 0) { |
- run_shell = true; |
+ FLAG_run_shell = true; |
argv[i] = NULL; |
} |
} |
v8::V8::SetFlagsFromCommandLine(&argc, argv, true); |
+ // Allow SetFlagsFromCommandLine to decrement argc before deciding to |
+ // run the shell or not. |
+ bool run_shell = FLAG_run_shell || (argc == 1); |
+ |
Initialize(); |
int result = 0; |