| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/libsampler/sampler.h" | 5 #include "src/libsampler/sampler.h" |
| 6 | 6 |
| 7 #if V8_OS_POSIX && !V8_OS_CYGWIN | 7 #if V8_OS_POSIX && !V8_OS_CYGWIN |
| 8 | 8 |
| 9 #define USE_SIGNALS | 9 #define USE_SIGNALS |
| 10 | 10 |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 FillRegisterState(context, &state); | 408 FillRegisterState(context, &state); |
| 409 SamplerManager::instance()->DoSample(state); | 409 SamplerManager::instance()->DoSample(state); |
| 410 } | 410 } |
| 411 | 411 |
| 412 void SignalHandler::FillRegisterState(void* context, RegisterState* state) { | 412 void SignalHandler::FillRegisterState(void* context, RegisterState* state) { |
| 413 // Extracting the sample from the context is extremely machine dependent. | 413 // Extracting the sample from the context is extremely machine dependent. |
| 414 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); | 414 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); |
| 415 #if !(V8_OS_OPENBSD || (V8_OS_LINUX && (V8_HOST_ARCH_PPC || V8_HOST_ARCH_S390))) | 415 #if !(V8_OS_OPENBSD || (V8_OS_LINUX && (V8_HOST_ARCH_PPC || V8_HOST_ARCH_S390))) |
| 416 mcontext_t& mcontext = ucontext->uc_mcontext; | 416 mcontext_t& mcontext = ucontext->uc_mcontext; |
| 417 #endif | 417 #endif |
| 418 #if V8_OS_LINUX | 418 #if V8_OS_LINUX || V8_OS_FUCHSIA |
| 419 #if V8_HOST_ARCH_IA32 | 419 #if V8_HOST_ARCH_IA32 |
| 420 state->pc = reinterpret_cast<void*>(mcontext.gregs[REG_EIP]); | 420 state->pc = reinterpret_cast<void*>(mcontext.gregs[REG_EIP]); |
| 421 state->sp = reinterpret_cast<void*>(mcontext.gregs[REG_ESP]); | 421 state->sp = reinterpret_cast<void*>(mcontext.gregs[REG_ESP]); |
| 422 state->fp = reinterpret_cast<void*>(mcontext.gregs[REG_EBP]); | 422 state->fp = reinterpret_cast<void*>(mcontext.gregs[REG_EBP]); |
| 423 #elif V8_HOST_ARCH_X64 | 423 #elif V8_HOST_ARCH_X64 |
| 424 state->pc = reinterpret_cast<void*>(mcontext.gregs[REG_RIP]); | 424 state->pc = reinterpret_cast<void*>(mcontext.gregs[REG_RIP]); |
| 425 state->sp = reinterpret_cast<void*>(mcontext.gregs[REG_RSP]); | 425 state->sp = reinterpret_cast<void*>(mcontext.gregs[REG_RSP]); |
| 426 state->fp = reinterpret_cast<void*>(mcontext.gregs[REG_RBP]); | 426 state->fp = reinterpret_cast<void*>(mcontext.gregs[REG_RBP]); |
| 427 #elif V8_HOST_ARCH_ARM | 427 #elif V8_HOST_ARCH_ARM |
| 428 #if V8_LIBC_GLIBC && !V8_GLIBC_PREREQ(2, 4) | 428 #if V8_LIBC_GLIBC && !V8_GLIBC_PREREQ(2, 4) |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 #endif | 654 #endif |
| 655 SampleStack(state); | 655 SampleStack(state); |
| 656 } | 656 } |
| 657 ResumeThread(profiled_thread); | 657 ResumeThread(profiled_thread); |
| 658 } | 658 } |
| 659 | 659 |
| 660 #endif // USE_SIGNALS | 660 #endif // USE_SIGNALS |
| 661 | 661 |
| 662 } // namespace sampler | 662 } // namespace sampler |
| 663 } // namespace v8 | 663 } // namespace v8 |
| OLD | NEW |