Reviewers: Mikhail Naganov (Chromium),

Description:
Avoid creating shell name every time in shell sample.

[email protected]

Signed-off-by: Thiago Farina <[email protected]>


Please review this at http://codereview.chromium.org/7824043/

SVN Base: git://github.com/v8/v8.git@master

Affected files:
  M samples/shell.cc


Index: samples/shell.cc
diff --git a/samples/shell.cc b/samples/shell.cc
index 8ed9d032aaf3ab4919e921f96c5185ad61dd7fba..b40eca2f7c0b696411e0db9b4d4101100d0baf50 100644
--- a/samples/shell.cc
+++ b/samples/shell.cc
@@ -250,16 +250,14 @@ void RunShell(v8::Handle<v8::Context> context) {
   static const int kBufferSize = 256;
   // Enter the execution environment before evaluating any code.
   v8::Context::Scope context_scope(context);
+  v8::Local<v8::String> name(v8::String::New("(shell)"));
   while (true) {
     char buffer[kBufferSize];
     printf("> ");
     char* str = fgets(buffer, kBufferSize, stdin);
     if (str == NULL) break;
     v8::HandleScope handle_scope;
-    ExecuteString(v8::String::New(str),
-                  v8::String::New("(shell)"),
-                  true,
-                  true);
+    ExecuteString(v8::String::New(str), name, true, true);
   }
   printf("\n");
 }


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to