Index: src/d8.cc |
diff --git a/src/d8.cc b/src/d8.cc |
index a02529999aaa95864923ae9f5bedb186ac39319b..55f0d4c2ab57cf74b0027a7c12c81f6df8573f20 100644 |
--- a/src/d8.cc |
+++ b/src/d8.cc |
@@ -70,6 +70,7 @@ namespace v8 { |
#ifndef V8_SHARED |
LineEditor *LineEditor::first_ = NULL; |
const char* Shell::kHistoryFileName = ".d8_history"; |
+const int Shell::kMaxHistoryEntries = 1000; |
LineEditor::LineEditor(Type type, const char* name) |
@@ -117,6 +118,7 @@ CounterCollection Shell::local_counters_; |
CounterCollection* Shell::counters_ = &local_counters_; |
i::Mutex* Shell::context_mutex_(i::OS::CreateMutex()); |
Persistent<Context> Shell::utility_context_; |
+LineEditor* Shell::console = NULL; |
#endif // V8_SHARED |
Persistent<Context> Shell::evaluation_context_; |
@@ -791,6 +793,7 @@ void Shell::Exit(int exit_code) { |
#ifndef V8_SHARED |
void Shell::OnExit() { |
+ if (console != NULL) console->Close(); |
if (i::FLAG_dump_counters) { |
printf("+----------------------------------------+-------------+\n"); |
printf("| Name | Value |\n"); |
@@ -895,20 +898,19 @@ void Shell::RunShell() { |
HandleScope outer_scope; |
Handle<String> name = String::New("(d8)"); |
#ifndef V8_SHARED |
- LineEditor* editor = LineEditor::Get(); |
- printf("V8 version %s [console: %s]\n", V8::GetVersion(), editor->name()); |
+ console = LineEditor::Get(); |
+ printf("V8 version %s [console: %s]\n", V8::GetVersion(), console->name()); |
if (i::FLAG_debugger) { |
printf("JavaScript debugger enabled\n"); |
} |
- editor->Open(); |
+ console->Open(); |
while (true) { |
- i::SmartArrayPointer<char> input = editor->Prompt(Shell::kPrompt); |
+ i::SmartArrayPointer<char> input = console->Prompt(Shell::kPrompt); |
if (input.is_empty()) break; |
- editor->AddHistory(*input); |
+ console->AddHistory(*input); |
HandleScope inner_scope; |
ExecuteString(String::New(*input), name, true, true); |
} |
- editor->Close(); |
#else |
printf("V8 version %s [D8 light using shared library]\n", V8::GetVersion()); |
static const int kBufferSize = 256; |