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

Unified Diff: src/cpu-profiler.cc

Issue 424973004: Extend CPU profiler with mapping ticks to source lines (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed the comments Created 6 years, 4 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
Index: src/cpu-profiler.cc
diff --git a/src/cpu-profiler.cc b/src/cpu-profiler.cc
index 54fec77a2a3a3b6f087ffd546ba5cd1221546321..b9c63bd9663d80f75e142477405a687ee8cf7677 100644
--- a/src/cpu-profiler.cc
+++ b/src/cpu-profiler.cc
@@ -257,18 +257,35 @@ void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag,
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
rec->start = code->address();
+ ASSERT(Script::cast(shared->script()));
+ Script* script = Script::cast(shared->script());
+
+ // Get line info from the relocation information.
+ JITLineInfoTable* line_table = new JITLineInfoTable();
+ Handle<Script> script_handle(Script::cast(shared->script()));
+ 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(source),
line,
- column);
+ column,
+ line_table);
if (info) {
rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges());
}
- ASSERT(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();

Powered by Google App Engine
This is Rietveld 408576698