|
@ -500,6 +500,16 @@ class FreeBSDMutex : public Mutex { |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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 for POSIX platforms.
|
|
|
pthread_mutex_t mutex_; // Pthread mutex for POSIX platforms.
|
|
|
}; |
|
|
}; |
|
@ -577,14 +587,12 @@ static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { |
|
|
|
|
|
|
|
|
TickSample sample; |
|
|
TickSample sample; |
|
|
|
|
|
|
|
|
// We always sample the VM state.
|
|
|
|
|
|
sample.state = VMState::current_state(); |
|
|
|
|
|
|
|
|
|
|
|
// If profiling, we extract the current pc and sp.
|
|
|
// If profiling, we extract the current pc and sp.
|
|
|
if (active_sampler_->IsProfiling()) { |
|
|
if (active_sampler_->IsProfiling()) { |
|
|
// Extracting the sample from the context is extremely machine dependent.
|
|
|
// Extracting the sample from the context is extremely machine dependent.
|
|
|
ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); |
|
|
ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); |
|
|
mcontext_t& mcontext = ucontext->uc_mcontext; |
|
|
mcontext_t& mcontext = ucontext->uc_mcontext; |
|
|
|
|
|
sample.state = Top::current_vm_state(); |
|
|
#if V8_HOST_ARCH_IA32 |
|
|
#if V8_HOST_ARCH_IA32 |
|
|
sample.pc = reinterpret_cast<Address>(mcontext.mc_eip); |
|
|
sample.pc = reinterpret_cast<Address>(mcontext.mc_eip); |
|
|
sample.sp = reinterpret_cast<Address>(mcontext.mc_esp); |
|
|
sample.sp = reinterpret_cast<Address>(mcontext.mc_esp); |
|
|