Revision: 24607
Author:   [email protected]
Date:     Tue Oct 14 14:45:03 2014 UTC
Log:      Fix V8's default timer event logger.

This broke because the optimizing compiler thread no longer holds
Isolate::Current() in its TLS.

[email protected]

Review URL: https://codereview.chromium.org/655813002
https://code.google.com/p/v8/source/detail?r=24607

Modified:
 /branches/bleeding_edge/src/api.cc
 /branches/bleeding_edge/src/counters.cc
 /branches/bleeding_edge/src/isolate.cc
 /branches/bleeding_edge/src/log-inl.h
 /branches/bleeding_edge/src/log.cc
 /branches/bleeding_edge/src/log.h

=======================================
--- /branches/bleeding_edge/src/api.cc  Wed Oct  8 11:51:57 2014 UTC
+++ /branches/bleeding_edge/src/api.cc  Tue Oct 14 14:45:03 2014 UTC
@@ -6711,7 +6711,7 @@

 void Isolate::SetEventLogger(LogEventCallback that) {
   // Do not overwrite the event logger if we want to log explicitly.
-  if (i::FLAG_log_timer_events) return;
+  if (i::FLAG_log_internal_timer_events) return;
   i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
   isolate->set_event_logger(that);
 }
=======================================
--- /branches/bleeding_edge/src/counters.cc     Mon Jul 28 09:13:33 2014 UTC
+++ /branches/bleeding_edge/src/counters.cc     Tue Oct 14 14:45:03 2014 UTC
@@ -7,6 +7,7 @@
 #include "src/base/platform/platform.h"
 #include "src/counters.h"
 #include "src/isolate.h"
+#include "src/log-inl.h"

 namespace v8 {
 namespace internal {
@@ -39,7 +40,7 @@
   if (Enabled()) {
     timer_.Start();
   }
-  isolate()->event_logger()(name(), Logger::START);
+  Logger::CallEventLogger(isolate(), name(), Logger::START, true);
 }


@@ -50,7 +51,7 @@
     AddSample(static_cast<int>(timer_.Elapsed().InMilliseconds()));
     timer_.Stop();
   }
-  isolate()->event_logger()(name(), Logger::END);
+  Logger::CallEventLogger(isolate(), name(), Logger::END, true);
 }


=======================================
--- /branches/bleeding_edge/src/isolate.cc      Tue Oct 14 08:43:33 2014 UTC
+++ /branches/bleeding_edge/src/isolate.cc      Tue Oct 14 14:45:03 2014 UTC
@@ -1911,12 +1911,6 @@
   bootstrapper_->Initialize(create_heap_objects);
   builtins_.SetUp(this, create_heap_objects);

-  if (FLAG_log_internal_timer_events) {
-    set_event_logger(Logger::DefaultTimerEventsLogger);
-  } else {
-    set_event_logger(Logger::EmptyTimerEventsLogger);
-  }
-
   // Set default value if not yet set.
   // TODO(yangguo): move this to ResourceConstraints::ConfigureDefaults
// once ResourceConstraints becomes an argument to the Isolate constructor.
=======================================
--- /branches/bleeding_edge/src/log-inl.h       Tue Jun  3 08:12:43 2014 UTC
+++ /branches/bleeding_edge/src/log-inl.h       Tue Oct 14 14:45:03 2014 UTC
@@ -6,6 +6,7 @@
 #define V8_LOG_INL_H_

 #include "src/log.h"
+#include "src/isolate.h"

 namespace v8 {
 namespace internal {
@@ -26,6 +27,14 @@
 }


+void Logger::CallEventLogger(Isolate* isolate, const char* name, StartEnd se,
+                             bool expose_to_api) {
+  if (isolate->event_logger() == NULL) {
+    if (FLAG_log_internal_timer_events) LOG(isolate, TimerEvent(se, name));
+  } else if (expose_to_api) {
+    isolate->event_logger()(name, se);
+  }
+}
 } }  // namespace v8::internal

 #endif  // V8_LOG_INL_H_
=======================================
--- /branches/bleeding_edge/src/log.cc  Thu Oct  9 07:51:35 2014 UTC
+++ /branches/bleeding_edge/src/log.cc  Tue Oct 14 14:45:03 2014 UTC
@@ -16,6 +16,7 @@
 #include "src/cpu-profiler.h"
 #include "src/deoptimizer.h"
 #include "src/global-handles.h"
+#include "src/log-inl.h"
 #include "src/log-utils.h"
 #include "src/macro-assembler.h"
 #include "src/perf-jit.h"
@@ -952,20 +953,12 @@
   DCHECK(isolate->current_vm_state() == EXTERNAL);
   isolate->set_current_vm_state(JS);
 }
-
-
-void Logger::DefaultTimerEventsLogger(const char* name, int se) {
-  Isolate* isolate = Isolate::Current();
-  LOG(isolate, TimerEvent(static_cast<StartEnd>(se), name));
-}


 template <class TimerEvent>
 void TimerEventScope<TimerEvent>::LogTimerEvent(Logger::StartEnd se) {
-  if (TimerEvent::expose_to_api() ||
-      isolate_->event_logger() == Logger::DefaultTimerEventsLogger) {
-    isolate_->event_logger()(TimerEvent::name(), se);
-  }
+  Logger::CallEventLogger(isolate_, TimerEvent::name(), se,
+                          TimerEvent::expose_to_api());
 }


=======================================
--- /branches/bleeding_edge/src/log.h   Wed Jul 16 08:14:50 2014 UTC
+++ /branches/bleeding_edge/src/log.h   Tue Oct 14 14:45:03 2014 UTC
@@ -300,8 +300,8 @@
   static void EnterExternal(Isolate* isolate);
   static void LeaveExternal(Isolate* isolate);

-  static void EmptyTimerEventsLogger(const char* name, int se) {}
-  static void DefaultTimerEventsLogger(const char* name, int se);
+  static inline void CallEventLogger(Isolate* isolate, const char* name,
+                                     StartEnd se, bool expose_to_api);

   // ==== Events logged by --log-regexp ====
   // Regexp compilation and execution events.

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to