Limit the time d8 interactive shell's input strings stay alive.
authoryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 6 Sep 2011 09:07:39 +0000 (09:07 +0000)
committeryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 6 Sep 2011 09:07:39 +0000 (09:07 +0000)
Review URL: http://codereview.chromium.org/7779032

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9143 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/d8.cc

index 729ce88..55f1c76 100644 (file)
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -864,7 +864,7 @@ Handle<String> Shell::ReadFile(const char* name) {
 void Shell::RunShell() {
   Locker locker;
   Context::Scope context_scope(evaluation_context_);
-  HandleScope handle_scope;
+  HandleScope outer_scope;
   Handle<String> name = String::New("(d8)");
 #ifndef V8_SHARED
   LineEditor* editor = LineEditor::Get();
@@ -877,6 +877,7 @@ void Shell::RunShell() {
     i::SmartPointer<char> input = editor->Prompt(Shell::kPrompt);
     if (input.is_empty()) break;
     editor->AddHistory(*input);
+    HandleScope inner_scope;
     ExecuteString(String::New(*input), name, true, true);
   }
   editor->Close();
@@ -887,6 +888,7 @@ void Shell::RunShell() {
     char buffer[kBufferSize];
     printf("%s", Shell::kPrompt);
     if (fgets(buffer, kBufferSize, stdin) == NULL) break;
+    HandleScope inner_scope;
     ExecuteString(String::New(buffer), name, true, true);
   }
 #endif  // V8_SHARED