| Index: src/platform-openbsd.cc
|
| diff --git a/src/platform-openbsd.cc b/src/platform-openbsd.cc
|
| index a53e30756d0ea4aae649c30972b18092381d3d63..98669309ea96a3b5fa38fff0ca4ba5e497bdcc87 100644
|
| --- a/src/platform-openbsd.cc
|
| +++ b/src/platform-openbsd.cc
|
| @@ -53,6 +53,7 @@
|
|
|
| #include "platform-posix.h"
|
| #include "platform.h"
|
| +#include "simulator.h"
|
| #include "v8threads.h"
|
| #include "vm-state-inl.h"
|
|
|
| @@ -748,6 +749,17 @@ static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) {
|
| Sampler* sampler = isolate->logger()->sampler();
|
| if (sampler == NULL || !sampler->IsActive()) return;
|
|
|
| +#if defined(USE_SIMULATOR)
|
| +#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS
|
| + Isolate::PerIsolateThreadData* per_thread_data =
|
| + isolate->FindPerThreadDataForThisThread();
|
| + if (!per_thread_data) return;
|
| + Simulator* sim = per_thread_data->simulator();
|
| + // Check if there is active simulator before allocating TickSample.
|
| + if (!sim) return;
|
| +#endif
|
| +#endif // USE_SIMULATOR
|
| +
|
| TickSample sample_obj;
|
| TickSample* sample = isolate->cpu_profiler()->TickSampleEvent();
|
| if (sample == NULL) sample = &sample_obj;
|
| @@ -755,6 +767,17 @@ static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) {
|
| // Extracting the sample from the context is extremely machine dependent.
|
| sample->state = isolate->current_vm_state();
|
| ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
|
| +#if defined(USE_SIMULATOR)
|
| +#if V8_TARGET_ARCH_ARM
|
| + sample->pc = reinterpret_cast<Address>(sim->get_register(Simulator::pc));
|
| + sample->sp = reinterpret_cast<Address>(sim->get_register(Simulator::sp));
|
| + sample->fp = reinterpret_cast<Address>(sim->get_register(Simulator::r11));
|
| +#elif V8_TARGET_ARCH_MIPS
|
| + sample->pc = reinterpret_cast<Address>(sim->get_register(Simulator::pc));
|
| + sample->sp = reinterpret_cast<Address>(sim->get_register(Simulator::sp));
|
| + sample->fp = reinterpret_cast<Address>(sim->get_register(Simulator::fp));
|
| +#endif
|
| +#else
|
| #ifdef __NetBSD__
|
| mcontext_t& mcontext = ucontext->uc_mcontext;
|
| #if V8_HOST_ARCH_IA32
|
| @@ -777,6 +800,7 @@ static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) {
|
| sample->fp = reinterpret_cast<Address>(ucontext->sc_rbp);
|
| #endif // V8_HOST_ARCH
|
| #endif // __NetBSD__
|
| +#endif // USE_SIMULATOR
|
| sampler->SampleStack(sample);
|
| sampler->Tick(sample);
|
| }
|
|
|