Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Unified Diff: src/profiler/cpu-profiler.cc

Issue 1816393002: Make line level profile ignore positions coming from inlined functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 4 landing Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/profiler/cpu-profiler.cc
diff --git a/src/profiler/cpu-profiler.cc b/src/profiler/cpu-profiler.cc
index b4c764e327321122456bf3e7bb4ae511df3823d7..47585b7b08c93def8243ea86290a3d00cd715d40 100644
--- a/src/profiler/cpu-profiler.cc
+++ b/src/profiler/cpu-profiler.cc
@@ -274,18 +274,23 @@ void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag,
if (script) {
if (abstract_code->IsCode()) {
Code* code = abstract_code->GetCode();
+ int start_position = shared->start_position();
+ int end_position = shared->end_position();
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);
- }
- }
+ RelocInfo* reloc_info = it.rinfo();
+ if (!RelocInfo::IsPosition(reloc_info->rmode())) continue;
+ int position = static_cast<int>(reloc_info->data());
+ // TODO(alph): in case of inlining the position may correspond
+ // to an inlined function source code. Do not collect positions
+ // that fall beyond the function source code. There's however a
+ // chance the inlined function has similar positions but in another
+ // 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 {
BytecodeArray* bytecode = abstract_code->GetBytecodeArray();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698