summaryrefslogtreecommitdiff
path: root/deps/v8/src/libsampler/sampler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/libsampler/sampler.cc')
-rw-r--r--deps/v8/src/libsampler/sampler.cc50
1 files changed, 29 insertions, 21 deletions
diff --git a/deps/v8/src/libsampler/sampler.cc b/deps/v8/src/libsampler/sampler.cc
index b6ae3de9f4..e445dfc65a 100644
--- a/deps/v8/src/libsampler/sampler.cc
+++ b/deps/v8/src/libsampler/sampler.cc
@@ -46,9 +46,9 @@ zx_status_t zx_thread_read_state(zx_handle_t h, uint32_t k, void* b, size_t l) {
&dummy_out_len);
}
#if defined(__x86_64__)
-typedef zx_x86_64_general_regs_t zx_thread_state_general_regs_t;
+using zx_thread_state_general_regs_t = zx_x86_64_general_regs_t;
#else
-typedef zx_arm64_general_regs_t zx_thread_state_general_regs_t;
+using zx_thread_state_general_regs_t = zx_arm64_general_regs_t;
#endif
#endif // !defined(ZX_THREAD_STATE_GENERAL_REGS)
@@ -71,31 +71,31 @@ typedef zx_arm64_general_regs_t zx_thread_state_general_regs_t;
#if defined(__arm__)
-typedef struct sigcontext mcontext_t;
+using mcontext_t = struct sigcontext;
-typedef struct ucontext {
+struct ucontext_t {
uint32_t uc_flags;
struct ucontext* uc_link;
stack_t uc_stack;
mcontext_t uc_mcontext;
// Other fields are not used by V8, don't define them here.
-} ucontext_t;
+};
#elif defined(__aarch64__)
-typedef struct sigcontext mcontext_t;
+using mcontext_t = struct sigcontext;
-typedef struct ucontext {
+struct ucontext_t {
uint64_t uc_flags;
struct ucontext *uc_link;
stack_t uc_stack;
mcontext_t uc_mcontext;
// Other fields are not used by V8, don't define them here.
-} ucontext_t;
+};
#elif defined(__mips__)
// MIPS version of sigcontext, for Android bionic.
-typedef struct {
+struct mcontext_t {
uint32_t regmask;
uint32_t status;
uint64_t pc;
@@ -114,50 +114,50 @@ typedef struct {
uint32_t lo2;
uint32_t hi3;
uint32_t lo3;
-} mcontext_t;
+};
-typedef struct ucontext {
+struct ucontext_t {
uint32_t uc_flags;
struct ucontext* uc_link;
stack_t uc_stack;
mcontext_t uc_mcontext;
// Other fields are not used by V8, don't define them here.
-} ucontext_t;
+};
#elif defined(__i386__)
// x86 version for Android.
-typedef struct {
+struct mcontext_t {
uint32_t gregs[19];
void* fpregs;
uint32_t oldmask;
uint32_t cr2;
-} mcontext_t;
+};
-typedef uint32_t kernel_sigset_t[2]; // x86 kernel uses 64-bit signal masks
-typedef struct ucontext {
+using kernel_sigset_t = uint32_t[2]; // x86 kernel uses 64-bit signal masks
+struct ucontext_t {
uint32_t uc_flags;
struct ucontext* uc_link;
stack_t uc_stack;
mcontext_t uc_mcontext;
// Other fields are not used by V8, don't define them here.
-} ucontext_t;
+};
enum { REG_EBP = 6, REG_ESP = 7, REG_EIP = 14 };
#elif defined(__x86_64__)
// x64 version for Android.
-typedef struct {
+struct mcontext_t {
uint64_t gregs[23];
void* fpregs;
uint64_t __reserved1[8];
-} mcontext_t;
+};
-typedef struct ucontext {
+struct ucontext_t {
uint64_t uc_flags;
struct ucontext *uc_link;
stack_t uc_stack;
mcontext_t uc_mcontext;
// Other fields are not used by V8, don't define them here.
-} ucontext_t;
+};
enum { REG_RBP = 10, REG_RSP = 15, REG_RIP = 16 };
#endif
@@ -391,16 +391,20 @@ void SignalHandler::FillRegisterState(void* context, RegisterState* state) {
state->pc = reinterpret_cast<void*>(mcontext.gregs[R15]);
state->sp = reinterpret_cast<void*>(mcontext.gregs[R13]);
state->fp = reinterpret_cast<void*>(mcontext.gregs[R11]);
+ state->lr = reinterpret_cast<void*>(mcontext.gregs[R14]);
#else
state->pc = reinterpret_cast<void*>(mcontext.arm_pc);
state->sp = reinterpret_cast<void*>(mcontext.arm_sp);
state->fp = reinterpret_cast<void*>(mcontext.arm_fp);
+ state->lr = reinterpret_cast<void*>(mcontext.arm_lr);
#endif // V8_LIBC_GLIBC && !V8_GLIBC_PREREQ(2, 4)
#elif V8_HOST_ARCH_ARM64
state->pc = reinterpret_cast<void*>(mcontext.pc);
state->sp = reinterpret_cast<void*>(mcontext.sp);
// FP is an alias for x29.
state->fp = reinterpret_cast<void*>(mcontext.regs[29]);
+ // LR is an alias for x30.
+ state->lr = reinterpret_cast<void*>(mcontext.regs[30]);
#elif V8_HOST_ARCH_MIPS
state->pc = reinterpret_cast<void*>(mcontext.pc);
state->sp = reinterpret_cast<void*>(mcontext.gregs[29]);
@@ -416,11 +420,13 @@ void SignalHandler::FillRegisterState(void* context, RegisterState* state) {
reinterpret_cast<void*>(ucontext->uc_mcontext.regs->gpr[PT_R1]);
state->fp =
reinterpret_cast<void*>(ucontext->uc_mcontext.regs->gpr[PT_R31]);
+ state->lr = reinterpret_cast<void*>(ucontext->uc_mcontext.regs->link);
#else
// Some C libraries, notably Musl, define the regs member as a void pointer
state->pc = reinterpret_cast<void*>(ucontext->uc_mcontext.gp_regs[32]);
state->sp = reinterpret_cast<void*>(ucontext->uc_mcontext.gp_regs[1]);
state->fp = reinterpret_cast<void*>(ucontext->uc_mcontext.gp_regs[31]);
+ state->lr = reinterpret_cast<void*>(ucontext->uc_mcontext.gp_regs[36]);
#endif
#elif V8_HOST_ARCH_S390
#if V8_TARGET_ARCH_32_BIT
@@ -433,6 +439,7 @@ void SignalHandler::FillRegisterState(void* context, RegisterState* state) {
#endif // V8_TARGET_ARCH_32_BIT
state->sp = reinterpret_cast<void*>(ucontext->uc_mcontext.gregs[15]);
state->fp = reinterpret_cast<void*>(ucontext->uc_mcontext.gregs[11]);
+ state->lr = reinterpret_cast<void*>(ucontext->uc_mcontext.gregs[14]);
#endif // V8_HOST_ARCH_*
#elif V8_OS_IOS
@@ -512,6 +519,7 @@ void SignalHandler::FillRegisterState(void* context, RegisterState* state) {
state->pc = reinterpret_cast<void*>(mcontext.jmp_context.iar);
state->sp = reinterpret_cast<void*>(mcontext.jmp_context.gpr[1]);
state->fp = reinterpret_cast<void*>(mcontext.jmp_context.gpr[31]);
+ state->lr = reinterpret_cast<void*>(mcontext.jmp_context.lr);
#endif // V8_OS_AIX
}