Index: src/log.h |
diff --git a/src/log.h b/src/log.h |
index 03c7b3b6705fd3460d5b12f532e3508a3e0ee17b..33f359a7f996be80842fe7a6d6e7f685ed68ac03 100644 |
--- a/src/log.h |
+++ b/src/log.h |
@@ -86,6 +86,15 @@ class Ticker; |
logger->Call; \ |
} while (false) |
+#define LOG_CODE_EVENT(isolate, Call) \ |
+ do { \ |
+ v8::internal::Logger* logger = \ |
+ (isolate)->logger(); \ |
+ if (logger->is_logging_code_events()) \ |
+ logger->Call; \ |
+ } while (false) |
+ |
+ |
#define LOG_EVENTS_AND_TAGS_LIST(V) \ |
V(CODE_CREATION_EVENT, "code-creation") \ |
V(CODE_MOVE_EVENT, "code-move") \ |
@@ -151,6 +160,10 @@ class Logger { |
// Acquires resources for logging if the right flags are set. |
bool SetUp(); |
+ // Sets the current code event handler. |
+ void SetCodeEventHandler(uint32_t options, |
+ JitCodeEventHandler event_handler); |
+ |
void EnsureTickerStarted(); |
void EnsureTickerStopped(); |
@@ -274,6 +287,10 @@ class Logger { |
return logging_nesting_ > 0; |
} |
+ bool is_logging_code_events() { |
+ return is_logging() || code_event_handler_ != NULL; |
+ } |
+ |
// Pause/Resume collection of profiling data. |
// When data collection is paused, CPU Tick events are discarded until |
// data collection is Resumed. |
@@ -312,6 +329,11 @@ class Logger { |
Logger(); |
~Logger(); |
+ // Issue code notifications. |
+ void IssueCodeAddedEvent(Code* code, const char* name, size_t name_len); |
+ void IssueCodeMovedEvent(Address from, Address to); |
+ void IssueCodeRemovedEvent(Address from); |
+ |
// Emits the profiler's first message. |
void ProfilerBeginEvent(); |
@@ -413,6 +435,9 @@ class Logger { |
// 'true' between SetUp() and TearDown(). |
bool is_initialized_; |
+ // The code event handler - if any. |
+ JitCodeEventHandler code_event_handler_; |
+ |
// Support for 'incremental addresses' in compressed logs: |
// LogMessageBuilder::AppendAddress(Address addr) |
Address last_address_; |