Ignore:
Timestamp:
Jul 24, 2013, 9:01:38 PM (12 years ago)
Author:
[email protected]
Message:

fourthTier: Misc JIT probe enhacements.
https://bugs.webkit.org/show_bug.cgi?id=116586.

Reviewed by Michael Saboff.

  1. Added JIT probe support for ARMv7 and traditional ARM. Built and tested on ARMv7. ARM version not tested nor built.
  2. Fix the following bugs in the X86 and X86_64 probes:
    1. Cannot assume that the stack pointer is already aligned when we push args for the probe. Instead, we ensure the stack alignment at runtime when we set up the probe call. This is now done in the ctiMasmProbeTrampoline.
    2. On return, the user probe function may have altered the stack pointer value to be restored. Previously, if the sp restore value points to some of the other register restore values in the ProbeContext record, we will fail to return from the probe having those user specified value as we're expected to do. This is now fixed.
  3. Rearranged the X86/X86_64 registers order to organize them like gdb expects on X86_64.
  4. We also now preserve the condition code registers.
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • assembler/ARMAssembler.h:
  • assembler/ARMv7Assembler.h:

(ARMRegisters):

  • assembler/MacroAssemblerARM.cpp:

(JSC::isVFPPresent):
(JSC::MacroAssemblerARM::ProbeContext::dumpCPURegisters):
(JSC::MacroAssemblerARM::ProbeContext::dump):
(JSC::MacroAssemblerARM::probe):

  • assembler/MacroAssemblerARM.h:

(MacroAssemblerARM):
(CPUState):
(ProbeContext):
(JSC::MacroAssemblerARM::trustedImm32FromPtr):

  • assembler/MacroAssemblerARMv7.h:

(MacroAssemblerARMv7):
(CPUState):
(ProbeContext):
(JSC::MacroAssemblerARMv7::trustedImm32FromPtr):

  • assembler/MacroAssemblerX86.h:

(MacroAssemblerX86):
(JSC::MacroAssemblerX86::probe):

  • assembler/MacroAssemblerX86Common.cpp:

(JSC::MacroAssemblerX86Common::ProbeContext::dumpCPURegisters):

  • assembler/MacroAssemblerX86_64.h:

(JSC::MacroAssemblerX86_64::probe):

  • assembler/X86Assembler.h:
  • config.h:
  • jit/JITStubsARM.h:
  • jit/JITStubsARMv7.h:
  • jit/JITStubsX86.h:
  • jit/JITStubsX86Common.h:
  • jit/JITStubsX86_64.h:
File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.cpp

    r153196 r153197  
    2525
    2626#include "config.h"
    27 #include "MacroAssemblerX86Common.h"
     27
     28#if ENABLE(ASSEMBLER) && CPU(ARM_THUMB2)
     29#include "MacroAssemblerARMv7.h"
     30
     31#if USE(MASM_PROBE)
     32#include <wtf/StdLibExtras.h>
     33#endif
    2834
    2935namespace JSC {
     
    3137#if USE(MASM_PROBE)
    3238
    33 void MacroAssemblerX86Common::ProbeContext::dumpCPURegisters(const char* indentation)
     39void MacroAssemblerARMv7::ProbeContext::dumpCPURegisters(const char* indentation)
    3440{
    35 #if CPU(X86)
    3641    #define DUMP_GPREGISTER(_type, _regName) { \
    3742        int32_t value = reinterpret_cast<int32_t>(cpu._regName); \
    38         dataLogF("%s    %4s: 0x%08x   %d\n", indentation, #_regName, value, value) ; \
     43        dataLogF("%s    %5s: 0x%08x   %d\n", indentation, #_regName, value, value) ; \
    3944    }
    40 #elif CPU(X86_64)
    41     #define DUMP_GPREGISTER(_type, _regName) { \
    42         int64_t value = reinterpret_cast<int64_t>(cpu._regName); \
    43         dataLogF("%s    %4s: 0x%016llx   %lld\n", indentation, #_regName, value, value) ; \
    44     }
    45 #endif
    4645    FOR_EACH_CPU_GPREGISTER(DUMP_GPREGISTER)
     46    FOR_EACH_CPU_SPECIAL_REGISTER(DUMP_GPREGISTER)
    4747    #undef DUMP_GPREGISTER
    4848
     
    5050        uint32_t* u = reinterpret_cast<uint32_t*>(&cpu._regName); \
    5151        double* d = reinterpret_cast<double*>(&cpu._regName); \
    52         dataLogF("%s    %s: 0x%08x%08x 0x%08x%08x   %12g %12g\n", \
    53             indentation, #_regName, u[3], u[2], u[1], u[0], d[1], d[0]); \
     52        dataLogF("%s    %5s: 0x %08x %08x  %12g\n", \
     53            indentation, #_regName, u[1], u[0], d[0]); \
    5454    }
    5555    FOR_EACH_CPU_FPREGISTER(DUMP_FPREGISTER)
     
    5757}
    5858
    59 void MacroAssemblerX86Common::ProbeContext::dump(const char* indentation)
     59void MacroAssemblerARMv7::ProbeContext::dump(const char* indentation)
    6060{
    6161    if (!indentation)
     
    7575}
    7676
     77
     78extern "C" void ctiMasmProbeTrampoline();
     79
     80// For details on "What code is emitted for the probe?" and "What values are in
     81// the saved registers?", see comment for MacroAssemblerX86::probe() in
     82// MacroAssemblerX86_64.h.
     83
     84void MacroAssemblerARMv7::probe(MacroAssemblerARMv7::ProbeFunction function, void* arg1, void* arg2)
     85{
     86    push(RegisterID::sp);
     87    push(RegisterID::lr);
     88    push(RegisterID::ip);
     89    push(RegisterID::r0);
     90    // The following uses RegisterID::ip. So, they must come after we push ip above.
     91    push(trustedImm32FromPtr(arg2));
     92    push(trustedImm32FromPtr(arg1));
     93    push(trustedImm32FromPtr(function));
     94
     95    move(trustedImm32FromPtr(ctiMasmProbeTrampoline), RegisterID::ip);
     96    m_assembler.blx(RegisterID::ip);
     97}
    7798#endif // USE(MASM_PROBE)
    7899
    79100} // namespace JSC
     101
     102#endif // ENABLE(ASSEMBLER)
     103
Note: See TracChangeset for help on using the changeset viewer.