Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(895)

Unified Diff: src/sampler.cc

Issue 61153009: Add support for the QNX operating system. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Address latest review comments Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/qnx-math.h ('k') | test/cctest/cctest.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/sampler.cc
diff --git a/src/sampler.cc b/src/sampler.cc
index 684ef486c7d24365fae14c8c85a0ab78778c9f65..cb98b6fdcf00c5bd0714e4692c1bac686b286403 100644
--- a/src/sampler.cc
+++ b/src/sampler.cc
@@ -35,7 +35,10 @@
#include <pthread.h>
#include <signal.h>
#include <sys/time.h>
+
+#if !V8_OS_QNX
#include <sys/syscall.h>
+#endif
#if V8_OS_MACOSX
#include <mach/mach.h>
@@ -45,6 +48,7 @@
&& !V8_OS_OPENBSD
#include <ucontext.h>
#endif
+
#include <unistd.h>
// GLibc on ARM defines mcontext_t has a typedef for 'struct sigcontext'.
@@ -266,7 +270,11 @@ class SignalHandler : public AllStatic {
struct sigaction sa;
sa.sa_sigaction = &HandleProfilerSignal;
sigemptyset(&sa.sa_mask);
+#if V8_OS_QNX
+ sa.sa_flags = SA_SIGINFO;
+#else
sa.sa_flags = SA_RESTART | SA_SIGINFO;
+#endif
signal_handler_installed_ =
(sigaction(SIGPROF, &sa, &old_signal_handler_) == 0);
}
@@ -415,7 +423,17 @@ void SignalHandler::HandleProfilerSignal(int signal, siginfo_t* info,
state.pc = reinterpret_cast<Address>(mcontext.gregs[REG_PC]);
state.sp = reinterpret_cast<Address>(mcontext.gregs[REG_SP]);
state.fp = reinterpret_cast<Address>(mcontext.gregs[REG_FP]);
-#endif // V8_OS_SOLARIS
+#elif V8_OS_QNX
+#if V8_HOST_ARCH_IA32
+ state.pc = reinterpret_cast<Address>(mcontext.cpu.eip);
+ state.sp = reinterpret_cast<Address>(mcontext.cpu.esp);
+ state.fp = reinterpret_cast<Address>(mcontext.cpu.ebp);
+#elif V8_HOST_ARCH_ARM
+ state.pc = reinterpret_cast<Address>(mcontext.cpu.gpr[ARM_REG_PC]);
+ state.sp = reinterpret_cast<Address>(mcontext.cpu.gpr[ARM_REG_SP]);
+ state.fp = reinterpret_cast<Address>(mcontext.cpu.gpr[ARM_REG_FP]);
+#endif // V8_HOST_ARCH_*
+#endif // V8_OS_QNX
#endif // USE_SIMULATOR
sampler->SampleStack(state);
#endif // V8_OS_NACL
« no previous file with comments | « src/qnx-math.h ('k') | test/cctest/cctest.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698