Add some convenience utility accessor methods to MacroAssembler::CPUState.
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Aug 2017 22:55:31 +0000 (22:55 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Aug 2017 22:55:31 +0000 (22:55 +0000)
commitf967789d67a5b73124020f1abd27ca232a2d7e60
treebdac1ea1e16998af33f4c043620329bd75562807
parentc994e6d90ddbeba2cd5a0b9e0efd655986306af1
Add some convenience utility accessor methods to MacroAssembler::CPUState.
https://bugs.webkit.org/show_bug.cgi?id=175549
<rdar://problem/33884868>

Reviewed by Saam Barati.

Previously, in order to read ProbeContext CPUState registers, we used to need to
do it this way:

    ExecState* exec = reinterpret_cast<ExecState*>(cpu.fp());
    uint32_t i32 = static_cast<uint32_t>(cpu.gpr(GPRInfo::regT0));
    void* p = reinterpret_cast<void*>(cpu.gpr(GPRInfo::regT1));
    uint64_t u64 = bitwise_cast<uint64_t>(cpu.fpr(FPRInfo::fpRegT0));

With this patch, we can now read them this way instead:

    ExecState* exec = cpu.fp<ExecState*>();
    uint32_t i32 = cpu.gpr<uint32_t>(GPRInfo::regT0);
    void* p = cpu.gpr<void*>(GPRInfo::regT1);
    uint64_t u64 = cpu.fpr<uint64_t>(FPRInfo::fpRegT0);

* assembler/MacroAssembler.h:
(JSC:: const):
(JSC::MacroAssembler::CPUState::fpr const):
(JSC::MacroAssembler::CPUState::pc const):
(JSC::MacroAssembler::CPUState::fp const):
(JSC::MacroAssembler::CPUState::sp const):
(JSC::ProbeContext::pc):
(JSC::ProbeContext::fp):
(JSC::ProbeContext::sp):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220720 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/assembler/MacroAssembler.h