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

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

Issue 2109673003: Use source position table in turbofan code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: drive-by fix for relocation info size reservation Created 4 years, 6 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 | « src/objects-inl.h ('k') | src/x87/deoptimizer-x87.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/profiler/profiler-listener.cc
diff --git a/src/profiler/profiler-listener.cc b/src/profiler/profiler-listener.cc
index 838076120b9f8625944cceccf03a68575926ead7..a25ccf11ac5a1519fad135e971df44b2d08f7f4c 100644
--- a/src/profiler/profiler-listener.cc
+++ b/src/profiler/profiler-listener.cc
@@ -88,51 +88,23 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
JITLineInfoTable* line_table = NULL;
if (script) {
line_table = new JITLineInfoTable();
- if (abstract_code->IsCode()) {
- Code* code = abstract_code->GetCode();
- int start_position = shared->start_position();
- int end_position = shared->end_position();
- if (code->kind() == Code::FUNCTION ||
- (code->is_optimized_code() && !code->is_turbofanned())) {
- for (SourcePositionTableIterator it(code->source_position_table());
- !it.done(); it.Advance()) {
- int position = it.source_position();
- // 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 line_number = script->GetLineNumber(it.source_position()) + 1;
- int pc_offset = it.code_offset() + Code::kHeaderSize;
- line_table->SetPosition(pc_offset, line_number);
- }
- } else {
- for (RelocIterator it(code); !it.done(); it.next()) {
- 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();
- SourcePositionTableIterator it(bytecode->source_position_table());
- for (; !it.done(); it.Advance()) {
- int line_number = script->GetLineNumber(it.source_position()) + 1;
- int pc_offset = it.code_offset() + BytecodeArray::kHeaderSize;
- line_table->SetPosition(pc_offset, line_number);
- }
+ int offset = abstract_code->IsCode() ? Code::kHeaderSize
+ : BytecodeArray::kHeaderSize;
+ int start_position = shared->start_position();
+ int end_position = shared->end_position();
+ for (SourcePositionTableIterator it(abstract_code->source_position_table());
+ !it.done(); it.Advance()) {
+ int position = it.source_position();
+ // 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 line_number = script->GetLineNumber(position) + 1;
+ int pc_offset = it.code_offset() + offset;
+ line_table->SetPosition(pc_offset, line_number);
}
}
rec->entry = NewCodeEntry(
« no previous file with comments | « src/objects-inl.h ('k') | src/x87/deoptimizer-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698