Index: src/log.cc |
diff --git a/src/log.cc b/src/log.cc |
index 58256f06530e44d31ec013b71a0e257d8571c1fa..cf10f3961582a763676abe48cbae25d2ed25fe74 100644 |
--- a/src/log.cc |
+++ b/src/log.cc |
@@ -22,6 +22,7 @@ |
#include "src/macro-assembler.h" |
#include "src/perf-jit.h" |
#include "src/profiler/cpu-profiler-inl.h" |
+#include "src/profiler/profiler-listener.h" |
#include "src/runtime-profiler.h" |
#include "src/string-stream.h" |
#include "src/vm-state-inl.h" |
@@ -42,12 +43,6 @@ for (int i = 0; i < listeners_.length(); ++i) { \ |
listeners_[i]->Call; \ |
} |
-#define PROFILER_LOG(Call) \ |
- if (isolate_->is_profiling()) { \ |
- isolate_->cpu_profiler()->Call; \ |
- } else { \ |
- } |
- |
static const char* ComputeMarker(SharedFunctionInfo* shared, |
AbstractCode* code) { |
switch (code->kind()) { |
@@ -767,11 +762,13 @@ Logger::Logger(Isolate* isolate) |
perf_jit_logger_(NULL), |
ll_logger_(NULL), |
jit_logger_(NULL), |
+ profiler_listener_(new ProfilerListener(isolate)), |
listeners_(5), |
is_initialized_(false) {} |
Logger::~Logger() { |
delete log_; |
+ delete profiler_listener_; |
} |
@@ -879,7 +876,7 @@ void Logger::SharedLibraryEvent(const std::string& library_path, |
void Logger::CodeDeoptEvent(Code* code, Address pc, int fp_to_sp_delta) { |
- PROFILER_LOG(CodeDeoptEvent(code, pc, fp_to_sp_delta)); |
+ profiler_listener_->CodeDeoptEvent(code, pc, fp_to_sp_delta); |
if (!log_->IsEnabled() || !FLAG_log_internal_timer_events) return; |
Log::MessageBuilder msg(log_); |
int since_epoch = static_cast<int>(timer_.Elapsed().InMicroseconds()); |
@@ -1095,19 +1092,19 @@ void Logger::CallbackEventInternal(const char* prefix, Name* name, |
void Logger::CallbackEvent(Name* name, Address entry_point) { |
- PROFILER_LOG(CallbackEvent(name, entry_point)); |
+ profiler_listener_->CallbackEvent(name, entry_point); |
CallbackEventInternal("", name, entry_point); |
} |
void Logger::GetterCallbackEvent(Name* name, Address entry_point) { |
- PROFILER_LOG(GetterCallbackEvent(name, entry_point)); |
+ profiler_listener_->GetterCallbackEvent(name, entry_point); |
CallbackEventInternal("get ", name, entry_point); |
} |
void Logger::SetterCallbackEvent(Name* name, Address entry_point) { |
- PROFILER_LOG(SetterCallbackEvent(name, entry_point)); |
+ profiler_listener_->SetterCallbackEvent(name, entry_point); |
CallbackEventInternal("set ", name, entry_point); |
} |
@@ -1125,7 +1122,7 @@ static void AppendCodeCreateHeader(Log::MessageBuilder* msg, |
void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
const char* comment) { |
- PROFILER_LOG(CodeCreateEvent(tag, code, comment)); |
+ profiler_listener_->CodeCreateEvent(tag, code, comment); |
if (!is_logging_code_events()) return; |
CALL_LISTENERS(CodeCreateEvent(tag, code, comment)); |
@@ -1139,7 +1136,7 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
Name* name) { |
- PROFILER_LOG(CodeCreateEvent(tag, code, name)); |
+ profiler_listener_->CodeCreateEvent(tag, code, name); |
if (!is_logging_code_events()) return; |
CALL_LISTENERS(CodeCreateEvent(tag, code, name)); |
@@ -1159,7 +1156,7 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
SharedFunctionInfo* shared, Name* name) { |
- PROFILER_LOG(CodeCreateEvent(tag, code, shared, name)); |
+ profiler_listener_->CodeCreateEvent(tag, code, shared, name); |
if (!is_logging_code_events()) return; |
CALL_LISTENERS(CodeCreateEvent(tag, code, shared, name)); |
@@ -1192,7 +1189,7 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
SharedFunctionInfo* shared, Name* source, int line, |
int column) { |
- PROFILER_LOG(CodeCreateEvent(tag, code, shared, source, line, column)); |
+ profiler_listener_->CodeCreateEvent(tag, code, shared, source, line, column); |
if (!is_logging_code_events()) return; |
CALL_LISTENERS(CodeCreateEvent(tag, code, shared, source, line, column)); |
@@ -1218,7 +1215,7 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
int args_count) { |
- PROFILER_LOG(CodeCreateEvent(tag, code, args_count)); |
+ profiler_listener_->CodeCreateEvent(tag, code, args_count); |
if (!is_logging_code_events()) return; |
CALL_LISTENERS(CodeCreateEvent(tag, code, args_count)); |
@@ -1232,7 +1229,7 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
void Logger::CodeDisableOptEvent(AbstractCode* code, |
SharedFunctionInfo* shared) { |
- PROFILER_LOG(CodeDisableOptEvent(code, shared)); |
+ profiler_listener_->CodeDisableOptEvent(code, shared); |
if (!is_logging_code_events()) return; |
CALL_LISTENERS(CodeDisableOptEvent(code, shared)); |
@@ -1249,7 +1246,7 @@ void Logger::CodeDisableOptEvent(AbstractCode* code, |
void Logger::CodeMovingGCEvent() { |
- PROFILER_LOG(CodeMovingGCEvent()); |
+ profiler_listener_->CodeMovingGCEvent(); |
if (!is_logging_code_events()) return; |
if (!log_->IsEnabled() || !FLAG_ll_prof) return; |
@@ -1258,7 +1255,7 @@ void Logger::CodeMovingGCEvent() { |
} |
void Logger::RegExpCodeCreateEvent(AbstractCode* code, String* source) { |
- PROFILER_LOG(RegExpCodeCreateEvent(code, source)); |
+ profiler_listener_->RegExpCodeCreateEvent(code, source); |
if (!is_logging_code_events()) return; |
CALL_LISTENERS(RegExpCodeCreateEvent(code, source)); |
@@ -1273,7 +1270,7 @@ void Logger::RegExpCodeCreateEvent(AbstractCode* code, String* source) { |
} |
void Logger::CodeMoveEvent(AbstractCode* from, Address to) { |
- PROFILER_LOG(CodeMoveEvent(from, to)); |
+ profiler_listener_->CodeMoveEvent(from, to); |
if (!is_logging_code_events()) return; |
CALL_LISTENERS(CodeMoveEvent(from, to)); |