Index: src/log.cc |
=================================================================== |
--- src/log.cc (revision 13212) |
+++ src/log.cc (working copy) |
@@ -469,12 +469,15 @@ |
void Logger::IssueCodeAddedEvent(Code* code, |
+ Script* script, |
const char* name, |
size_t name_len) { |
JitCodeEvent event; |
+ memset(&event, 0, sizeof(event)); |
event.type = JitCodeEvent::CODE_ADDED; |
event.code_start = code->instruction_start(); |
event.code_len = code->instruction_size(); |
+ event.userdata = script; |
event.name.str = name; |
event.name.len = name_len; |
@@ -513,7 +516,43 @@ |
code_event_handler_(&event); |
} |
+void Logger::IssueAddCodeLinePosInfoEvent(JITCodeLineInfo* lineinfo, |
+ int pc_offset, |
+ int position, |
+ bool is_statement) { |
+ JitCodeEvent event; |
+ event.type = JitCodeEvent::CODE_ADD_LINE_POS_INFO; |
+ event.userdata = lineinfo; |
+ event.line_info.offset = pc_offset; |
+ event.line_info.pos = position; |
+ event.line_info.is_statement = is_statement; |
+ |
+ code_event_handler_(&event); |
+} |
+ |
+void Logger::IssueStartCodePosInfoEvent(JITCodeLineInfo* lineinfo) { |
+ JitCodeEvent event; |
+ event.type = JitCodeEvent::CODE_START_LINE_INFO_RECORDING; |
+ event.userdata = lineinfo; |
+ |
+ code_event_handler_(&event); |
+} |
+ |
+void Logger::IssueEndCodePosInfoEvent(Code* code, void* lineinfostruct) { |
+ JitCodeEvent event; |
+ event.type = JitCodeEvent::CODE_END_LINE_INFO_RECORDING; |
+ |
+ if (code != NULL) |
+ event.code_start = code->instruction_start(); |
+ else |
+ event.code_start = 0; |
+ |
+ event.userdata = lineinfostruct; |
+ |
+ code_event_handler_(&event); |
+} |
+ |
#define DECLARE_EVENT(ignore1, name) name, |
static const char* const kLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { |
LOG_EVENTS_AND_TAGS_LIST(DECLARE_EVENT) |
@@ -897,7 +936,7 @@ |
name_buffer_->AppendBytes(comment); |
} |
if (code_event_handler_ != NULL) { |
- IssueCodeAddedEvent(code, name_buffer_->get(), name_buffer_->size()); |
+ IssueCodeAddedEvent(code, NULL, name_buffer_->get(), name_buffer_->size()); |
} |
if (!log_->IsEnabled()) return; |
if (FLAG_ll_prof) { |
@@ -937,7 +976,7 @@ |
name_buffer_->AppendString(name); |
} |
if (code_event_handler_ != NULL) { |
- IssueCodeAddedEvent(code, name_buffer_->get(), name_buffer_->size()); |
+ IssueCodeAddedEvent(code, NULL, name_buffer_->get(), name_buffer_->size()); |
} |
if (!log_->IsEnabled()) return; |
if (FLAG_ll_prof) { |
@@ -984,7 +1023,10 @@ |
name_buffer_->AppendString(name); |
} |
if (code_event_handler_ != NULL) { |
- IssueCodeAddedEvent(code, name_buffer_->get(), name_buffer_->size()); |
+ IssueCodeAddedEvent(code, shared->script()->IsScript() ? |
+ Script::cast(shared->script()):NULL, |
+ name_buffer_->get(), |
+ name_buffer_->size()); |
} |
if (!log_->IsEnabled()) return; |
if (FLAG_ll_prof) { |
@@ -1034,7 +1076,10 @@ |
name_buffer_->AppendInt(line); |
} |
if (code_event_handler_ != NULL) { |
- IssueCodeAddedEvent(code, name_buffer_->get(), name_buffer_->size()); |
+ IssueCodeAddedEvent(code, shared->script()->IsScript() ? |
+ Script::cast(shared->script()):NULL, |
+ name_buffer_->get(), |
+ name_buffer_->size()); |
} |
if (!log_->IsEnabled()) return; |
if (FLAG_ll_prof) { |
@@ -1075,7 +1120,7 @@ |
name_buffer_->AppendInt(args_count); |
} |
if (code_event_handler_ != NULL) { |
- IssueCodeAddedEvent(code, name_buffer_->get(), name_buffer_->size()); |
+ IssueCodeAddedEvent(code, NULL, name_buffer_->get(), name_buffer_->size()); |
} |
if (!log_->IsEnabled()) return; |
if (FLAG_ll_prof) { |
@@ -1113,7 +1158,7 @@ |
name_buffer_->AppendString(source); |
} |
if (code_event_handler_ != NULL) { |
- IssueCodeAddedEvent(code, name_buffer_->get(), name_buffer_->size()); |
+ IssueCodeAddedEvent(code, NULL, name_buffer_->get(), name_buffer_->size()); |
} |
if (!log_->IsEnabled()) return; |
if (FLAG_ll_prof) { |
@@ -1157,7 +1202,24 @@ |
DeleteEventInternal(CODE_DELETE_EVENT, from); |
} |
+void Logger::CodeLinePosInfoAddEvent(JITCodeLineInfo* lineinfo, |
+ int pc_offset, |
+ int position, |
+ bool is_statement) { |
+ if (code_event_handler_ != NULL) |
+ IssueAddCodeLinePosInfoEvent(lineinfo, pc_offset, position, is_statement); |
+} |
+void Logger::CodeStartLinePosInfoRecordEvent(JITCodeLineInfo* lineinfo) { |
+ if (code_event_handler_ != NULL) |
+ IssueStartCodePosInfoEvent(lineinfo); |
+} |
+ |
+void Logger::CodeEndLinePosInfoRecordEvent(Code* code, void* lineinfostruct) { |
+ if (code_event_handler_ != NULL) |
+ IssueEndCodePosInfoEvent(code, lineinfostruct); |
+} |
+ |
void Logger::SnapshotPositionEvent(Address addr, int pos) { |
if (!log_->IsEnabled()) return; |
if (FLAG_ll_prof) LowLevelSnapshotPositionEvent(addr, pos); |