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

Side by Side Diff: src/cpu-profiler.cc

Issue 910773002: Propagate Deopt reason to cpu-profiler (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: comments addressed Created 5 years, 10 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
« no previous file with comments | « src/cpu-profiler.h ('k') | src/cpu-profiler-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/deoptimizer.h"
10 #include "src/frames-inl.h" 11 #include "src/frames-inl.h"
11 #include "src/hashmap.h" 12 #include "src/hashmap.h"
12 #include "src/log-inl.h" 13 #include "src/log-inl.h"
13 #include "src/vm-state-inl.h" 14 #include "src/vm-state-inl.h"
14 15
15 #include "include/v8-profiler.h" 16 #include "include/v8-profiler.h"
16 17
17 namespace v8 { 18 namespace v8 {
18 namespace internal { 19 namespace internal {
19 20
(...skipping 11 matching lines...) Expand all
31 last_code_event_id_(0), 32 last_code_event_id_(0),
32 last_processed_code_event_id_(0) {} 33 last_processed_code_event_id_(0) {}
33 34
34 35
35 void ProfilerEventsProcessor::Enqueue(const CodeEventsContainer& event) { 36 void ProfilerEventsProcessor::Enqueue(const CodeEventsContainer& event) {
36 event.generic.order = ++last_code_event_id_; 37 event.generic.order = ++last_code_event_id_;
37 events_buffer_.Enqueue(event); 38 events_buffer_.Enqueue(event);
38 } 39 }
39 40
40 41
42 void ProfilerEventsProcessor::AddDeoptStack(Isolate* isolate, Address from,
43 int fp_to_sp_delta) {
44 TickSampleEventRecord record(last_code_event_id_);
45 RegisterState regs;
46 Address fp = isolate->c_entry_fp(isolate->thread_local_top());
47 regs.sp = fp - fp_to_sp_delta;
48 regs.fp = fp;
49 regs.pc = from;
50 record.sample.Init(isolate, regs, TickSample::kSkipCEntryFrame);
51 ticks_from_vm_buffer_.Enqueue(record);
52 }
53
54
41 void ProfilerEventsProcessor::AddCurrentStack(Isolate* isolate) { 55 void ProfilerEventsProcessor::AddCurrentStack(Isolate* isolate) {
42 TickSampleEventRecord record(last_code_event_id_); 56 TickSampleEventRecord record(last_code_event_id_);
43 RegisterState regs; 57 RegisterState regs;
44 StackFrameIterator it(isolate); 58 StackFrameIterator it(isolate);
45 if (!it.done()) { 59 if (!it.done()) {
46 StackFrame* frame = it.frame(); 60 StackFrame* frame = it.frame();
47 regs.sp = frame->sp(); 61 regs.sp = frame->sp();
48 regs.fp = frame->fp(); 62 regs.fp = frame->fp();
49 regs.pc = frame->pc(); 63 regs.pc = frame->pc();
50 } 64 }
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 336
323 void CpuProfiler::CodeDisableOptEvent(Code* code, SharedFunctionInfo* shared) { 337 void CpuProfiler::CodeDisableOptEvent(Code* code, SharedFunctionInfo* shared) {
324 CodeEventsContainer evt_rec(CodeEventRecord::CODE_DISABLE_OPT); 338 CodeEventsContainer evt_rec(CodeEventRecord::CODE_DISABLE_OPT);
325 CodeDisableOptEventRecord* rec = &evt_rec.CodeDisableOptEventRecord_; 339 CodeDisableOptEventRecord* rec = &evt_rec.CodeDisableOptEventRecord_;
326 rec->start = code->address(); 340 rec->start = code->address();
327 rec->bailout_reason = GetBailoutReason(shared->disable_optimization_reason()); 341 rec->bailout_reason = GetBailoutReason(shared->disable_optimization_reason());
328 processor_->Enqueue(evt_rec); 342 processor_->Enqueue(evt_rec);
329 } 343 }
330 344
331 345
346 void CpuProfiler::CodeDeoptEvent(Code* code, int bailout_id, Address pc,
347 int fp_to_sp_delta) {
348 CodeEventsContainer evt_rec(CodeEventRecord::CODE_DEOPT);
349 CodeDeoptEventRecord* rec = &evt_rec.CodeDeoptEventRecord_;
350 Deoptimizer::DeoptInfo info = Deoptimizer::GetDeoptInfo(code, bailout_id);
351 rec->start = code->address();
352 rec->deopt_reason = Deoptimizer::GetDeoptReason(info.deopt_reason);
353 rec->raw_position = info.raw_position;
354 processor_->Enqueue(evt_rec);
355 processor_->AddDeoptStack(isolate_, pc, fp_to_sp_delta);
356 }
357
358
332 void CpuProfiler::CodeDeleteEvent(Address from) { 359 void CpuProfiler::CodeDeleteEvent(Address from) {
333 } 360 }
334 361
335 362
336 void CpuProfiler::SharedFunctionInfoMoveEvent(Address from, Address to) { 363 void CpuProfiler::SharedFunctionInfoMoveEvent(Address from, Address to) {
337 CodeEventsContainer evt_rec(CodeEventRecord::SHARED_FUNC_MOVE); 364 CodeEventsContainer evt_rec(CodeEventRecord::SHARED_FUNC_MOVE);
338 SharedFunctionInfoMoveEventRecord* rec = 365 SharedFunctionInfoMoveEventRecord* rec =
339 &evt_rec.SharedFunctionInfoMoveEventRecord_; 366 &evt_rec.SharedFunctionInfoMoveEventRecord_;
340 rec->from = from; 367 rec->from = from;
341 rec->to = to; 368 rec->to = to;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; 546 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_;
520 Builtins::Name id = static_cast<Builtins::Name>(i); 547 Builtins::Name id = static_cast<Builtins::Name>(i);
521 rec->start = builtins->builtin(id)->address(); 548 rec->start = builtins->builtin(id)->address();
522 rec->builtin_id = id; 549 rec->builtin_id = id;
523 processor_->Enqueue(evt_rec); 550 processor_->Enqueue(evt_rec);
524 } 551 }
525 } 552 }
526 553
527 554
528 } } // namespace v8::internal 555 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/cpu-profiler.h ('k') | src/cpu-profiler-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698