Index: src/log.cc |
diff --git a/src/log.cc b/src/log.cc |
index e334fca4d790208d8c0ea3fc6fd1991b0786c97e..36d002eb8d83a5c129d6bbf50686809495a22b32 100644 |
--- a/src/log.cc |
+++ b/src/log.cc |
@@ -21,6 +21,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" |
@@ -41,12 +42,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()) { |
@@ -766,11 +761,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_; |
} |
@@ -878,7 +875,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()); |
@@ -1094,19 +1091,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); |
} |
@@ -1124,7 +1121,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)); |
@@ -1138,7 +1135,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)); |
@@ -1158,7 +1155,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)); |
@@ -1191,7 +1188,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)); |
@@ -1217,7 +1214,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)); |
@@ -1231,7 +1228,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)); |
@@ -1248,7 +1245,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; |
@@ -1257,7 +1254,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)); |
@@ -1272,7 +1269,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)); |