Chromium Code Reviews| Index: src/cpu-profiler.cc |
| diff --git a/src/cpu-profiler.cc b/src/cpu-profiler.cc |
| index 54fec77a2a3a3b6f087ffd546ba5cd1221546321..d05a9597e8cc67a23286e8c90c6d5b6395560bfc 100644 |
| --- a/src/cpu-profiler.cc |
| +++ b/src/cpu-profiler.cc |
| @@ -257,17 +257,34 @@ void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, |
| CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); |
| CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; |
| rec->start = code->address(); |
| + // Get line info from the relocation information. |
| + ASSERT(Script::cast(shared->script())); |
| + JITLineInfoTable line_table; |
|
yurys
2014/07/29 13:15:10
Consider allocating JITLineInfoTable on the heap t
|
| + if (line > 0) { |
| + for (RelocIterator it(code); !it.done(); it.next()) { |
| + RelocInfo::Mode mode = it.rinfo()->rmode(); |
| + if (RelocInfo::IsPosition(mode)) { |
| + int pc_offset = static_cast<int>(it.rinfo()->pc() - code->address()); |
| + int position = static_cast<int>(it.rinfo()->data()); |
| + int lineno = |
| + Script::cast(shared->script())->GetLineNumber(position) + 1; |
| + if (position >= 0 && lineno > 0) { |
|
alph
2014/07/29 12:55:56
if position < 0 you don't need to make a call to G
|
| + line_table.SetPosition(pc_offset, lineno); |
| + } |
| + } |
| + } |
| + } |
| rec->entry = profiles_->NewCodeEntry( |
| tag, |
| profiles_->GetFunctionName(shared->DebugName()), |
| CodeEntry::kEmptyNamePrefix, |
| profiles_->GetName(source), |
| line, |
| - column); |
| + column, |
| + line_table.entries()->length() ? &line_table : NULL); |
| if (info) { |
| rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges()); |
| } |
| - ASSERT(Script::cast(shared->script())); |
|
alph
2014/07/29 12:55:55
why is it gone?
|
| Script* script = Script::cast(shared->script()); |
| rec->entry->set_script_id(script->id()->value()); |
| rec->size = code->ExecutableSize(); |