Valgrind cleanliness, part 6: Introduce OS::TearDown, cleaning up 2 mutexes.

Review URL: https://chromiumcodereview.appspot.com/10084003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11320 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent f07b2133
......@@ -620,11 +620,8 @@ class SamplerThread : public Thread {
: 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_);
......@@ -749,6 +746,12 @@ void OS::SetUp() {
}
void OS::TearDown() {
SamplerThread::TearDown();
delete limit_mutex;
}
Sampler::Sampler(Isolate* isolate, int interval)
: isolate_(isolate),
interval_(interval),
......
......@@ -716,11 +716,8 @@ class SignalSender : public Thread {
: 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_);
......@@ -864,6 +861,12 @@ void OS::SetUp() {
}
void OS::TearDown() {
SignalSender::TearDown();
delete limit_mutex;
}
Sampler::Sampler(Isolate* isolate, int interval)
: isolate_(isolate),
interval_(interval),
......
......@@ -1055,11 +1055,8 @@ class SignalSender : public Thread {
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;
......@@ -1238,6 +1235,12 @@ void OS::SetUp() {
}
void OS::TearDown() {
SignalSender::TearDown();
delete limit_mutex;
}
Sampler::Sampler(Isolate* isolate, int interval)
: isolate_(isolate),
interval_(interval),
......
......@@ -743,11 +743,8 @@ class SamplerThread : public Thread {
: 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_);
......@@ -881,6 +878,12 @@ void OS::SetUp() {
}
void OS::TearDown() {
SamplerThread::TearDown();
delete limit_mutex;
}
Sampler::Sampler(Isolate* isolate, int interval)
: isolate_(isolate),
interval_(interval),
......
......@@ -91,6 +91,11 @@ void OS::PostSetUp() {
}
void OS::TearDown() {
UNIMPLEMENTED();
}
// Returns the accumulated user time for thread.
int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) {
UNIMPLEMENTED();
......
......@@ -793,11 +793,8 @@ class SignalSender : public Thread {
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;
......@@ -948,6 +945,12 @@ void OS::SetUp() {
}
void OS::TearDown() {
SignalSender::TearDown();
delete limit_mutex;
}
Sampler::Sampler(Isolate* isolate, int interval)
: isolate_(isolate),
interval_(interval),
......
......@@ -712,11 +712,8 @@ class SignalSender : public Thread {
: 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;
......@@ -870,6 +867,12 @@ void OS::SetUp() {
}
void OS::TearDown() {
SignalSender::TearDown();
delete limit_mutex;
}
Sampler::Sampler(Isolate* isolate, int interval)
: isolate_(isolate),
interval_(interval),
......
......@@ -1949,11 +1949,8 @@ class SamplerThread : public Thread {
: 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_);
......@@ -2078,6 +2075,12 @@ void OS::SetUp() {
}
void OS::TearDown() {
SamplerThread::TearDown();
delete limit_mutex;
}
Sampler::Sampler(Isolate* isolate, int interval)
: isolate_(isolate),
interval_(interval),
......
......@@ -123,6 +123,9 @@ class OS {
// 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
......
......@@ -118,6 +118,8 @@ void V8::TearDown() {
delete call_completed_callbacks_;
call_completed_callbacks_ = NULL;
OS::TearDown();
}
......@@ -248,7 +250,6 @@ Object* V8::FillHeapNumberWithRandom(Object* heap_number,
}
void V8::InitializeOncePerProcessImpl() {
// Set up the platform OS support.
OS::SetUp();
use_crankshaft_ = FLAG_crankshaft;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment