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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/cpu-profiler-inl.h" 7 #include "src/cpu-profiler-inl.h"
8 8
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/frames-inl.h" 10 #include "src/frames-inl.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 250
251 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, 251 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag,
252 Code* code, 252 Code* code,
253 SharedFunctionInfo* shared, 253 SharedFunctionInfo* shared,
254 CompilationInfo* info, 254 CompilationInfo* info,
255 Name* source, int line, int column) { 255 Name* source, int line, int column) {
256 if (FilterOutCodeCreateEvent(tag)) return; 256 if (FilterOutCodeCreateEvent(tag)) return;
257 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); 257 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
258 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; 258 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
259 rec->start = code->address(); 259 rec->start = code->address();
260 // Get line info from the relocation information.
261 ASSERT(Script::cast(shared->script()));
262 JITLineInfoTable line_table;
yurys 2014/07/29 13:15:10 Consider allocating JITLineInfoTable on the heap t
263 if (line > 0) {
264 for (RelocIterator it(code); !it.done(); it.next()) {
265 RelocInfo::Mode mode = it.rinfo()->rmode();
266 if (RelocInfo::IsPosition(mode)) {
267 int pc_offset = static_cast<int>(it.rinfo()->pc() - code->address());
268 int position = static_cast<int>(it.rinfo()->data());
269 int lineno =
270 Script::cast(shared->script())->GetLineNumber(position) + 1;
271 if (position >= 0 && lineno > 0) {
alph 2014/07/29 12:55:56 if position < 0 you don't need to make a call to G
272 line_table.SetPosition(pc_offset, lineno);
273 }
274 }
275 }
276 }
260 rec->entry = profiles_->NewCodeEntry( 277 rec->entry = profiles_->NewCodeEntry(
261 tag, 278 tag,
262 profiles_->GetFunctionName(shared->DebugName()), 279 profiles_->GetFunctionName(shared->DebugName()),
263 CodeEntry::kEmptyNamePrefix, 280 CodeEntry::kEmptyNamePrefix,
264 profiles_->GetName(source), 281 profiles_->GetName(source),
265 line, 282 line,
266 column); 283 column,
284 line_table.entries()->length() ? &line_table : NULL);
267 if (info) { 285 if (info) {
268 rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges()); 286 rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges());
269 } 287 }
270 ASSERT(Script::cast(shared->script()));
alph 2014/07/29 12:55:55 why is it gone?
271 Script* script = Script::cast(shared->script()); 288 Script* script = Script::cast(shared->script());
272 rec->entry->set_script_id(script->id()->value()); 289 rec->entry->set_script_id(script->id()->value());
273 rec->size = code->ExecutableSize(); 290 rec->size = code->ExecutableSize();
274 rec->shared = shared->address(); 291 rec->shared = shared->address();
275 rec->entry->set_bailout_reason( 292 rec->entry->set_bailout_reason(
276 GetBailoutReason(shared->DisableOptimizationReason())); 293 GetBailoutReason(shared->DisableOptimizationReason()));
277 processor_->Enqueue(evt_rec); 294 processor_->Enqueue(evt_rec);
278 } 295 }
279 296
280 297
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; 520 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_;
504 Builtins::Name id = static_cast<Builtins::Name>(i); 521 Builtins::Name id = static_cast<Builtins::Name>(i);
505 rec->start = builtins->builtin(id)->address(); 522 rec->start = builtins->builtin(id)->address();
506 rec->builtin_id = id; 523 rec->builtin_id = id;
507 processor_->Enqueue(evt_rec); 524 processor_->Enqueue(evt_rec);
508 } 525 }
509 } 526 }
510 527
511 528
512 } } // namespace v8::internal 529 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698