From 286f1d6bc3a1d3548bd7c608dd7b028d9634d1b3 Mon Sep 17 00:00:00 2001 From: "yangguo@chromium.org" Date: Wed, 22 Jun 2011 17:32:35 +0000 Subject: [PATCH] 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 --- src/d8.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/d8.cc b/src/d8.cc index 56a43ad..7c9aa9a 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: @@ -922,7 +922,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) { @@ -936,13 +936,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; -- 2.7.4