#undef DECLARE_EVENT
+#define PROFILER_LOG(Call) \
+ do { \
+ CpuProfiler* cpu_profiler = isolate_->cpu_profiler(); \
+ if (cpu_profiler->is_profiling()) { \
+ cpu_profiler->Call; \
+ } \
+ } while (false);
+
// ComputeMarker must only be used when SharedFunctionInfo is known.
static const char* ComputeMarker(Code* code) {
switch (code->kind()) {
public:
explicit JitLogger(JitCodeEventHandler code_event_handler);
- void CodeMovedEvent(Address from, Address to);
+ void CodeMoveEvent(Address from, Address to);
void CodeDeleteEvent(Address from);
void AddCodeLinePosInfoEvent(
void* jit_handler_data,
}
-void JitLogger::CodeMovedEvent(Address from, Address to) {
+void JitLogger::CodeMoveEvent(Address from, Address to) {
Code* from_code = Code::cast(HeapObject::FromAddress(from));
JitCodeEvent event;
void Logger::CallbackEventInternal(const char* prefix, Name* name,
Address entry_point) {
- if (!log_->IsEnabled() || !FLAG_log_code) return;
+ if (!FLAG_log_code || !log_->IsEnabled()) return;
Log::MessageBuilder msg(log_);
msg.Append("%s,%s,-2,",
kLogEventsNames[CODE_CREATION_EVENT],
void Logger::CallbackEvent(Name* name, Address entry_point) {
- if (!log_->IsEnabled() || !FLAG_log_code) return;
+ PROFILER_LOG(CallbackEvent(name, entry_point));
CallbackEventInternal("", name, entry_point);
}
void Logger::GetterCallbackEvent(Name* name, Address entry_point) {
- if (!log_->IsEnabled() || !FLAG_log_code) return;
+ PROFILER_LOG(GetterCallbackEvent(name, entry_point));
CallbackEventInternal("get ", name, entry_point);
}
void Logger::SetterCallbackEvent(Name* name, Address entry_point) {
- if (!log_->IsEnabled() || !FLAG_log_code) return;
+ PROFILER_LOG(SetterCallbackEvent(name, entry_point));
CallbackEventInternal("set ", name, entry_point);
}
void Logger::CodeCreateEvent(LogEventsAndTags tag,
Code* code,
const char* comment) {
- if (!is_logging_code_events()) return;
+ PROFILER_LOG(CodeCreateEvent(tag, code, comment));
+ if (!is_logging_code_events()) return;
JIT_LOG(CodeCreateEvent(tag, code, comment));
LL_LOG(CodeCreateEvent(tag, code, comment));
CODE_ADDRESS_MAP_LOG(CodeCreateEvent(tag, code, comment));
void Logger::CodeCreateEvent(LogEventsAndTags tag,
Code* code,
Name* name) {
- if (!is_logging_code_events()) return;
+ PROFILER_LOG(CodeCreateEvent(tag, code, name));
+ if (!is_logging_code_events()) return;
JIT_LOG(CodeCreateEvent(tag, code, name));
LL_LOG(CodeCreateEvent(tag, code, name));
CODE_ADDRESS_MAP_LOG(CodeCreateEvent(tag, code, name));
SharedFunctionInfo* shared,
CompilationInfo* info,
Name* name) {
- if (!is_logging_code_events()) return;
+ PROFILER_LOG(CodeCreateEvent(tag, code, shared, info, name));
+ if (!is_logging_code_events()) return;
JIT_LOG(CodeCreateEvent(tag, code, shared, info, name));
LL_LOG(CodeCreateEvent(tag, code, shared, info, name));
CODE_ADDRESS_MAP_LOG(CodeCreateEvent(tag, code, shared, info, name));
SharedFunctionInfo* shared,
CompilationInfo* info,
Name* source, int line) {
- if (!is_logging_code_events()) return;
+ PROFILER_LOG(CodeCreateEvent(tag, code, shared, info, source, line));
+ if (!is_logging_code_events()) return;
JIT_LOG(CodeCreateEvent(tag, code, shared, info, source, line));
LL_LOG(CodeCreateEvent(tag, code, shared, info, source, line));
CODE_ADDRESS_MAP_LOG(CodeCreateEvent(tag, code, shared, info, source, line));
void Logger::CodeCreateEvent(LogEventsAndTags tag,
Code* code,
int args_count) {
- if (!is_logging_code_events()) return;
+ PROFILER_LOG(CodeCreateEvent(tag, code, args_count));
+ if (!is_logging_code_events()) return;
JIT_LOG(CodeCreateEvent(tag, code, args_count));
LL_LOG(CodeCreateEvent(tag, code, args_count));
CODE_ADDRESS_MAP_LOG(CodeCreateEvent(tag, code, args_count));
void Logger::CodeMovingGCEvent() {
+ PROFILER_LOG(CodeMovingGCEvent());
+
+ if (!is_logging_code_events()) return;
if (!log_->IsEnabled() || !FLAG_ll_prof) return;
LL_LOG(CodeMovingGCEvent());
OS::SignalCodeMovingGC();
void Logger::RegExpCodeCreateEvent(Code* code, String* source) {
- if (!is_logging_code_events()) return;
+ PROFILER_LOG(RegExpCodeCreateEvent(code, source));
+ if (!is_logging_code_events()) return;
JIT_LOG(RegExpCodeCreateEvent(code, source));
LL_LOG(RegExpCodeCreateEvent(code, source));
CODE_ADDRESS_MAP_LOG(RegExpCodeCreateEvent(code, source));
void Logger::CodeMoveEvent(Address from, Address to) {
- JIT_LOG(CodeMovedEvent(from, to));
- if (!log_->IsEnabled()) return;
+ PROFILER_LOG(CodeMoveEvent(from, to));
+
+ if (!is_logging_code_events()) return;
+ JIT_LOG(CodeMoveEvent(from, to));
LL_LOG(CodeMoveEvent(from, to));
CODE_ADDRESS_MAP_LOG(CodeMoveEvent(from, to));
MoveEventInternal(CODE_MOVE_EVENT, from, to);
void Logger::CodeDeleteEvent(Address from) {
+ PROFILER_LOG(CodeDeleteEvent(from));
+
+ if (!is_logging_code_events()) return;
JIT_LOG(CodeDeleteEvent(from));
- if (!log_->IsEnabled()) return;
LL_LOG(CodeDeleteEvent(from));
CODE_ADDRESS_MAP_LOG(CodeDeleteEvent(from));
- if (!log_->IsEnabled() || !FLAG_log_code) return;
+ if (!FLAG_log_code || !log_->IsEnabled()) return;
Log::MessageBuilder msg(log_);
msg.Append("%s,", kLogEventsNames[CODE_DELETE_EVENT]);
msg.AppendAddress(from);
void Logger::SharedFunctionInfoMoveEvent(Address from, Address to) {
+ PROFILER_LOG(SharedFunctionInfoMoveEvent(from, to));
+
+ if (!is_logging_code_events()) return;
MoveEventInternal(SHARED_FUNC_MOVE_EVENT, from, to);
}
void Logger::MoveEventInternal(LogEventsAndTags event,
Address from,
Address to) {
- if (!log_->IsEnabled() || !FLAG_log_code) return;
+ if (!FLAG_log_code || !log_->IsEnabled()) return;
Log::MessageBuilder msg(log_);
msg.Append("%s,", kLogEventsNames[event]);
msg.AppendAddress(from);