summaryrefslogtreecommitdiff
path: root/deps/v8/src/sampler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/sampler.cc')
-rw-r--r--deps/v8/src/sampler.cc23
1 files changed, 13 insertions, 10 deletions
diff --git a/deps/v8/src/sampler.cc b/deps/v8/src/sampler.cc
index 413b6be906..394efeb764 100644
--- a/deps/v8/src/sampler.cc
+++ b/deps/v8/src/sampler.cc
@@ -13,7 +13,7 @@
#include <signal.h>
#include <sys/time.h>
-#if !V8_OS_QNX
+#if !V8_OS_QNX && !V8_OS_NACL
#include <sys/syscall.h> // NOLINT
#endif
@@ -21,8 +21,8 @@
#include <mach/mach.h>
// OpenBSD doesn't have <ucontext.h>. ucontext_t lives in <signal.h>
// and is a typedef for struct sigcontext. There is no uc_mcontext.
-#elif(!V8_OS_ANDROID || defined(__BIONIC_HAVE_UCONTEXT_T)) \
- && !V8_OS_OPENBSD
+#elif(!V8_OS_ANDROID || defined(__BIONIC_HAVE_UCONTEXT_T)) && \
+ !V8_OS_OPENBSD && !V8_OS_NACL
#include <ucontext.h>
#endif
@@ -276,7 +276,7 @@ class SimulatorHelper {
class SignalHandler : public AllStatic {
public:
static void SetUp() { if (!mutex_) mutex_ = new base::Mutex(); }
- static void TearDown() { delete mutex_; }
+ static void TearDown() { delete mutex_; mutex_ = NULL; }
static void IncreaseSamplerCount() {
base::LockGuard<base::Mutex> lock_guard(mutex_);
@@ -294,6 +294,7 @@ class SignalHandler : public AllStatic {
private:
static void Install() {
+#if !V8_OS_NACL
struct sigaction sa;
sa.sa_sigaction = &HandleProfilerSignal;
sigemptyset(&sa.sa_mask);
@@ -304,16 +305,21 @@ class SignalHandler : public AllStatic {
#endif
signal_handler_installed_ =
(sigaction(SIGPROF, &sa, &old_signal_handler_) == 0);
+#endif
}
static void Restore() {
+#if !V8_OS_NACL
if (signal_handler_installed_) {
sigaction(SIGPROF, &old_signal_handler_, 0);
signal_handler_installed_ = false;
}
+#endif
}
+#if !V8_OS_NACL
static void HandleProfilerSignal(int signal, siginfo_t* info, void* context);
+#endif
// Protects the process wide state below.
static base::Mutex* mutex_;
static int client_count_;
@@ -328,13 +334,10 @@ struct sigaction SignalHandler::old_signal_handler_;
bool SignalHandler::signal_handler_installed_ = false;
+// As Native Client does not support signal handling, profiling is disabled.
+#if !V8_OS_NACL
void SignalHandler::HandleProfilerSignal(int signal, siginfo_t* info,
void* context) {
-#if V8_OS_NACL
- // As Native Client does not support signal handling, profiling
- // is disabled.
- return;
-#else
USE(info);
if (signal != SIGPROF) return;
Isolate* isolate = Isolate::UnsafeCurrent();
@@ -477,8 +480,8 @@ void SignalHandler::HandleProfilerSignal(int signal, siginfo_t* info,
#endif // V8_OS_QNX
#endif // USE_SIMULATOR
sampler->SampleStack(state);
-#endif // V8_OS_NACL
}
+#endif // V8_OS_NACL
#endif