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

Side by Side Diff: src/platform-linux.cc

Issue 1523015: C++ profiles processor: align browser mode with the old implementation, sample VM state. (Closed)
Patch Set: Using Script::type to filter out native scripts. Created 10 years, 8 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/platform.h ('k') | src/platform-macos.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 } 721 }
722 722
723 723
724 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { 724 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) {
725 #ifndef V8_HOST_ARCH_MIPS 725 #ifndef V8_HOST_ARCH_MIPS
726 USE(info); 726 USE(info);
727 if (signal != SIGPROF) return; 727 if (signal != SIGPROF) return;
728 if (active_sampler_ == NULL) return; 728 if (active_sampler_ == NULL) return;
729 729
730 #ifdef ENABLE_CPP_PROFILES_PROCESSOR 730 #ifdef ENABLE_CPP_PROFILES_PROCESSOR
731 if (Logger::state() == GC || !IsVmThread()) return; 731 TickSample* sample = CpuProfiler::TickSampleEvent();
732 732 if (sample == NULL) return;
733 TickSample* sample = NULL; 733 sample->pc = NULL; // Impossible value if sampling succeeds.
734 sample->frames_count = 0;
734 #else 735 #else
735 TickSample sample_obj; 736 TickSample sample_obj;
736 TickSample* sample = &sample_obj; 737 TickSample* sample = &sample_obj;
738 #endif
737 739
738 // We always sample the VM state. 740 // We always sample the VM state.
739 sample->state = Logger::state(); 741 sample->state = Logger::state();
740 #endif
741
742 // If profiling, we extract the current pc and sp. 742 // If profiling, we extract the current pc and sp.
743 if (active_sampler_->IsProfiling()) { 743 if (active_sampler_->IsProfiling()) {
744 // Extracting the sample from the context is extremely machine dependent. 744 // Extracting the sample from the context is extremely machine dependent.
745 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); 745 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
746 mcontext_t& mcontext = ucontext->uc_mcontext; 746 mcontext_t& mcontext = ucontext->uc_mcontext;
747 #ifdef ENABLE_CPP_PROFILES_PROCESSOR
748 sample = CpuProfiler::TickSampleEvent();
749 #endif
750 if (sample != NULL) {
751 #if V8_HOST_ARCH_IA32 747 #if V8_HOST_ARCH_IA32
752 sample->pc = reinterpret_cast<Address>(mcontext.gregs[REG_EIP]); 748 sample->pc = reinterpret_cast<Address>(mcontext.gregs[REG_EIP]);
753 sample->sp = reinterpret_cast<Address>(mcontext.gregs[REG_ESP]); 749 sample->sp = reinterpret_cast<Address>(mcontext.gregs[REG_ESP]);
754 sample->fp = reinterpret_cast<Address>(mcontext.gregs[REG_EBP]); 750 sample->fp = reinterpret_cast<Address>(mcontext.gregs[REG_EBP]);
755 #elif V8_HOST_ARCH_X64 751 #elif V8_HOST_ARCH_X64
756 sample->pc = reinterpret_cast<Address>(mcontext.gregs[REG_RIP]); 752 sample->pc = reinterpret_cast<Address>(mcontext.gregs[REG_RIP]);
757 sample->sp = reinterpret_cast<Address>(mcontext.gregs[REG_RSP]); 753 sample->sp = reinterpret_cast<Address>(mcontext.gregs[REG_RSP]);
758 sample->fp = reinterpret_cast<Address>(mcontext.gregs[REG_RBP]); 754 sample->fp = reinterpret_cast<Address>(mcontext.gregs[REG_RBP]);
759 #elif V8_HOST_ARCH_ARM 755 #elif V8_HOST_ARCH_ARM
760 // An undefined macro evaluates to 0, so this applies to Android's Bionic also. 756 // An undefined macro evaluates to 0, so this applies to Android's Bionic also.
761 #if (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3)) 757 #if (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3))
762 sample->pc = reinterpret_cast<Address>(mcontext.gregs[R15]); 758 sample->pc = reinterpret_cast<Address>(mcontext.gregs[R15]);
763 sample->sp = reinterpret_cast<Address>(mcontext.gregs[R13]); 759 sample->sp = reinterpret_cast<Address>(mcontext.gregs[R13]);
764 sample->fp = reinterpret_cast<Address>(mcontext.gregs[R11]); 760 sample->fp = reinterpret_cast<Address>(mcontext.gregs[R11]);
765 #else 761 #else
766 sample->pc = reinterpret_cast<Address>(mcontext.arm_pc); 762 sample->pc = reinterpret_cast<Address>(mcontext.arm_pc);
767 sample->sp = reinterpret_cast<Address>(mcontext.arm_sp); 763 sample->sp = reinterpret_cast<Address>(mcontext.arm_sp);
768 sample->fp = reinterpret_cast<Address>(mcontext.arm_fp); 764 sample->fp = reinterpret_cast<Address>(mcontext.arm_fp);
769 #endif 765 #endif
770 #elif V8_HOST_ARCH_MIPS 766 #elif V8_HOST_ARCH_MIPS
771 // Implement this on MIPS. 767 // Implement this on MIPS.
772 UNIMPLEMENTED(); 768 UNIMPLEMENTED();
773 #endif 769 #endif
774 if (IsVmThread()) { 770 if (IsVmThread()) {
775 active_sampler_->SampleStack(sample); 771 active_sampler_->SampleStack(sample);
776 }
777 } 772 }
778 } 773 }
779 #ifndef ENABLE_CPP_PROFILES_PROCESSOR 774 #ifndef ENABLE_CPP_PROFILES_PROCESSOR
780 active_sampler_->Tick(sample); 775 active_sampler_->Tick(sample);
781 #endif 776 #endif
782 #endif 777 #endif
783 } 778 }
784 779
785 780
786 class Sampler::PlatformData : public Malloced { 781 class Sampler::PlatformData : public Malloced {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 840
846 // This sampler is no longer the active sampler. 841 // This sampler is no longer the active sampler.
847 active_sampler_ = NULL; 842 active_sampler_ = NULL;
848 active_ = false; 843 active_ = false;
849 } 844 }
850 845
851 846
852 #endif // ENABLE_LOGGING_AND_PROFILING 847 #endif // ENABLE_LOGGING_AND_PROFILING
853 848
854 } } // namespace v8::internal 849 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform.h ('k') | src/platform-macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698