Commit ff8ed6b7 authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

Fix Solaris build. Patch from Ryan Dahl. See http://codereview.chromium.org/5968004/

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6259 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b9f5ab9e
...@@ -663,6 +663,8 @@ def GuessVisibility(os, toolchain): ...@@ -663,6 +663,8 @@ def GuessVisibility(os, toolchain):
if os == 'win32' and toolchain == 'gcc': if os == 'win32' and toolchain == 'gcc':
# MinGW can't do it. # MinGW can't do it.
return 'default' return 'default'
elif os == 'solaris':
return 'default'
else: else:
return 'hidden' return 'hidden'
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <errno.h> #include <errno.h>
#include <ieeefp.h> // finite() #include <ieeefp.h> // finite()
#include <signal.h> // sigemptyset(), etc #include <signal.h> // sigemptyset(), etc
#include <sys/kdi_regs.h>
#undef MAP_TYPE #undef MAP_TYPE
...@@ -493,6 +494,16 @@ class SolarisMutex : public Mutex { ...@@ -493,6 +494,16 @@ class SolarisMutex : public Mutex {
int Unlock() { return pthread_mutex_unlock(&mutex_); } int Unlock() { return pthread_mutex_unlock(&mutex_); }
virtual bool TryLock() {
int result = pthread_mutex_trylock(&mutex_);
// Return false if the lock is busy and locking failed.
if (result == EBUSY) {
return false;
}
ASSERT(result == 0); // Verify no other errors.
return true;
}
private: private:
pthread_mutex_t mutex_; pthread_mutex_t mutex_;
}; };
...@@ -584,21 +595,37 @@ Semaphore* OS::CreateSemaphore(int count) { ...@@ -584,21 +595,37 @@ Semaphore* OS::CreateSemaphore(int count) {
#ifdef ENABLE_LOGGING_AND_PROFILING #ifdef ENABLE_LOGGING_AND_PROFILING
static Sampler* active_sampler_ = NULL; static Sampler* active_sampler_ = NULL;
static pthread_t vm_tid_ = 0;
static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) {
USE(info); USE(info);
if (signal != SIGPROF) return; if (signal != SIGPROF) return;
if (active_sampler_ == NULL) return; if (active_sampler_ == NULL || !active_sampler_->IsActive()) return;
if (vm_tid_ != pthread_self()) return;
TickSample sample;
sample.pc = 0; TickSample sample_obj;
sample.sp = 0; TickSample* sample = CpuProfiler::TickSampleEvent();
sample.fp = 0; if (sample == NULL) sample = &sample_obj;
// We always sample the VM state. // Extracting the sample from the context is extremely machine dependent.
sample.state = VMState::current_state(); ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
mcontext_t& mcontext = ucontext->uc_mcontext;
active_sampler_->Tick(&sample); sample->state = Top::current_vm_state();
#if V8_HOST_ARCH_IA32
sample->pc = reinterpret_cast<Address>(mcontext.gregs[KDIREG_EIP]);
sample->sp = reinterpret_cast<Address>(mcontext.gregs[KDIREG_ESP]);
sample->fp = reinterpret_cast<Address>(mcontext.gregs[KDIREG_EBP]);
#elif V8_HOST_ARCH_X64
sample->pc = reinterpret_cast<Address>(mcontext.gregs[KDIREG_RIP]);
sample->sp = reinterpret_cast<Address>(mcontext.gregs[KDIREG_RSP]);
sample->fp = reinterpret_cast<Address>(mcontext.gregs[KDIREG_RBP]);
#else
UNIMPLEMENTED();
#endif
active_sampler_->SampleStack(sample);
active_sampler_->Tick(sample);
} }
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#define V8_V8UTILS_H_ #define V8_V8UTILS_H_
#include "utils.h" #include "utils.h"
#include "platform.h" // For va_list on Solaris.
namespace v8 { namespace v8 {
namespace internal { namespace internal {
......
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