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

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

Issue 10084003: Valgrind cleanliness, part 6: Introduce OS::TearDown, cleaning up 2 mutexes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed typo. Created 8 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 | Annotate | Revision Log
« no previous file with comments | « src/platform-nullos.cc ('k') | src/platform-solaris.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 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 FULL_INTERVAL 786 FULL_INTERVAL
787 }; 787 };
788 788
789 static const int kSignalSenderStackSize = 64 * KB; 789 static const int kSignalSenderStackSize = 64 * KB;
790 790
791 explicit SignalSender(int interval) 791 explicit SignalSender(int interval)
792 : Thread(Thread::Options("SignalSender", kSignalSenderStackSize)), 792 : Thread(Thread::Options("SignalSender", kSignalSenderStackSize)),
793 vm_tgid_(getpid()), 793 vm_tgid_(getpid()),
794 interval_(interval) {} 794 interval_(interval) {}
795 795
796 static void SetUp() { 796 static void SetUp() { if (!mutex_) mutex_ = OS::CreateMutex(); }
797 if (!mutex_) { 797 static void TearDown() { delete mutex_; }
798 mutex_ = OS::CreateMutex();
799 }
800 }
801 798
802 static void InstallSignalHandler() { 799 static void InstallSignalHandler() {
803 struct sigaction sa; 800 struct sigaction sa;
804 sa.sa_sigaction = ProfilerSignalHandler; 801 sa.sa_sigaction = ProfilerSignalHandler;
805 sigemptyset(&sa.sa_mask); 802 sigemptyset(&sa.sa_mask);
806 sa.sa_flags = SA_RESTART | SA_SIGINFO; 803 sa.sa_flags = SA_RESTART | SA_SIGINFO;
807 signal_handler_installed_ = 804 signal_handler_installed_ =
808 (sigaction(SIGPROF, &sa, &old_signal_handler_) == 0); 805 (sigaction(SIGPROF, &sa, &old_signal_handler_) == 0);
809 } 806 }
810 807
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 938
942 void OS::SetUp() { 939 void OS::SetUp() {
943 // Seed the random number generator. We preserve microsecond resolution. 940 // Seed the random number generator. We preserve microsecond resolution.
944 uint64_t seed = Ticks() ^ (getpid() << 16); 941 uint64_t seed = Ticks() ^ (getpid() << 16);
945 srandom(static_cast<unsigned int>(seed)); 942 srandom(static_cast<unsigned int>(seed));
946 limit_mutex = CreateMutex(); 943 limit_mutex = CreateMutex();
947 SignalSender::SetUp(); 944 SignalSender::SetUp();
948 } 945 }
949 946
950 947
948 void OS::TearDown() {
949 SignalSender::TearDown();
950 delete limit_mutex;
951 }
952
953
951 Sampler::Sampler(Isolate* isolate, int interval) 954 Sampler::Sampler(Isolate* isolate, int interval)
952 : isolate_(isolate), 955 : isolate_(isolate),
953 interval_(interval), 956 interval_(interval),
954 profiling_(false), 957 profiling_(false),
955 active_(false), 958 active_(false),
956 samples_taken_(0) { 959 samples_taken_(0) {
957 data_ = new PlatformData; 960 data_ = new PlatformData;
958 } 961 }
959 962
960 963
(...skipping 11 matching lines...) Expand all
972 975
973 976
974 void Sampler::Stop() { 977 void Sampler::Stop() {
975 ASSERT(IsActive()); 978 ASSERT(IsActive());
976 SignalSender::RemoveActiveSampler(this); 979 SignalSender::RemoveActiveSampler(this);
977 SetActive(false); 980 SetActive(false);
978 } 981 }
979 982
980 983
981 } } // namespace v8::internal 984 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-nullos.cc ('k') | src/platform-solaris.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698