Index: src/cpu-profiler.cc |
diff --git a/src/cpu-profiler.cc b/src/cpu-profiler.cc |
index 68a565c73a2ffa4469948a1aa36b52e565f6947a..2cb855aa91d1bdc242c43bcee6ceed02fafc9207 100644 |
--- a/src/cpu-profiler.cc |
+++ b/src/cpu-profiler.cc |
@@ -201,7 +201,10 @@ void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, |
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); |
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; |
rec->start = code->address(); |
- rec->entry = profiles_->NewCodeEntry(tag, profiles_->GetFunctionName(name)); |
+ rec->entry = profiles_->NewCodeEntry( |
+ tag, profiles_->GetFunctionName(name), CodeEntry::kEmptyNamePrefix, |
+ CodeEntry::kEmptyResourceName, CpuProfileNode::kNoLineNumberInfo, |
+ CpuProfileNode::kNoColumnNumberInfo, NULL, code->instruction_start()); |
rec->size = code->ExecutableSize(); |
rec->shared = NULL; |
processor_->Enqueue(evt_rec); |
@@ -215,7 +218,10 @@ void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, |
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); |
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; |
rec->start = code->address(); |
- rec->entry = profiles_->NewCodeEntry(tag, profiles_->GetFunctionName(name)); |
+ rec->entry = profiles_->NewCodeEntry( |
+ tag, profiles_->GetFunctionName(name), CodeEntry::kEmptyNamePrefix, |
+ CodeEntry::kEmptyResourceName, CpuProfileNode::kNoLineNumberInfo, |
+ CpuProfileNode::kNoColumnNumberInfo, NULL, code->instruction_start()); |
rec->size = code->ExecutableSize(); |
rec->shared = NULL; |
processor_->Enqueue(evt_rec); |
@@ -231,7 +237,9 @@ void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code, |
rec->start = code->address(); |
rec->entry = profiles_->NewCodeEntry( |
tag, profiles_->GetFunctionName(shared->DebugName()), |
- CodeEntry::kEmptyNamePrefix, profiles_->GetName(script_name)); |
+ CodeEntry::kEmptyNamePrefix, profiles_->GetName(script_name), |
+ CpuProfileNode::kNoLineNumberInfo, CpuProfileNode::kNoColumnNumberInfo, |
+ NULL, code->instruction_start()); |
if (info) { |
rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges()); |
} |
@@ -256,15 +264,29 @@ void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code, |
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); |
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; |
rec->start = code->address(); |
+ Script* script = Script::cast(shared->script()); |
+ JITLineInfoTable* line_table = NULL; |
+ if (script) { |
+ line_table = new JITLineInfoTable(); |
+ for (RelocIterator it(code); !it.done(); it.next()) { |
+ RelocInfo::Mode mode = it.rinfo()->rmode(); |
+ if (RelocInfo::IsPosition(mode)) { |
+ int position = static_cast<int>(it.rinfo()->data()); |
+ if (position >= 0) { |
+ int pc_offset = static_cast<int>(it.rinfo()->pc() - code->address()); |
+ int line_number = script->GetLineNumber(position) + 1; |
+ line_table->SetPosition(pc_offset, line_number); |
+ } |
+ } |
+ } |
+ } |
rec->entry = profiles_->NewCodeEntry( |
tag, profiles_->GetFunctionName(shared->DebugName()), |
CodeEntry::kEmptyNamePrefix, profiles_->GetName(script_name), line, |
- column); |
+ column, line_table, code->instruction_start()); |
if (info) { |
rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges()); |
} |
- DCHECK(Script::cast(shared->script())); |
- Script* script = Script::cast(shared->script()); |
rec->entry->set_script_id(script->id()->value()); |
rec->size = code->ExecutableSize(); |
rec->shared = shared->address(); |
@@ -282,9 +304,9 @@ void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, |
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; |
rec->start = code->address(); |
rec->entry = profiles_->NewCodeEntry( |
- tag, |
- profiles_->GetName(args_count), |
- "args_count: "); |
+ tag, profiles_->GetName(args_count), "args_count: ", |
+ CodeEntry::kEmptyResourceName, CpuProfileNode::kNoLineNumberInfo, |
+ CpuProfileNode::kNoColumnNumberInfo, NULL, code->instruction_start()); |
rec->size = code->ExecutableSize(); |
rec->shared = NULL; |
processor_->Enqueue(evt_rec); |
@@ -344,9 +366,9 @@ void CpuProfiler::RegExpCodeCreateEvent(Code* code, String* source) { |
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; |
rec->start = code->address(); |
rec->entry = profiles_->NewCodeEntry( |
- Logger::REG_EXP_TAG, |
- profiles_->GetName(source), |
- "RegExp: "); |
+ Logger::REG_EXP_TAG, profiles_->GetName(source), "RegExp: ", |
+ CodeEntry::kEmptyResourceName, CpuProfileNode::kNoLineNumberInfo, |
+ CpuProfileNode::kNoColumnNumberInfo, NULL, code->instruction_start()); |
rec->size = code->ExecutableSize(); |
processor_->Enqueue(evt_rec); |
} |