Index: src/sampler.cc |
diff --git a/src/sampler.cc b/src/sampler.cc |
index 29fe27fd35866ffe62e26105fadbe728bfdc7666..394efeb7640764870b6f768a9d11a1b879955416 100644 |
--- a/src/sampler.cc |
+++ b/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 |
@@ -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 |