Revision: 9188
Author:   [email protected]
Date:     Thu Sep  8 01:54:28 2011
Log: Functions in d8 to turn the profiler on/off (enableProfiler() and disableProfiler()).

Review URL: http://codereview.chromium.org/7851011
http://code.google.com/p/v8/source/detail?r=9188

Modified:
 /branches/bleeding_edge/src/d8.cc
 /branches/bleeding_edge/src/d8.h

=======================================
--- /branches/bleeding_edge/src/d8.cc   Tue Sep  6 07:48:08 2011
+++ /branches/bleeding_edge/src/d8.cc   Thu Sep  8 01:54:28 2011
@@ -208,6 +208,18 @@
   }
   return Undefined();
 }
+
+
+Handle<Value> Shell::EnableProfiler(const Arguments& args) {
+  V8::ResumeProfiler();
+  return Undefined();
+}
+
+
+Handle<Value> Shell::DisableProfiler(const Arguments& args) {
+  V8::PauseProfiler();
+  return Undefined();
+}


 Handle<Value> Shell::Read(const Arguments& args) {
@@ -656,6 +668,12 @@
   global_template->Set(String::New("load"), FunctionTemplate::New(Load));
   global_template->Set(String::New("quit"), FunctionTemplate::New(Quit));
global_template->Set(String::New("version"), FunctionTemplate::New(Version));
+  if (i::FLAG_prof) {
+    global_template->Set(String::New("enableProfiler"),
+                         FunctionTemplate::New(EnableProfiler));
+    global_template->Set(String::New("disableProfiler"),
+                         FunctionTemplate::New(DisableProfiler));
+  }

   // Bind the handlers for external arrays.
   global_template->Set(String::New("Int8Array"),
=======================================
--- /branches/bleeding_edge/src/d8.h    Fri Aug 12 02:49:55 2011
+++ /branches/bleeding_edge/src/d8.h    Thu Sep  8 01:54:28 2011
@@ -248,6 +248,8 @@
   static Handle<Value> Yield(const Arguments& args);
   static Handle<Value> Quit(const Arguments& args);
   static Handle<Value> Version(const Arguments& args);
+  static Handle<Value> EnableProfiler(const Arguments& args);
+  static Handle<Value> DisableProfiler(const Arguments& args);
   static Handle<Value> Read(const Arguments& args);
   static Handle<Value> ReadLine(const Arguments& args);
   static Handle<Value> Load(const Arguments& args);

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

Reply via email to