Commit 46db2f9b authored by yangguo@chromium.org's avatar yangguo@chromium.org

Make event logger slightly more light-weight.

R=dcarney@chromium.org
BUG=chromium:423668
LOG=N

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24624 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 3727a10d
......@@ -1911,6 +1911,10 @@ 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::DefaultEventLoggerSentinel);
}
// Set default value if not yet set.
// TODO(yangguo): move this to ResourceConstraints::ConfigureDefaults
// once ResourceConstraints becomes an argument to the Isolate constructor.
......
......@@ -29,10 +29,12 @@ 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);
if (isolate->event_logger() != NULL) {
if (isolate->event_logger() == DefaultEventLoggerSentinel) {
LOG(isolate, TimerEvent(se, name));
} else if (expose_to_api) {
isolate->event_logger()(name, se);
}
}
}
} } // namespace v8::internal
......
......@@ -300,8 +300,10 @@ class Logger {
static void EnterExternal(Isolate* isolate);
static void LeaveExternal(Isolate* isolate);
static inline void CallEventLogger(Isolate* isolate, const char* name,
StartEnd se, bool expose_to_api);
static void DefaultEventLoggerSentinel(const char* name, int event) {}
INLINE(static 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