Commit 1a905019 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Fix V8's default timer event logger.

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

R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/655813002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24607 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent dd49272c
......@@ -6711,7 +6711,7 @@ void Isolate::GetStackSample(const RegisterState& state, void** frames,
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);
}
......
......@@ -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 @@ void HistogramTimer::Start() {
if (Enabled()) {
timer_.Start();
}
isolate()->event_logger()(name(), Logger::START);
Logger::CallEventLogger(isolate(), name(), Logger::START, true);
}
......@@ -50,7 +51,7 @@ void HistogramTimer::Stop() {
AddSample(static_cast<int>(timer_.Elapsed().InMilliseconds()));
timer_.Stop();
}
isolate()->event_logger()(name(), Logger::END);
Logger::CallEventLogger(isolate(), name(), Logger::END, true);
}
......
......@@ -1911,12 +1911,6 @@ bool Isolate::Init(Deserializer* des) {
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.
......
......@@ -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 @@ Logger::LogEventsAndTags Logger::ToNativeByScript(Logger::LogEventsAndTags tag,
}
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_
......@@ -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"
......@@ -954,18 +955,10 @@ void Logger::LeaveExternal(Isolate* isolate) {
}
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());
}
......
......@@ -300,8 +300,8 @@ class Logger {
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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment