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

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 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
« no previous file with comments | « src/api.cc ('k') | src/full-codegen.cc » ('j') | src/profile-generator.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/cpu-profiler.cc
diff --git a/src/cpu-profiler.cc b/src/cpu-profiler.cc
index 68a565c73a2ffa4469948a1aa36b52e565f6947a..115324c459a1961e93dc225bd7414bd8b73af8bc 100644
--- a/src/cpu-profiler.cc
+++ b/src/cpu-profiler.cc
@@ -256,20 +256,38 @@ void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code,
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
rec->start = code->address();
+ Script* script = NULL;
+ JITLineInfoTable* line_table = NULL;
+ if (shared->script()->IsScript()) {
alph 2014/08/15 12:10:47 Is it possible the shared->script() is not a Scrip
Denis Pravdin 2014/08/23 05:18:52 I reused the same pattern as CpuProfiler::CodeCrea
Denis Pravdin 2014/09/01 10:44:38 I reused the same pattern as CpuProfiler::CodeCrea
alph 2014/09/09 14:47:34 That function is called from a different place, so
+ DCHECK(Script::cast(shared->script()));
+ script = Script::cast(shared->script());
alph 2014/08/15 12:10:47 Script::cast does the DCHECK internally so you don
+ 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);
+ }
+ }
+ }
+ }
rec->entry = profiles_->NewCodeEntry(
tag, profiles_->GetFunctionName(shared->DebugName()),
CodeEntry::kEmptyNamePrefix, profiles_->GetName(script_name), line,
- column);
+ column, line_table);
if (info) {
rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges());
}
- DCHECK(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();
+ if (script) {
+ rec->entry->set_script_id(script->id()->value());
+ }
rec->entry->set_bailout_reason(
GetBailoutReason(shared->DisableOptimizationReason()));
+ rec->size = code->ExecutableSize();
+ rec->shared = shared->address();
processor_->Enqueue(evt_rec);
}
« no previous file with comments | « src/api.cc ('k') | src/full-codegen.cc » ('j') | src/profile-generator.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698