Revision: 11320
Author: [email protected]
Date: Fri Apr 13 07:08:31 2012
Log: Valgrind cleanliness, part 6: Introduce OS::TearDown, cleaning up
2 mutexes.
Review URL: https://chromiumcodereview.appspot.com/10084003
http://code.google.com/p/v8/source/detail?r=11320
Modified:
/branches/bleeding_edge/src/platform-cygwin.cc
/branches/bleeding_edge/src/platform-freebsd.cc
/branches/bleeding_edge/src/platform-linux.cc
/branches/bleeding_edge/src/platform-macos.cc
/branches/bleeding_edge/src/platform-nullos.cc
/branches/bleeding_edge/src/platform-openbsd.cc
/branches/bleeding_edge/src/platform-solaris.cc
/branches/bleeding_edge/src/platform-win32.cc
/branches/bleeding_edge/src/platform.h
/branches/bleeding_edge/src/v8.cc
=======================================
--- /branches/bleeding_edge/src/platform-cygwin.cc Thu Apr 5 07:10:39 2012
+++ /branches/bleeding_edge/src/platform-cygwin.cc Fri Apr 13 07:08:31 2012
@@ -620,11 +620,8 @@
: Thread(Thread::Options("SamplerThread", kSamplerThreadStackSize)),
interval_(interval) {}
- static void SetUp() {
- if (!mutex_) {
- mutex_ = OS::CreateMutex();
- }
- }
+ static void SetUp() { if (!mutex_) mutex_ = OS::CreateMutex(); }
+ static void TearDown() { delete mutex_; }
static void AddActiveSampler(Sampler* sampler) {
ScopedLock lock(mutex_);
@@ -747,6 +744,12 @@
limit_mutex = CreateMutex();
SamplerThread::SetUp();
}
+
+
+void OS::TearDown() {
+ SamplerThread::TearDown();
+ delete limit_mutex;
+}
Sampler::Sampler(Isolate* isolate, int interval)
=======================================
--- /branches/bleeding_edge/src/platform-freebsd.cc Thu Apr 5 07:10:39 2012
+++ /branches/bleeding_edge/src/platform-freebsd.cc Fri Apr 13 07:08:31 2012
@@ -716,11 +716,8 @@
: Thread(Thread::Options("SignalSender", kSignalSenderStackSize)),
interval_(interval) {}
- static void SetUp() {
- if (!mutex_) {
- mutex_ = OS::CreateMutex();
- }
- }
+ static void SetUp() { if (!mutex_) mutex_ = OS::CreateMutex(); }
+ static void TearDown() { delete mutex_; }
static void AddActiveSampler(Sampler* sampler) {
ScopedLock lock(mutex_);
@@ -862,6 +859,12 @@
limit_mutex = CreateMutex();
SignalSender::SetUp();
}
+
+
+void OS::TearDown() {
+ SignalSender::TearDown();
+ delete limit_mutex;
+}
Sampler::Sampler(Isolate* isolate, int interval)
=======================================
--- /branches/bleeding_edge/src/platform-linux.cc Thu Apr 5 08:22:51 2012
+++ /branches/bleeding_edge/src/platform-linux.cc Fri Apr 13 07:08:31 2012
@@ -1055,11 +1055,8 @@
vm_tgid_(getpid()),
interval_(interval) {}
- static void SetUp() {
- if (!mutex_) {
- mutex_ = OS::CreateMutex();
- }
- }
+ static void SetUp() { if (!mutex_) mutex_ = OS::CreateMutex(); }
+ static void TearDown() { delete mutex_; }
static void InstallSignalHandler() {
struct sigaction sa;
@@ -1236,6 +1233,12 @@
#endif
SignalSender::SetUp();
}
+
+
+void OS::TearDown() {
+ SignalSender::TearDown();
+ delete limit_mutex;
+}
Sampler::Sampler(Isolate* isolate, int interval)
=======================================
--- /branches/bleeding_edge/src/platform-macos.cc Thu Apr 5 07:10:39 2012
+++ /branches/bleeding_edge/src/platform-macos.cc Fri Apr 13 07:08:31 2012
@@ -743,11 +743,8 @@
: Thread(Thread::Options("SamplerThread", kSamplerThreadStackSize)),
interval_(interval) {}
- static void SetUp() {
- if (!mutex_) {
- mutex_ = OS::CreateMutex();
- }
- }
+ static void SetUp() { if (!mutex_) mutex_ = OS::CreateMutex(); }
+ static void TearDown() { delete mutex_; }
static void AddActiveSampler(Sampler* sampler) {
ScopedLock lock(mutex_);
@@ -879,6 +876,12 @@
limit_mutex = CreateMutex();
SamplerThread::SetUp();
}
+
+
+void OS::TearDown() {
+ SamplerThread::TearDown();
+ delete limit_mutex;
+}
Sampler::Sampler(Isolate* isolate, int interval)
=======================================
--- /branches/bleeding_edge/src/platform-nullos.cc Fri Mar 30 07:30:46 2012
+++ /branches/bleeding_edge/src/platform-nullos.cc Fri Apr 13 07:08:31 2012
@@ -89,6 +89,11 @@
void OS::PostSetUp() {
UNIMPLEMENTED();
}
+
+
+void OS::TearDown() {
+ UNIMPLEMENTED();
+}
// Returns the accumulated user time for thread.
=======================================
--- /branches/bleeding_edge/src/platform-openbsd.cc Thu Apr 5 07:10:39 2012
+++ /branches/bleeding_edge/src/platform-openbsd.cc Fri Apr 13 07:08:31 2012
@@ -793,11 +793,8 @@
vm_tgid_(getpid()),
interval_(interval) {}
- static void SetUp() {
- if (!mutex_) {
- mutex_ = OS::CreateMutex();
- }
- }
+ static void SetUp() { if (!mutex_) mutex_ = OS::CreateMutex(); }
+ static void TearDown() { delete mutex_; }
static void InstallSignalHandler() {
struct sigaction sa;
@@ -946,6 +943,12 @@
limit_mutex = CreateMutex();
SignalSender::SetUp();
}
+
+
+void OS::TearDown() {
+ SignalSender::TearDown();
+ delete limit_mutex;
+}
Sampler::Sampler(Isolate* isolate, int interval)
=======================================
--- /branches/bleeding_edge/src/platform-solaris.cc Thu Apr 5 07:10:39 2012
+++ /branches/bleeding_edge/src/platform-solaris.cc Fri Apr 13 07:08:31 2012
@@ -712,11 +712,8 @@
: Thread(Thread::Options("SignalSender", kSignalSenderStackSize)),
interval_(interval) {}
- static void SetUp() {
- if (!mutex_) {
- mutex_ = OS::CreateMutex();
- }
- }
+ static void SetUp() { if (!mutex_) mutex_ = OS::CreateMutex(); }
+ static void TearDown() { delete mutex_; }
static void InstallSignalHandler() {
struct sigaction sa;
@@ -868,6 +865,12 @@
limit_mutex = CreateMutex();
SignalSender::SetUp();
}
+
+
+void OS::TearDown() {
+ SignalSender::TearDown();
+ delete limit_mutex;
+}
Sampler::Sampler(Isolate* isolate, int interval)
=======================================
--- /branches/bleeding_edge/src/platform-win32.cc Thu Apr 5 07:10:39 2012
+++ /branches/bleeding_edge/src/platform-win32.cc Fri Apr 13 07:08:31 2012
@@ -1949,11 +1949,8 @@
: Thread(Thread::Options("SamplerThread", kSamplerThreadStackSize)),
interval_(interval) {}
- static void SetUp() {
- if (!mutex_) {
- mutex_ = OS::CreateMutex();
- }
- }
+ static void SetUp() { if (!mutex_) mutex_ = OS::CreateMutex(); }
+ static void TearDown() { delete mutex_; }
static void AddActiveSampler(Sampler* sampler) {
ScopedLock lock(mutex_);
@@ -2076,6 +2073,12 @@
limit_mutex = CreateMutex();
SamplerThread::SetUp();
}
+
+
+void OS::TearDown() {
+ SamplerThread::TearDown();
+ delete limit_mutex;
+}
Sampler::Sampler(Isolate* isolate, int interval)
=======================================
--- /branches/bleeding_edge/src/platform.h Fri Mar 30 07:30:46 2012
+++ /branches/bleeding_edge/src/platform.h Fri Apr 13 07:08:31 2012
@@ -123,6 +123,9 @@
// called after CPU initialization.
static void PostSetUp();
+ // Clean up platform-OS-related things. Called once at VM shutdown.
+ static void TearDown();
+
// Returns the accumulated user time for thread. This routine
// can be used for profiling. The implementation should
// strive for high-precision timer resolution, preferable
=======================================
--- /branches/bleeding_edge/src/v8.cc Thu Apr 5 07:10:39 2012
+++ /branches/bleeding_edge/src/v8.cc Fri Apr 13 07:08:31 2012
@@ -118,6 +118,8 @@
delete call_completed_callbacks_;
call_completed_callbacks_ = NULL;
+
+ OS::TearDown();
}
@@ -248,7 +250,6 @@
}
void V8::InitializeOncePerProcessImpl() {
- // Set up the platform OS support.
OS::SetUp();
use_crankshaft_ = FLAG_crankshaft;
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev