Commit 4606211d authored by alph's avatar alph Committed by Commit bot

Make line level profile ignore positions coming from inlined functions.

BUG=590936
LOG=N

Review URL: https://codereview.chromium.org/1816393002

Cr-Commit-Position: refs/heads/master@{#35040}
parent 2ef81f1d
...@@ -274,18 +274,23 @@ void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, ...@@ -274,18 +274,23 @@ void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag,
if (script) { if (script) {
if (abstract_code->IsCode()) { if (abstract_code->IsCode()) {
Code* code = abstract_code->GetCode(); Code* code = abstract_code->GetCode();
int start_position = shared->start_position();
int end_position = shared->end_position();
line_table = new JITLineInfoTable(); line_table = new JITLineInfoTable();
for (RelocIterator it(code); !it.done(); it.next()) { for (RelocIterator it(code); !it.done(); it.next()) {
RelocInfo::Mode mode = it.rinfo()->rmode(); RelocInfo* reloc_info = it.rinfo();
if (RelocInfo::IsPosition(mode)) { if (!RelocInfo::IsPosition(reloc_info->rmode())) continue;
int position = static_cast<int>(it.rinfo()->data()); int position = static_cast<int>(reloc_info->data());
if (position >= 0) { // TODO(alph): in case of inlining the position may correspond
int pc_offset = // to an inlined function source code. Do not collect positions
static_cast<int>(it.rinfo()->pc() - code->address()); // that fall beyond the function source code. There's however a
int line_number = script->GetLineNumber(position) + 1; // chance the inlined function has similar positions but in another
line_table->SetPosition(pc_offset, line_number); // script. So the proper fix is to store script_id in some form
} // along with the inlined function positions.
} if (position < start_position || position >= end_position) continue;
int pc_offset = static_cast<int>(reloc_info->pc() - code->address());
int line_number = script->GetLineNumber(position) + 1;
line_table->SetPosition(pc_offset, line_number);
} }
} else { } else {
BytecodeArray* bytecode = abstract_code->GetBytecodeArray(); BytecodeArray* bytecode = abstract_code->GetBytecodeArray();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment