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 |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 #if V8_OS_LINUX | 367 #if V8_OS_LINUX |
368 #if V8_HOST_ARCH_IA32 | 368 #if V8_HOST_ARCH_IA32 |
369 state.pc = reinterpret_cast<Address>(mcontext.gregs[REG_EIP]); | 369 state.pc = reinterpret_cast<Address>(mcontext.gregs[REG_EIP]); |
370 state.sp = reinterpret_cast<Address>(mcontext.gregs[REG_ESP]); | 370 state.sp = reinterpret_cast<Address>(mcontext.gregs[REG_ESP]); |
371 state.fp = reinterpret_cast<Address>(mcontext.gregs[REG_EBP]); | 371 state.fp = reinterpret_cast<Address>(mcontext.gregs[REG_EBP]); |
372 #elif V8_HOST_ARCH_X64 | 372 #elif V8_HOST_ARCH_X64 |
373 state.pc = reinterpret_cast<Address>(mcontext.gregs[REG_RIP]); | 373 state.pc = reinterpret_cast<Address>(mcontext.gregs[REG_RIP]); |
374 state.sp = reinterpret_cast<Address>(mcontext.gregs[REG_RSP]); | 374 state.sp = reinterpret_cast<Address>(mcontext.gregs[REG_RSP]); |
375 state.fp = reinterpret_cast<Address>(mcontext.gregs[REG_RBP]); | 375 state.fp = reinterpret_cast<Address>(mcontext.gregs[REG_RBP]); |
376 #elif V8_HOST_ARCH_ARM | 376 #elif V8_HOST_ARCH_ARM |
377 #if defined(__GLIBC__) && !defined(__UCLIBC__) && \ | 377 #if V8_LIBC_GLIBC && !V8_GLIBC_PREREQ(2, 4) |
378 (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3)) | |
379 // Old GLibc ARM versions used a gregs[] array to access the register | 378 // Old GLibc ARM versions used a gregs[] array to access the register |
380 // values from mcontext_t. | 379 // values from mcontext_t. |
381 state.pc = reinterpret_cast<Address>(mcontext.gregs[R15]); | 380 state.pc = reinterpret_cast<Address>(mcontext.gregs[R15]); |
382 state.sp = reinterpret_cast<Address>(mcontext.gregs[R13]); | 381 state.sp = reinterpret_cast<Address>(mcontext.gregs[R13]); |
383 state.fp = reinterpret_cast<Address>(mcontext.gregs[R11]); | 382 state.fp = reinterpret_cast<Address>(mcontext.gregs[R11]); |
384 #else | 383 #else |
385 state.pc = reinterpret_cast<Address>(mcontext.arm_pc); | 384 state.pc = reinterpret_cast<Address>(mcontext.arm_pc); |
386 state.sp = reinterpret_cast<Address>(mcontext.arm_sp); | 385 state.sp = reinterpret_cast<Address>(mcontext.arm_sp); |
387 state.fp = reinterpret_cast<Address>(mcontext.arm_fp); | 386 state.fp = reinterpret_cast<Address>(mcontext.arm_fp); |
388 #endif // defined(__GLIBC__) && !defined(__UCLIBC__) && | 387 #endif // V8_LIBC_GLIBC && !V8_GLIBC_PREREQ(2, 4) |
389 // (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3)) | |
390 #elif V8_HOST_ARCH_ARM64 | 388 #elif V8_HOST_ARCH_ARM64 |
391 state.pc = reinterpret_cast<Address>(mcontext.pc); | 389 state.pc = reinterpret_cast<Address>(mcontext.pc); |
392 state.sp = reinterpret_cast<Address>(mcontext.sp); | 390 state.sp = reinterpret_cast<Address>(mcontext.sp); |
393 // FP is an alias for x29. | 391 // FP is an alias for x29. |
394 state.fp = reinterpret_cast<Address>(mcontext.regs[29]); | 392 state.fp = reinterpret_cast<Address>(mcontext.regs[29]); |
395 #elif V8_HOST_ARCH_MIPS | 393 #elif V8_HOST_ARCH_MIPS |
396 state.pc = reinterpret_cast<Address>(mcontext.pc); | 394 state.pc = reinterpret_cast<Address>(mcontext.pc); |
397 state.sp = reinterpret_cast<Address>(mcontext.gregs[29]); | 395 state.sp = reinterpret_cast<Address>(mcontext.gregs[29]); |
398 state.fp = reinterpret_cast<Address>(mcontext.gregs[30]); | 396 state.fp = reinterpret_cast<Address>(mcontext.gregs[30]); |
399 #elif V8_HOST_ARCH_MIPS64 | 397 #elif V8_HOST_ARCH_MIPS64 |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 #endif // USE_SIMULATOR | 755 #endif // USE_SIMULATOR |
758 SampleStack(state); | 756 SampleStack(state); |
759 } | 757 } |
760 ResumeThread(profiled_thread); | 758 ResumeThread(profiled_thread); |
761 } | 759 } |
762 | 760 |
763 #endif // USE_SIGNALS | 761 #endif // USE_SIGNALS |
764 | 762 |
765 | 763 |
766 } } // namespace v8::internal | 764 } } // namespace v8::internal |
OLD | NEW |