Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Unified Diff: src/d8.cc

Issue 7851011: Functions in d8 to turn the profiler on/off (enableProfiler() and disableProfiler()). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/d8.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index 5c604368920a35c5aa81feb6818219b59c697a43..f1297e1d7b2d10c03921f4fd116227c8d8649d4c 100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -210,6 +210,18 @@ Handle<Value> Shell::Write(const Arguments& args) {
}
+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) {
String::Utf8Value file(args[0]);
if (*file == NULL) {
@@ -656,6 +668,12 @@ Handle<ObjectTemplate> Shell::CreateGlobalTemplate() {
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"),
« no previous file with comments | « src/d8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698