| Index: src/platform-linux.cc
|
| diff --git a/src/platform-linux.cc b/src/platform-linux.cc
|
| index 03f73dd1b5e1c4d22f1b3440dc700bc11413e173..78b6eb689e4a1ba7bc40102d227f225c8485dc0f 100644
|
| --- a/src/platform-linux.cc
|
| +++ b/src/platform-linux.cc
|
| @@ -728,52 +728,47 @@ static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) {
|
| if (active_sampler_ == NULL) return;
|
|
|
| #ifdef ENABLE_CPP_PROFILES_PROCESSOR
|
| - if (Logger::state() == GC || !IsVmThread()) return;
|
| -
|
| - TickSample* sample = NULL;
|
| + TickSample* sample = CpuProfiler::TickSampleEvent();
|
| + if (sample == NULL) return;
|
| + sample->pc = NULL; // Impossible value if sampling succeeds.
|
| + sample->frames_count = 0;
|
| #else
|
| TickSample sample_obj;
|
| TickSample* sample = &sample_obj;
|
| +#endif
|
|
|
| // We always sample the VM state.
|
| sample->state = Logger::state();
|
| -#endif
|
| -
|
| // If profiling, we extract the current pc and sp.
|
| if (active_sampler_->IsProfiling()) {
|
| // Extracting the sample from the context is extremely machine dependent.
|
| ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
|
| mcontext_t& mcontext = ucontext->uc_mcontext;
|
| -#ifdef ENABLE_CPP_PROFILES_PROCESSOR
|
| - sample = CpuProfiler::TickSampleEvent();
|
| -#endif
|
| - if (sample != NULL) {
|
| #if V8_HOST_ARCH_IA32
|
| - sample->pc = reinterpret_cast<Address>(mcontext.gregs[REG_EIP]);
|
| - sample->sp = reinterpret_cast<Address>(mcontext.gregs[REG_ESP]);
|
| - sample->fp = reinterpret_cast<Address>(mcontext.gregs[REG_EBP]);
|
| + sample->pc = reinterpret_cast<Address>(mcontext.gregs[REG_EIP]);
|
| + sample->sp = reinterpret_cast<Address>(mcontext.gregs[REG_ESP]);
|
| + sample->fp = reinterpret_cast<Address>(mcontext.gregs[REG_EBP]);
|
| #elif V8_HOST_ARCH_X64
|
| - sample->pc = reinterpret_cast<Address>(mcontext.gregs[REG_RIP]);
|
| - sample->sp = reinterpret_cast<Address>(mcontext.gregs[REG_RSP]);
|
| - sample->fp = reinterpret_cast<Address>(mcontext.gregs[REG_RBP]);
|
| + sample->pc = reinterpret_cast<Address>(mcontext.gregs[REG_RIP]);
|
| + sample->sp = reinterpret_cast<Address>(mcontext.gregs[REG_RSP]);
|
| + sample->fp = reinterpret_cast<Address>(mcontext.gregs[REG_RBP]);
|
| #elif V8_HOST_ARCH_ARM
|
| // An undefined macro evaluates to 0, so this applies to Android's Bionic also.
|
| #if (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3))
|
| - sample->pc = reinterpret_cast<Address>(mcontext.gregs[R15]);
|
| - sample->sp = reinterpret_cast<Address>(mcontext.gregs[R13]);
|
| - sample->fp = reinterpret_cast<Address>(mcontext.gregs[R11]);
|
| + sample->pc = reinterpret_cast<Address>(mcontext.gregs[R15]);
|
| + sample->sp = reinterpret_cast<Address>(mcontext.gregs[R13]);
|
| + sample->fp = reinterpret_cast<Address>(mcontext.gregs[R11]);
|
| #else
|
| - sample->pc = reinterpret_cast<Address>(mcontext.arm_pc);
|
| - sample->sp = reinterpret_cast<Address>(mcontext.arm_sp);
|
| - sample->fp = reinterpret_cast<Address>(mcontext.arm_fp);
|
| + sample->pc = reinterpret_cast<Address>(mcontext.arm_pc);
|
| + sample->sp = reinterpret_cast<Address>(mcontext.arm_sp);
|
| + sample->fp = reinterpret_cast<Address>(mcontext.arm_fp);
|
| #endif
|
| #elif V8_HOST_ARCH_MIPS
|
| // Implement this on MIPS.
|
| - UNIMPLEMENTED();
|
| + UNIMPLEMENTED();
|
| #endif
|
| - if (IsVmThread()) {
|
| - active_sampler_->SampleStack(sample);
|
| - }
|
| + if (IsVmThread()) {
|
| + active_sampler_->SampleStack(sample);
|
| }
|
| }
|
| #ifndef ENABLE_CPP_PROFILES_PROCESSOR
|
|
|