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

Side by Side Diff: src/sampler.cc

Issue 638633002: Tick processor: Print C++ entry points (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 6 years, 2 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
« no previous file with comments | « src/sampler.h ('k') | src/x64/macro-assembler-x64.cc » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/sampler.h" 5 #include "src/sampler.h"
6 6
7 #if V8_OS_POSIX && !V8_OS_CYGWIN 7 #if V8_OS_POSIX && !V8_OS_CYGWIN
8 8
9 #define USE_SIGNALS 9 #define USE_SIGNALS
10 10
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 563
564 564
565 base::Mutex* SamplerThread::mutex_ = NULL; 565 base::Mutex* SamplerThread::mutex_ = NULL;
566 SamplerThread* SamplerThread::instance_ = NULL; 566 SamplerThread* SamplerThread::instance_ = NULL;
567 567
568 568
569 // 569 //
570 // StackTracer implementation 570 // StackTracer implementation
571 // 571 //
572 DISABLE_ASAN void TickSample::Init(Isolate* isolate, 572 DISABLE_ASAN void TickSample::Init(Isolate* isolate,
573 const v8::RegisterState& regs) { 573 const v8::RegisterState& regs,
574 RecordCEntryFrame record_c_entry_frame) {
574 timestamp = base::TimeTicks::HighResolutionNow(); 575 timestamp = base::TimeTicks::HighResolutionNow();
575 pc = reinterpret_cast<Address>(regs.pc); 576 pc = reinterpret_cast<Address>(regs.pc);
576 state = isolate->current_vm_state(); 577 state = isolate->current_vm_state();
577 578
578 // Avoid collecting traces while doing GC. 579 // Avoid collecting traces while doing GC.
579 if (state == GC) return; 580 if (state == GC) return;
580 581
581 Address js_entry_sp = isolate->js_entry_sp(); 582 Address js_entry_sp = isolate->js_entry_sp();
582 if (js_entry_sp == 0) return; // Not executing JS now. 583 if (js_entry_sp == 0) return; // Not executing JS now.
583 584
(...skipping 10 matching lines...) Expand all
594 // stubs (we'll figure out later, if this value makes sense). 595 // stubs (we'll figure out later, if this value makes sense).
595 tos = Memory::Address_at(reinterpret_cast<Address>(regs.sp)); 596 tos = Memory::Address_at(reinterpret_cast<Address>(regs.sp));
596 has_external_callback = false; 597 has_external_callback = false;
597 } 598 }
598 599
599 SafeStackFrameIterator it(isolate, reinterpret_cast<Address>(regs.fp), 600 SafeStackFrameIterator it(isolate, reinterpret_cast<Address>(regs.fp),
600 reinterpret_cast<Address>(regs.sp), js_entry_sp); 601 reinterpret_cast<Address>(regs.sp), js_entry_sp);
601 top_frame_type = it.top_frame_type(); 602 top_frame_type = it.top_frame_type();
602 603
603 SampleInfo info; 604 SampleInfo info;
604 GetStackSample(isolate, regs, reinterpret_cast<void**>(&stack[0]), 605 GetStackSample(isolate, regs, record_c_entry_frame,
605 kMaxFramesCount, &info); 606 reinterpret_cast<void**>(&stack[0]), kMaxFramesCount, &info);
606 frames_count = static_cast<unsigned>(info.frames_count); 607 frames_count = static_cast<unsigned>(info.frames_count);
607 } 608 }
608 609
609 610
610 void TickSample::GetStackSample(Isolate* isolate, const v8::RegisterState& regs, 611 void TickSample::GetStackSample(Isolate* isolate, const v8::RegisterState& regs,
612 RecordCEntryFrame record_c_entry_frame,
611 void** frames, size_t frames_limit, 613 void** frames, size_t frames_limit,
612 v8::SampleInfo* sample_info) { 614 v8::SampleInfo* sample_info) {
613 sample_info->frames_count = 0; 615 sample_info->frames_count = 0;
614 sample_info->vm_state = isolate->current_vm_state(); 616 sample_info->vm_state = isolate->current_vm_state();
615 if (sample_info->vm_state == GC) return; 617 if (sample_info->vm_state == GC) return;
616 618
617 Address js_entry_sp = isolate->js_entry_sp(); 619 Address js_entry_sp = isolate->js_entry_sp();
618 if (js_entry_sp == 0) return; // Not executing JS now. 620 if (js_entry_sp == 0) return; // Not executing JS now.
619 621
620 SafeStackFrameIterator it(isolate, reinterpret_cast<Address>(regs.fp), 622 SafeStackFrameIterator it(isolate, reinterpret_cast<Address>(regs.fp),
621 reinterpret_cast<Address>(regs.sp), js_entry_sp); 623 reinterpret_cast<Address>(regs.sp), js_entry_sp);
622 size_t i = 0; 624 size_t i = 0;
625 if (record_c_entry_frame == kIncludeCEntryFrame && !it.done() &&
626 it.top_frame_type() == StackFrame::EXIT) {
627 frames[i++] = isolate->c_function();
628 }
623 while (!it.done() && i < frames_limit) { 629 while (!it.done() && i < frames_limit) {
624 frames[i++] = it.frame()->pc(); 630 frames[i++] = it.frame()->pc();
625 it.Advance(); 631 it.Advance();
626 } 632 }
627 sample_info->frames_count = i; 633 sample_info->frames_count = i;
628 } 634 }
629 635
630 636
631 void Sampler::SetUp() { 637 void Sampler::SetUp() {
632 #if defined(USE_SIGNALS) 638 #if defined(USE_SIGNALS)
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 SignalHandler::DecreaseSamplerCount(); 695 SignalHandler::DecreaseSamplerCount();
690 #endif 696 #endif
691 base::NoBarrier_AtomicIncrement(&profiling_, -1); 697 base::NoBarrier_AtomicIncrement(&profiling_, -1);
692 } 698 }
693 699
694 700
695 void Sampler::SampleStack(const v8::RegisterState& state) { 701 void Sampler::SampleStack(const v8::RegisterState& state) {
696 TickSample* sample = isolate_->cpu_profiler()->StartTickSample(); 702 TickSample* sample = isolate_->cpu_profiler()->StartTickSample();
697 TickSample sample_obj; 703 TickSample sample_obj;
698 if (sample == NULL) sample = &sample_obj; 704 if (sample == NULL) sample = &sample_obj;
699 sample->Init(isolate_, state); 705 sample->Init(isolate_, state, TickSample::kIncludeCEntryFrame);
700 if (is_counting_samples_) { 706 if (is_counting_samples_) {
701 if (sample->state == JS || sample->state == EXTERNAL) { 707 if (sample->state == JS || sample->state == EXTERNAL) {
702 ++js_and_external_sample_count_; 708 ++js_and_external_sample_count_;
703 } 709 }
704 } 710 }
705 Tick(sample); 711 Tick(sample);
706 if (sample != &sample_obj) { 712 if (sample != &sample_obj) {
707 isolate_->cpu_profiler()->FinishTickSample(); 713 isolate_->cpu_profiler()->FinishTickSample();
708 } 714 }
709 } 715 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 #endif // USE_SIMULATOR 757 #endif // USE_SIMULATOR
752 SampleStack(state); 758 SampleStack(state);
753 } 759 }
754 ResumeThread(profiled_thread); 760 ResumeThread(profiled_thread);
755 } 761 }
756 762
757 #endif // USE_SIGNALS 763 #endif // USE_SIGNALS
758 764
759 765
760 } } // namespace v8::internal 766 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/sampler.h ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698