| Index: src/platform-solaris.cc
|
| diff --git a/src/platform-solaris.cc b/src/platform-solaris.cc
|
| index e044dbccadaae0b7e534c3ae8f4910a8fcecd609..be8bbfce76c97a50ce8a481ffd972eec4a9933c9 100644
|
| --- a/src/platform-solaris.cc
|
| +++ b/src/platform-solaris.cc
|
| @@ -91,22 +91,10 @@ 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 will 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();
|
| }
|
|
|
|
|
| @@ -724,6 +712,12 @@ class SignalSender : public Thread {
|
| : Thread(Thread::Options("SignalSender", kSignalSenderStackSize)),
|
| interval_(interval) {}
|
|
|
| + static void SetUp() {
|
| + if (!mutex_) {
|
| + mutex_ = OS::CreateMutex();
|
| + }
|
| + }
|
| +
|
| static void InstallSignalHandler() {
|
| struct sigaction sa;
|
| sa.sa_sigaction = ProfilerSignalHandler;
|
| @@ -741,7 +735,7 @@ class SignalSender : public Thread {
|
| }
|
|
|
| static void AddActiveSampler(Sampler* sampler) {
|
| - ScopedLock lock(mutex_.Pointer());
|
| + ScopedLock lock(mutex_);
|
| SamplerRegistry::AddActiveSampler(sampler);
|
| if (instance_ == NULL) {
|
| // Start a thread that will send SIGPROF signal to VM threads,
|
| @@ -754,7 +748,7 @@ class SignalSender : 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_);
|
| @@ -848,7 +842,7 @@ class SignalSender : public Thread {
|
| RuntimeProfilerRateLimiter rate_limiter_;
|
|
|
| // Protects the process wide state below.
|
| - static LazyMutex mutex_;
|
| + static Mutex* mutex_;
|
| static SignalSender* instance_;
|
| static bool signal_handler_installed_;
|
| static struct sigaction old_signal_handler_;
|
| @@ -857,12 +851,25 @@ class SignalSender : public Thread {
|
| DISALLOW_COPY_AND_ASSIGN(SignalSender);
|
| };
|
|
|
| -LazyMutex SignalSender::mutex_ = LAZY_MUTEX_INITIALIZER;
|
| +Mutex* SignalSender::mutex_ = NULL;
|
| SignalSender* SignalSender::instance_ = NULL;
|
| struct sigaction SignalSender::old_signal_handler_;
|
| bool SignalSender::signal_handler_installed_ = false;
|
|
|
|
|
| +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 will 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();
|
| + SignalSender::SetUp();
|
| +}
|
| +
|
| +
|
| Sampler::Sampler(Isolate* isolate, int interval)
|
| : isolate_(isolate),
|
| interval_(interval),
|
|
|