Reviewers: Jakob,

Message:
PTAL.

Current behavior is:
- new profiler-related functions work for d8 built both shared and static.
- not using --prof causes a fatal failure and subsequent abort.

Description:
Fixing shared library build of d8.


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

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/api.cc
  M src/d8.cc


Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 0207f51eb428f19dced5e0c519472636424ed777..5a7c0d5dd27636c394b8c50e5e406c375663def0 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -4979,12 +4979,18 @@ void V8::RemoveMemoryAllocationCallback(MemoryAllocationCallback callback) {


 void V8::PauseProfiler() {
+  ApiCheck(i::FLAG_prof,
+           "V8::ResumeProfiler",
+           "Profiling has to be enabled with --prof");
   i::Isolate* isolate = i::Isolate::Current();
   isolate->logger()->PauseProfiler();
 }


 void V8::ResumeProfiler() {
+  ApiCheck(i::FLAG_prof,
+           "V8::ResumeProfiler",
+           "Profiling has to be enabled with --prof");
   i::Isolate* isolate = i::Isolate::Current();
   isolate->logger()->ResumeProfiler();
 }
Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index f1297e1d7b2d10c03921f4fd116227c8d8649d4c..5a162929c247b59e1b1ee65072490c9afd8c3dad 100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -668,12 +668,10 @@ 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));
-  }
+  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"),


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

Reply via email to