OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/sampler.h" | 5 #include "src/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 |
11 #include <errno.h> | 11 #include <errno.h> |
12 #include <pthread.h> | 12 #include <pthread.h> |
13 #include <signal.h> | 13 #include <signal.h> |
14 #include <sys/time.h> | 14 #include <sys/time.h> |
15 | 15 |
16 #if !V8_OS_QNX && !V8_OS_NACL | 16 #if !V8_OS_QNX && !V8_OS_NACL && !V8_OS_AIX |
17 #include <sys/syscall.h> // NOLINT | 17 #include <sys/syscall.h> // NOLINT |
18 #endif | 18 #endif |
19 | 19 |
20 #if V8_OS_MACOSX | 20 #if V8_OS_MACOSX |
21 #include <mach/mach.h> | 21 #include <mach/mach.h> |
22 // OpenBSD doesn't have <ucontext.h>. ucontext_t lives in <signal.h> | 22 // OpenBSD doesn't have <ucontext.h>. ucontext_t lives in <signal.h> |
23 // and is a typedef for struct sigcontext. There is no uc_mcontext. | 23 // and is a typedef for struct sigcontext. There is no uc_mcontext. |
24 #elif(!V8_OS_ANDROID || defined(__BIONIC_HAVE_UCONTEXT_T)) && \ | 24 #elif(!V8_OS_ANDROID || defined(__BIONIC_HAVE_UCONTEXT_T)) && \ |
25 !V8_OS_OPENBSD && !V8_OS_NACL | 25 !V8_OS_OPENBSD && !V8_OS_NACL |
26 #include <ucontext.h> | 26 #include <ucontext.h> |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 #elif V8_OS_QNX | 472 #elif V8_OS_QNX |
473 #if V8_HOST_ARCH_IA32 | 473 #if V8_HOST_ARCH_IA32 |
474 state.pc = reinterpret_cast<Address>(mcontext.cpu.eip); | 474 state.pc = reinterpret_cast<Address>(mcontext.cpu.eip); |
475 state.sp = reinterpret_cast<Address>(mcontext.cpu.esp); | 475 state.sp = reinterpret_cast<Address>(mcontext.cpu.esp); |
476 state.fp = reinterpret_cast<Address>(mcontext.cpu.ebp); | 476 state.fp = reinterpret_cast<Address>(mcontext.cpu.ebp); |
477 #elif V8_HOST_ARCH_ARM | 477 #elif V8_HOST_ARCH_ARM |
478 state.pc = reinterpret_cast<Address>(mcontext.cpu.gpr[ARM_REG_PC]); | 478 state.pc = reinterpret_cast<Address>(mcontext.cpu.gpr[ARM_REG_PC]); |
479 state.sp = reinterpret_cast<Address>(mcontext.cpu.gpr[ARM_REG_SP]); | 479 state.sp = reinterpret_cast<Address>(mcontext.cpu.gpr[ARM_REG_SP]); |
480 state.fp = reinterpret_cast<Address>(mcontext.cpu.gpr[ARM_REG_FP]); | 480 state.fp = reinterpret_cast<Address>(mcontext.cpu.gpr[ARM_REG_FP]); |
481 #endif // V8_HOST_ARCH_* | 481 #endif // V8_HOST_ARCH_* |
482 #endif // V8_OS_QNX | 482 #elif V8_OS_AIX |
| 483 state.pc = reinterpret_cast<Address>(mcontext.jmp_context.iar); |
| 484 state.sp = reinterpret_cast<Address>(mcontext.jmp_context.gpr[1]); |
| 485 state.fp = reinterpret_cast<Address>(mcontext.jmp_context.gpr[31]); |
| 486 #endif // V8_OS_AIX |
483 #endif // USE_SIMULATOR | 487 #endif // USE_SIMULATOR |
484 sampler->SampleStack(state); | 488 sampler->SampleStack(state); |
485 } | 489 } |
486 #endif // V8_OS_NACL | 490 #endif // V8_OS_NACL |
487 | 491 |
488 #endif | 492 #endif |
489 | 493 |
490 | 494 |
491 class SamplerThread : public base::Thread { | 495 class SamplerThread : public base::Thread { |
492 public: | 496 public: |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 #endif // USE_SIMULATOR | 769 #endif // USE_SIMULATOR |
766 SampleStack(state); | 770 SampleStack(state); |
767 } | 771 } |
768 ResumeThread(profiled_thread); | 772 ResumeThread(profiled_thread); |
769 } | 773 } |
770 | 774 |
771 #endif // USE_SIGNALS | 775 #endif // USE_SIGNALS |
772 | 776 |
773 | 777 |
774 } } // namespace v8::internal | 778 } } // namespace v8::internal |
OLD | NEW |