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 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jit/JITStubsX86Common.h

    r153162 r153197  
    5353
    5454#define PROBE_CPU_EAX_OFFSET (4 * PTR_SIZE)
    55 #define PROBE_CPU_ECX_OFFSET (5 * PTR_SIZE)
    56 #define PROBE_CPU_EDX_OFFSET (6 * PTR_SIZE)
    57 #define PROBE_CPU_EBX_OFFSET (7 * PTR_SIZE)
    58 #define PROBE_CPU_ESP_OFFSET (8 * PTR_SIZE)
    59 #define PROBE_CPU_EBP_OFFSET (9 * PTR_SIZE)
    60 #define PROBE_CPU_ESI_OFFSET (10 * PTR_SIZE)
    61 #define PROBE_CPU_EDI_OFFSET (11 * PTR_SIZE)
     55#define PROBE_CPU_EBX_OFFSET (5 * PTR_SIZE)
     56#define PROBE_CPU_ECX_OFFSET (6 * PTR_SIZE)
     57#define PROBE_CPU_EDX_OFFSET (7 * PTR_SIZE)
     58#define PROBE_CPU_ESI_OFFSET (8 * PTR_SIZE)
     59#define PROBE_CPU_EDI_OFFSET (9 * PTR_SIZE)
     60#define PROBE_CPU_EBP_OFFSET (10 * PTR_SIZE)
     61#define PROBE_CPU_ESP_OFFSET (11 * PTR_SIZE)
    6262
    6363#if CPU(X86)
    64 #define PROBE_CPU_EIP_OFFSET (12 * PTR_SIZE)
    65 #define PROBE_FIRST_XMM_OFFSET (16 * PTR_SIZE) // After padding.
     64#define PROBE_FIRST_SPECIAL_OFFSET (12 * PTR_SIZE)
    6665#else // CPU(X86_64)
    6766#define PROBE_CPU_R8_OFFSET (12 * PTR_SIZE)
     
    7372#define PROBE_CPU_R14_OFFSET (18 * PTR_SIZE)
    7473#define PROBE_CPU_R15_OFFSET (19 * PTR_SIZE)
    75 #define PROBE_CPU_EIP_OFFSET (20 * PTR_SIZE)
    76 #define PROBE_FIRST_XMM_OFFSET (22 * PTR_SIZE) // After padding.
     74#define PROBE_FIRST_SPECIAL_OFFSET (20 * PTR_SIZE)
     75#endif // CPU(X86_64)
     76
     77#define PROBE_CPU_EIP_OFFSET (PROBE_FIRST_SPECIAL_OFFSET + (0 * PTR_SIZE))
     78#define PROBE_CPU_EFLAGS_OFFSET (PROBE_FIRST_SPECIAL_OFFSET + (1 * PTR_SIZE))
     79
     80#if CPU(X86)
     81#define PROBE_FIRST_XMM_OFFSET (PROBE_FIRST_SPECIAL_OFFSET + (4 * PTR_SIZE)) // After padding.
     82#else // CPU(X86_64)
     83#define PROBE_FIRST_XMM_OFFSET (PROBE_FIRST_SPECIAL_OFFSET + (2 * PTR_SIZE)) // After padding.
    7784#endif // CPU(X86_64)
    7885
     
    8794#define PROBE_CPU_XMM7_OFFSET (PROBE_FIRST_XMM_OFFSET + (7 * XMM_SIZE))
    8895
     96#define PROBE_SIZE (PROBE_CPU_XMM7_OFFSET + XMM_SIZE)
    8997
    9098// These ASSERTs remind you that if you change the layout of ProbeContext,
     
    104112COMPILE_ASSERT(PROBE_OFFSETOF(cpu.esi) == PROBE_CPU_ESI_OFFSET, ProbeContext_cpu_esi_offset_matches_ctiMasmProbeTrampoline);
    105113COMPILE_ASSERT(PROBE_OFFSETOF(cpu.edi) == PROBE_CPU_EDI_OFFSET, ProbeContext_cpu_edi_offset_matches_ctiMasmProbeTrampoline);
     114COMPILE_ASSERT(PROBE_OFFSETOF(cpu.eip) == PROBE_CPU_EIP_OFFSET, ProbeContext_cpu_eip_offset_matches_ctiMasmProbeTrampoline);
     115COMPILE_ASSERT(PROBE_OFFSETOF(cpu.eflags) == PROBE_CPU_EFLAGS_OFFSET, ProbeContext_cpu_eflags_offset_matches_ctiMasmProbeTrampoline);
    106116
    107117#if CPU(X86_64)
     
    116126#endif // CPU(X86_64)
    117127
    118 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.eip) == PROBE_CPU_EIP_OFFSET, ProbeContext_cpu_eip_offset_matches_ctiMasmProbeTrampoline);
    119 
    120128COMPILE_ASSERT(PROBE_OFFSETOF(cpu.xmm0) == PROBE_CPU_XMM0_OFFSET, ProbeContext_cpu_xmm0_offset_matches_ctiMasmProbeTrampoline);
    121129COMPILE_ASSERT(PROBE_OFFSETOF(cpu.xmm1) == PROBE_CPU_XMM1_OFFSET, ProbeContext_cpu_xmm1_offset_matches_ctiMasmProbeTrampoline);
     
    126134COMPILE_ASSERT(PROBE_OFFSETOF(cpu.xmm6) == PROBE_CPU_XMM6_OFFSET, ProbeContext_cpu_xmm6_offset_matches_ctiMasmProbeTrampoline);
    127135COMPILE_ASSERT(PROBE_OFFSETOF(cpu.xmm7) == PROBE_CPU_XMM7_OFFSET, ProbeContext_cpu_xmm7_offset_matches_ctiMasmProbeTrampoline);
     136
     137COMPILE_ASSERT(sizeof(MacroAssembler::ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline);
    128138
    129139// Also double check that the xmm registers are 16 byte (128-bit) aligned as
Note: See TracChangeset for help on using the changeset viewer.