diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2010-12-17 01:22:41 +0300 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2010-12-17 01:22:50 +0300 |
commit | 02aae22397fe38e70fb488195a035c913c4f71b1 (patch) | |
tree | 2446e5f4bdd94892833e1de19e220f10aba7bb6e /deps | |
parent | c9d3a81db0e795f67ae478fe2e910c7c429dff60 (diff) |
Add solaris patch file
Diffstat (limited to 'deps')
-rw-r--r-- | deps/v8/0003-Fix-Solaris-build.patch | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/deps/v8/0003-Fix-Solaris-build.patch b/deps/v8/0003-Fix-Solaris-build.patch new file mode 100644 index 00000000000..db6f0909a54 --- /dev/null +++ b/deps/v8/0003-Fix-Solaris-build.patch @@ -0,0 +1,103 @@ +From 2a40926a1e1c8d385afefc1fe5255e21cc1a8f1e Mon Sep 17 00:00:00 2001 +From: Ryan Dahl <ry@tinyclouds.org> +Date: Thu, 16 Dec 2010 22:20:44 +0000 +Subject: [PATCH] Fix Solaris build + +--- + src/platform-solaris.cc | 49 ++++++++++++++++++++++++++++++++++++---------- + src/v8utils.h | 1 + + 2 files changed, 39 insertions(+), 11 deletions(-) + +diff --git a/src/platform-solaris.cc b/src/platform-solaris.cc +index f84e80d..b302c59 100644 +--- a/src/platform-solaris.cc ++++ b/src/platform-solaris.cc +@@ -45,6 +45,7 @@ + #include <errno.h> + #include <ieeefp.h> // finite() + #include <signal.h> // sigemptyset(), etc ++#include <sys/kdi_regs.h> + + + #undef MAP_TYPE +@@ -481,6 +482,16 @@ class SolarisMutex : public 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: + pthread_mutex_t mutex_; + }; +@@ -572,21 +583,37 @@ Semaphore* OS::CreateSemaphore(int count) { + #ifdef ENABLE_LOGGING_AND_PROFILING + + static Sampler* active_sampler_ = NULL; ++static pthread_t vm_tid_ = 0; ++ + + static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { + USE(info); + if (signal != SIGPROF) return; +- if (active_sampler_ == NULL) return; +- +- TickSample sample; +- sample.pc = 0; +- sample.sp = 0; +- sample.fp = 0; +- +- // We always sample the VM state. +- sample.state = VMState::current_state(); +- +- active_sampler_->Tick(&sample); ++ if (active_sampler_ == NULL || !active_sampler_->IsActive()) return; ++ if (vm_tid_ != pthread_self()) return; ++ ++ TickSample sample_obj; ++ TickSample* sample = CpuProfiler::TickSampleEvent(); ++ if (sample == NULL) sample = &sample_obj; ++ ++ // Extracting the sample from the context is extremely machine dependent. ++ ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); ++ mcontext_t& mcontext = ucontext->uc_mcontext; ++ 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); + } + + +diff --git a/src/v8utils.h b/src/v8utils.h +index f6ed520..59b3898 100644 +--- a/src/v8utils.h ++++ b/src/v8utils.h +@@ -29,6 +29,7 @@ + #define V8_V8UTILS_H_ + + #include "utils.h" ++#include <stdarg.h> + + namespace v8 { + namespace internal { +-- +1.6.3.3 + |