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

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

Issue 660452: Assign to "sample.state" before reading it. (Closed)
Patch Set: Created 10 years, 9 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-freebsd.cc ('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 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { 723 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) {
724 #ifndef V8_HOST_ARCH_MIPS 724 #ifndef V8_HOST_ARCH_MIPS
725 USE(info); 725 USE(info);
726 if (signal != SIGPROF) return; 726 if (signal != SIGPROF) return;
727 if (active_sampler_ == NULL) return; 727 if (active_sampler_ == NULL) return;
728 728
729 TickSample sample; 729 TickSample sample;
730 730
731 // We always sample the VM state.
732 sample.state = Logger::state();
733
731 // If profiling, we extract the current pc and sp. 734 // If profiling, we extract the current pc and sp.
732 if (active_sampler_->IsProfiling()) { 735 if (active_sampler_->IsProfiling()) {
733 // Extracting the sample from the context is extremely machine dependent. 736 // Extracting the sample from the context is extremely machine dependent.
734 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); 737 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
735 mcontext_t& mcontext = ucontext->uc_mcontext; 738 mcontext_t& mcontext = ucontext->uc_mcontext;
736 #if V8_HOST_ARCH_IA32 739 #if V8_HOST_ARCH_IA32
737 sample.pc = reinterpret_cast<Address>(mcontext.gregs[REG_EIP]); 740 sample.pc = reinterpret_cast<Address>(mcontext.gregs[REG_EIP]);
738 sample.sp = reinterpret_cast<Address>(mcontext.gregs[REG_ESP]); 741 sample.sp = reinterpret_cast<Address>(mcontext.gregs[REG_ESP]);
739 sample.fp = reinterpret_cast<Address>(mcontext.gregs[REG_EBP]); 742 sample.fp = reinterpret_cast<Address>(mcontext.gregs[REG_EBP]);
740 #elif V8_HOST_ARCH_X64 743 #elif V8_HOST_ARCH_X64
(...skipping 12 matching lines...) Expand all
753 sample.fp = reinterpret_cast<Address>(mcontext.arm_fp); 756 sample.fp = reinterpret_cast<Address>(mcontext.arm_fp);
754 #endif 757 #endif
755 #elif V8_HOST_ARCH_MIPS 758 #elif V8_HOST_ARCH_MIPS
756 // Implement this on MIPS. 759 // Implement this on MIPS.
757 UNIMPLEMENTED(); 760 UNIMPLEMENTED();
758 #endif 761 #endif
759 if (IsVmThread()) 762 if (IsVmThread())
760 active_sampler_->SampleStack(&sample); 763 active_sampler_->SampleStack(&sample);
761 } 764 }
762 765
763 // We always sample the VM state.
764 sample.state = Logger::state();
765
766 active_sampler_->Tick(&sample); 766 active_sampler_->Tick(&sample);
767 #endif 767 #endif
768 } 768 }
769 769
770 770
771 class Sampler::PlatformData : public Malloced { 771 class Sampler::PlatformData : public Malloced {
772 public: 772 public:
773 PlatformData() { 773 PlatformData() {
774 signal_handler_installed_ = false; 774 signal_handler_installed_ = false;
775 } 775 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 830
831 // This sampler is no longer the active sampler. 831 // This sampler is no longer the active sampler.
832 active_sampler_ = NULL; 832 active_sampler_ = NULL;
833 active_ = false; 833 active_ = false;
834 } 834 }
835 835
836 836
837 #endif // ENABLE_LOGGING_AND_PROFILING 837 #endif // ENABLE_LOGGING_AND_PROFILING
838 838
839 } } // namespace v8::internal 839 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-freebsd.cc ('k') | src/platform-macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698