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

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

Issue 9836108: Rollback of r11015, r11014, r11011, r11010 in trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Finish file upload Created 8 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 | Annotate | Revision Log
« no previous file with comments | « src/platform-macos.cc ('k') | src/platform-posix.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 } 805 }
806 806
807 static void RestoreSignalHandler() { 807 static void RestoreSignalHandler() {
808 if (signal_handler_installed_) { 808 if (signal_handler_installed_) {
809 sigaction(SIGPROF, &old_signal_handler_, 0); 809 sigaction(SIGPROF, &old_signal_handler_, 0);
810 signal_handler_installed_ = false; 810 signal_handler_installed_ = false;
811 } 811 }
812 } 812 }
813 813
814 static void AddActiveSampler(Sampler* sampler) { 814 static void AddActiveSampler(Sampler* sampler) {
815 ScopedLock lock(mutex_.Pointer()); 815 ScopedLock lock(mutex_);
816 SamplerRegistry::AddActiveSampler(sampler); 816 SamplerRegistry::AddActiveSampler(sampler);
817 if (instance_ == NULL) { 817 if (instance_ == NULL) {
818 // Start a thread that will send SIGPROF signal to VM threads, 818 // Start a thread that will send SIGPROF signal to VM threads,
819 // when CPU profiling will be enabled. 819 // when CPU profiling will be enabled.
820 instance_ = new SignalSender(sampler->interval()); 820 instance_ = new SignalSender(sampler->interval());
821 instance_->Start(); 821 instance_->Start();
822 } else { 822 } else {
823 ASSERT(instance_->interval_ == sampler->interval()); 823 ASSERT(instance_->interval_ == sampler->interval());
824 } 824 }
825 } 825 }
826 826
827 static void RemoveActiveSampler(Sampler* sampler) { 827 static void RemoveActiveSampler(Sampler* sampler) {
828 ScopedLock lock(mutex_.Pointer()); 828 ScopedLock lock(mutex_);
829 SamplerRegistry::RemoveActiveSampler(sampler); 829 SamplerRegistry::RemoveActiveSampler(sampler);
830 if (SamplerRegistry::GetState() == SamplerRegistry::HAS_NO_SAMPLERS) { 830 if (SamplerRegistry::GetState() == SamplerRegistry::HAS_NO_SAMPLERS) {
831 RuntimeProfiler::StopRuntimeProfilerThreadBeforeShutdown(instance_); 831 RuntimeProfiler::StopRuntimeProfilerThreadBeforeShutdown(instance_);
832 delete instance_; 832 delete instance_;
833 instance_ = NULL; 833 instance_ = NULL;
834 RestoreSignalHandler(); 834 RestoreSignalHandler();
835 } 835 }
836 } 836 }
837 837
838 // Implement Thread::Run(). 838 // Implement Thread::Run().
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 } 912 }
913 #endif 913 #endif
914 USE(result); 914 USE(result);
915 } 915 }
916 916
917 const int vm_tgid_; 917 const int vm_tgid_;
918 const int interval_; 918 const int interval_;
919 RuntimeProfilerRateLimiter rate_limiter_; 919 RuntimeProfilerRateLimiter rate_limiter_;
920 920
921 // Protects the process wide state below. 921 // Protects the process wide state below.
922 static LazyMutex mutex_; 922 static Mutex* mutex_;
923 static SignalSender* instance_; 923 static SignalSender* instance_;
924 static bool signal_handler_installed_; 924 static bool signal_handler_installed_;
925 static struct sigaction old_signal_handler_; 925 static struct sigaction old_signal_handler_;
926 926
927 private: 927 private:
928 DISALLOW_COPY_AND_ASSIGN(SignalSender); 928 DISALLOW_COPY_AND_ASSIGN(SignalSender);
929 }; 929 };
930 930
931 931
932 LazyMutex SignalSender::mutex_ = LAZY_MUTEX_INITIALIZER; 932 Mutex* SignalSender::mutex_ = OS::CreateMutex();
933 SignalSender* SignalSender::instance_ = NULL; 933 SignalSender* SignalSender::instance_ = NULL;
934 struct sigaction SignalSender::old_signal_handler_; 934 struct sigaction SignalSender::old_signal_handler_;
935 bool SignalSender::signal_handler_installed_ = false; 935 bool SignalSender::signal_handler_installed_ = false;
936 936
937 937
938 Sampler::Sampler(Isolate* isolate, int interval) 938 Sampler::Sampler(Isolate* isolate, int interval)
939 : isolate_(isolate), 939 : isolate_(isolate),
940 interval_(interval), 940 interval_(interval),
941 profiling_(false), 941 profiling_(false),
942 active_(false), 942 active_(false),
(...skipping 16 matching lines...) Expand all
959 959
960 960
961 void Sampler::Stop() { 961 void Sampler::Stop() {
962 ASSERT(IsActive()); 962 ASSERT(IsActive());
963 SignalSender::RemoveActiveSampler(this); 963 SignalSender::RemoveActiveSampler(this);
964 SetActive(false); 964 SetActive(false);
965 } 965 }
966 966
967 967
968 } } // namespace v8::internal 968 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-macos.cc ('k') | src/platform-posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698