Index: src/sampler.cc |
diff --git a/src/sampler.cc b/src/sampler.cc |
index 413b6be9060daa43c41bb6e41414ef419d1a299b..9a1eba0e9a318d8ee4c2c4a419f816089a365c74 100644 |
--- a/src/sampler.cc |
+++ b/src/sampler.cc |
@@ -262,6 +262,12 @@ class SimulatorHelper { |
Simulator::sp)); |
state->fp = reinterpret_cast<Address>(simulator_->get_register( |
Simulator::fp)); |
+#elif V8_TARGET_ARCH_PPC |
+ 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 |
} |
@@ -364,7 +370,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 |
+#if !(V8_OS_OPENBSD || (V8_OS_LINUX && V8_HOST_ARCH_PPC)) |
mcontext_t& mcontext = ucontext->uc_mcontext; |
#endif |
#if V8_OS_LINUX |
@@ -403,6 +409,10 @@ void SignalHandler::HandleProfilerSignal(int signal, siginfo_t* info, |
state.pc = reinterpret_cast<Address>(mcontext.pc); |
state.sp = reinterpret_cast<Address>(mcontext.gregs[29]); |
state.fp = reinterpret_cast<Address>(mcontext.gregs[30]); |
+#elif V8_HOST_ARCH_PPC |
+ 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]); |
#endif // V8_HOST_ARCH_* |
#elif V8_OS_MACOSX |
#if V8_HOST_ARCH_X64 |