Index: src/profiler/sampler.cc |
diff --git a/src/profiler/sampler.cc b/src/profiler/sampler.cc |
index f7662e0edb2276b1747bb92f846f5dbc242cd140..a34042453c902d25a2ced72494a47fe4896e9263 100644 |
--- a/src/profiler/sampler.cc |
+++ b/src/profiler/sampler.cc |
@@ -336,6 +336,14 @@ class SimulatorHelper { |
reinterpret_cast<Address>(simulator_->get_register(Simulator::sp)); |
state->fp = |
reinterpret_cast<Address>(simulator_->get_register(Simulator::fp)); |
+#elif V8_TARGET_ARCH_S390 |
+ if (!simulator_->has_bad_pc()) { |
+ state->pc = reinterpret_cast<Address>(simulator_->get_pc()); |
+ } |
+ state->sp = |
+ reinterpret_cast<Address>(simulator_->get_register(Simulator::sp)); |
+ state->fp = |
+ reinterpret_cast<Address>(simulator_->get_register(Simulator::fp)); |
#endif |
} |
@@ -441,7 +449,7 @@ void SignalHandler::HandleProfilerSignal(int signal, siginfo_t* info, |
#else |
// Extracting the sample from the context is extremely machine dependent. |
ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); |
-#if !(V8_OS_OPENBSD || (V8_OS_LINUX && V8_HOST_ARCH_PPC)) |
+#if !(V8_OS_OPENBSD || (V8_OS_LINUX && (V8_HOST_ARCH_PPC || V8_HOST_ARCH_S390))) |
mcontext_t& mcontext = ucontext->uc_mcontext; |
#endif |
#if V8_OS_LINUX |
@@ -482,6 +490,17 @@ void SignalHandler::HandleProfilerSignal(int signal, siginfo_t* info, |
state.pc = reinterpret_cast<Address>(ucontext->uc_mcontext.regs->nip); |
state.sp = reinterpret_cast<Address>(ucontext->uc_mcontext.regs->gpr[PT_R1]); |
state.fp = reinterpret_cast<Address>(ucontext->uc_mcontext.regs->gpr[PT_R31]); |
+#elif V8_HOST_ARCH_S390 |
+#if V8_TARGET_ARCH_32_BIT |
+ // 31-bit target will have bit 0 (MSB) of the PSW set to denote addressing |
+ // mode. This bit needs to be masked out to resolve actual address. |
+ state.pc = |
+ reinterpret_cast<Address>(ucontext->uc_mcontext.psw.addr & 0x7FFFFFFF); |
+#else |
+ state.pc = reinterpret_cast<Address>(ucontext->uc_mcontext.psw.addr); |
+#endif // V8_TARGET_ARCH_32_BIT |
+ state.sp = reinterpret_cast<Address>(ucontext->uc_mcontext.gregs[15]); |
+ state.fp = reinterpret_cast<Address>(ucontext->uc_mcontext.gregs[11]); |
#endif // V8_HOST_ARCH_* |
#elif V8_OS_MACOSX |
#if V8_HOST_ARCH_X64 |