Commit 286f1d6b authored by yangguo@chromium.org's avatar yangguo@chromium.org

d8 drops into a shell if no files are passed on command line

Fixes regression introduced in r8241.

BUG=
TEST=Run ./d8 --print_code -- should drop into shell.

Review URL: http://codereview.chromium.org/7193011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8378 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 183efaee
// 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 // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
...@@ -922,7 +922,7 @@ int Shell::Main(int argc, char* argv[]) { ...@@ -922,7 +922,7 @@ int Shell::Main(int argc, char* argv[]) {
// optimization in the last run. // optimization in the last run.
bool FLAG_stress_opt = false; bool FLAG_stress_opt = false;
bool FLAG_stress_deopt = false; bool FLAG_stress_deopt = false;
bool run_shell = (argc == 1); bool FLAG_run_shell = false;
for (int i = 0; i < argc; i++) { for (int i = 0; i < argc; i++) {
if (strcmp(argv[i], "--stress-opt") == 0) { if (strcmp(argv[i], "--stress-opt") == 0) {
...@@ -936,13 +936,17 @@ int Shell::Main(int argc, char* argv[]) { ...@@ -936,13 +936,17 @@ int Shell::Main(int argc, char* argv[]) {
FLAG_stress_opt = false; FLAG_stress_opt = false;
FLAG_stress_deopt = false; FLAG_stress_deopt = false;
} else if (strcmp(argv[i], "--shell") == 0) { } else if (strcmp(argv[i], "--shell") == 0) {
run_shell = true; FLAG_run_shell = true;
argv[i] = NULL; argv[i] = NULL;
} }
} }
v8::V8::SetFlagsFromCommandLine(&argc, argv, true); 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(); Initialize();
int result = 0; int result = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment