Commit bd624b2f authored by yangguo@chromium.org's avatar yangguo@chromium.org

Limit the time d8 interactive shell's input strings stay alive.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9143 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 0fbf8c88
...@@ -864,7 +864,7 @@ Handle<String> Shell::ReadFile(const char* name) { ...@@ -864,7 +864,7 @@ Handle<String> Shell::ReadFile(const char* name) {
void Shell::RunShell() { void Shell::RunShell() {
Locker locker; Locker locker;
Context::Scope context_scope(evaluation_context_); Context::Scope context_scope(evaluation_context_);
HandleScope handle_scope; HandleScope outer_scope;
Handle<String> name = String::New("(d8)"); Handle<String> name = String::New("(d8)");
#ifndef V8_SHARED #ifndef V8_SHARED
LineEditor* editor = LineEditor::Get(); LineEditor* editor = LineEditor::Get();
...@@ -877,6 +877,7 @@ void Shell::RunShell() { ...@@ -877,6 +877,7 @@ void Shell::RunShell() {
i::SmartPointer<char> input = editor->Prompt(Shell::kPrompt); i::SmartPointer<char> input = editor->Prompt(Shell::kPrompt);
if (input.is_empty()) break; if (input.is_empty()) break;
editor->AddHistory(*input); editor->AddHistory(*input);
HandleScope inner_scope;
ExecuteString(String::New(*input), name, true, true); ExecuteString(String::New(*input), name, true, true);
} }
editor->Close(); editor->Close();
...@@ -887,6 +888,7 @@ void Shell::RunShell() { ...@@ -887,6 +888,7 @@ void Shell::RunShell() {
char buffer[kBufferSize]; char buffer[kBufferSize];
printf("%s", Shell::kPrompt); printf("%s", Shell::kPrompt);
if (fgets(buffer, kBufferSize, stdin) == NULL) break; if (fgets(buffer, kBufferSize, stdin) == NULL) break;
HandleScope inner_scope;
ExecuteString(String::New(buffer), name, true, true); ExecuteString(String::New(buffer), name, true, true);
} }
#endif // V8_SHARED #endif // V8_SHARED
......
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