diff options
author | Bert Belder <bertbelder@gmail.com> | 2012-06-13 15:34:45 +0200 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2012-06-14 01:37:13 +0200 |
commit | 50464cd4f49e40f4fe792ff46a81052319a222e9 (patch) | |
tree | 1fe524b2e6c0eb3c459142cd27539f88e1a3f63c /deps/v8/src/platform-cygwin.cc | |
parent | 09be360a0fee2c7619bae8c4248f9ed3d79d1b30 (diff) | |
download | node-50464cd4f49e40f4fe792ff46a81052319a222e9.tar.gz |
v8: upgrade to v3.11.10
Diffstat (limited to 'deps/v8/src/platform-cygwin.cc')
-rw-r--r-- | deps/v8/src/platform-cygwin.cc | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/deps/v8/src/platform-cygwin.cc b/deps/v8/src/platform-cygwin.cc index dd7253ba0..089ea38d9 100644 --- a/deps/v8/src/platform-cygwin.cc +++ b/deps/v8/src/platform-cygwin.cc @@ -62,22 +62,8 @@ double ceiling(double x) { static Mutex* limit_mutex = NULL; -void OS::SetUp() { - // Seed the random number generator. - // Convert the current time to a 64-bit integer first, before converting it - // to an unsigned. Going directly can cause an overflow and the seed to be - // set to all ones. The seed will be identical for different instances that - // call this setup code within the same millisecond. - uint64_t seed = static_cast<uint64_t>(TimeCurrentMillis()); - srandom(static_cast<unsigned int>(seed)); - limit_mutex = CreateMutex(); -} - - void OS::PostSetUp() { - // Math functions depend on CPU features therefore they are initialized after - // CPU. - MathSetup(); + POSIXPostSetUp(); } uint64_t OS::CpuFeaturesImpliedByPlatform() { @@ -634,8 +620,11 @@ class SamplerThread : public Thread { : Thread(Thread::Options("SamplerThread", kSamplerThreadStackSize)), interval_(interval) {} + static void SetUp() { if (!mutex_) mutex_ = OS::CreateMutex(); } + static void TearDown() { delete mutex_; } + static void AddActiveSampler(Sampler* sampler) { - ScopedLock lock(mutex_.Pointer()); + ScopedLock lock(mutex_); SamplerRegistry::AddActiveSampler(sampler); if (instance_ == NULL) { instance_ = new SamplerThread(sampler->interval()); @@ -646,7 +635,7 @@ class SamplerThread : public Thread { } static void RemoveActiveSampler(Sampler* sampler) { - ScopedLock lock(mutex_.Pointer()); + ScopedLock lock(mutex_); SamplerRegistry::RemoveActiveSampler(sampler); if (SamplerRegistry::GetState() == SamplerRegistry::HAS_NO_SAMPLERS) { RuntimeProfiler::StopRuntimeProfilerThreadBeforeShutdown(instance_); @@ -732,7 +721,7 @@ class SamplerThread : public Thread { RuntimeProfilerRateLimiter rate_limiter_; // Protects the process wide state below. - static LazyMutex mutex_; + static Mutex* mutex_; static SamplerThread* instance_; private: @@ -740,10 +729,29 @@ class SamplerThread : public Thread { }; -LazyMutex SamplerThread::mutex_ = LAZY_MUTEX_INITIALIZER; +Mutex* SamplerThread::mutex_ = NULL; SamplerThread* SamplerThread::instance_ = NULL; +void OS::SetUp() { + // Seed the random number generator. + // Convert the current time to a 64-bit integer first, before converting it + // to an unsigned. Going directly can cause an overflow and the seed to be + // set to all ones. The seed will be identical for different instances that + // call this setup code within the same millisecond. + uint64_t seed = static_cast<uint64_t>(TimeCurrentMillis()); + srandom(static_cast<unsigned int>(seed)); + limit_mutex = CreateMutex(); + SamplerThread::SetUp(); +} + + +void OS::TearDown() { + SamplerThread::TearDown(); + delete limit_mutex; +} + + Sampler::Sampler(Isolate* isolate, int interval) : isolate_(isolate), interval_(interval), |