Reviewers: dcarney,
Description:
Make event logger slightly more light-weight.
[email protected]
BUG=chromium:423668
Please review this at https://codereview.chromium.org/651413002/
Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+14, -6 lines):
M src/isolate.cc
M src/log.h
M src/log-inl.h
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index
5703225f4e0b6f14789ec7e6778aed881e5544af..ef980dc2b9ea26ee2482ba40c078d2e594b0acc0
100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -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.
Index: src/log-inl.h
diff --git a/src/log-inl.h b/src/log-inl.h
index
22ea800585c326866cc8dc1efab35b7c19966d2a..a96631d059d1a5dd0dffb7d3ebd9ec9d2cd64584
100644
--- a/src/log-inl.h
+++ b/src/log-inl.h
@@ -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
Index: src/log.h
diff --git a/src/log.h b/src/log.h
index
2bcd42f0d2be17d541920ca746e79befb50f647b..abf35f0ebc5ddcf0373f598d0cf48eee1d479e5c
100644
--- a/src/log.h
+++ b/src/log.h
@@ -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.
--
--
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.