Ignore:
Timestamp:
Apr 20, 2017, 4:55:45 PM (8 years ago)
Author:
[email protected]
Message:

Update the MASM probe to only take 1 arg instead of 2 (in addition to the callback function).
https://bugs.webkit.org/show_bug.cgi?id=171088

Reviewed by Michael Saboff and Saam Barati.

Experience shows that we never use the 2nd arg. So, let's remove it to reduce
the footprint at each probe site.

Also fix the MacroAssembler::print() function so that it is a no-op when
!ENABLE(MASM_PROBE). This will allow us to have print() statements in JIT code
without a lot of #if ENABLE(MASM_PROBE)s later.

  • assembler/AbstractMacroAssembler.h:
  • assembler/MacroAssembler.cpp:

(JSC::stdFunctionCallback):
(JSC::MacroAssembler::probe):

  • assembler/MacroAssembler.h:
  • assembler/MacroAssemblerARM.cpp:

(JSC::MacroAssemblerARM::probe):

  • assembler/MacroAssemblerARM.h:
  • assembler/MacroAssemblerARM64.cpp:

(JSC::MacroAssemblerARM64::probe):

  • assembler/MacroAssemblerARM64.h:
  • assembler/MacroAssemblerARMv7.cpp:

(JSC::MacroAssemblerARMv7::probe):

  • assembler/MacroAssemblerARMv7.h:
  • assembler/MacroAssemblerPrinter.cpp:

(JSC::MacroAssemblerPrinter::printCallback):

  • assembler/MacroAssemblerPrinter.h:

(JSC::MacroAssemblerPrinter::print):
(JSC::MacroAssembler::print):

  • assembler/MacroAssemblerX86Common.cpp:

(JSC::MacroAssemblerX86Common::probe):

  • assembler/MacroAssemblerX86Common.h:
File:
1 edited

Legend:

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

    r215196 r215592  
    4444#define PTR_SIZE 4
    4545#define PROBE_PROBE_FUNCTION_OFFSET (0 * PTR_SIZE)
    46 #define PROBE_ARG1_OFFSET (1 * PTR_SIZE)
    47 #define PROBE_ARG2_OFFSET (2 * PTR_SIZE)
    48 
    49 #define PROBE_FIRST_GPREG_OFFSET (3 * PTR_SIZE)
     46#define PROBE_ARG_OFFSET (1 * PTR_SIZE)
     47
     48#define PROBE_FIRST_GPREG_OFFSET (2 * PTR_SIZE)
    5049
    5150#define GPREG_SIZE 4
     
    106105#define PROBE_CPU_D31_OFFSET (PROBE_FIRST_FPREG_OFFSET + (31 * FPREG_SIZE))
    107106#define PROBE_SIZE (PROBE_FIRST_FPREG_OFFSET + (32 * FPREG_SIZE))
     107#define PROBE_ALIGNED_SIZE (PROBE_SIZE)
    108108
    109109// These ASSERTs remind you that if you change the layout of ProbeContext,
     
    111111#define PROBE_OFFSETOF(x) offsetof(struct ProbeContext, x)
    112112COMPILE_ASSERT(PROBE_OFFSETOF(probeFunction) == PROBE_PROBE_FUNCTION_OFFSET, ProbeContext_probeFunction_offset_matches_ctiMasmProbeTrampoline);
    113 COMPILE_ASSERT(PROBE_OFFSETOF(arg1) == PROBE_ARG1_OFFSET, ProbeContext_arg1_offset_matches_ctiMasmProbeTrampoline);
    114 COMPILE_ASSERT(PROBE_OFFSETOF(arg2) == PROBE_ARG2_OFFSET, ProbeContext_arg2_offset_matches_ctiMasmProbeTrampoline);
     113COMPILE_ASSERT(PROBE_OFFSETOF(arg) == PROBE_ARG_OFFSET, ProbeContext_arg_offset_matches_ctiMasmProbeTrampoline);
     114
     115COMPILE_ASSERT(!(PROBE_CPU_R0_OFFSET & 0x3), ProbeContext_cpu_r0_offset_should_be_4_byte_aligned);
    115116
    116117COMPILE_ASSERT(PROBE_OFFSETOF(cpu.r0) == PROBE_CPU_R0_OFFSET, ProbeContext_cpu_r0_offset_matches_ctiMasmProbeTrampoline);
     
    134135COMPILE_ASSERT(PROBE_OFFSETOF(cpu.fpscr) == PROBE_CPU_FPSCR_OFFSET, ProbeContext_cpu_fpscr_offset_matches_ctiMasmProbeTrampoline);
    135136
     137COMPILE_ASSERT(!(PROBE_CPU_D0_OFFSET & 0xf), ProbeContext_cpu_d0_offset_should_be_16_byte_aligned);
     138
    136139COMPILE_ASSERT(PROBE_OFFSETOF(cpu.d0) == PROBE_CPU_D0_OFFSET, ProbeContext_cpu_d0_offset_matches_ctiMasmProbeTrampoline);
    137140COMPILE_ASSERT(PROBE_OFFSETOF(cpu.d1) == PROBE_CPU_D1_OFFSET, ProbeContext_cpu_d1_offset_matches_ctiMasmProbeTrampoline);
     
    169172
    170173COMPILE_ASSERT(sizeof(ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline);
     174COMPILE_ASSERT(!(PROBE_ALIGNED_SIZE & 0xf), ProbeContext_aligned_size_offset_should_be_16_byte_aligned);
    171175
    172176#undef PROBE_OFFSETOF
     
    184188    // The top of stack now looks like this:
    185189    //     esp[0 * ptrSize]: probeFunction
    186     //     esp[1 * ptrSize]: arg1
    187     //     esp[2 * ptrSize]: arg2
    188     //     esp[3 * ptrSize]: saved r0
    189     //     esp[4 * ptrSize]: saved ip
    190     //     esp[5 * ptrSize]: saved lr
    191     //     esp[6 * ptrSize]: saved sp
     190    //     esp[1 * ptrSize]: arg
     191    //     esp[2 * ptrSize]: saved r0
     192    //     esp[3 * ptrSize]: saved ip
     193    //     esp[4 * ptrSize]: saved lr
     194    //     esp[5 * ptrSize]: saved sp
    192195
    193196    "mov       ip, sp" "\n"
    194197    "mov       r0, sp" "\n"
    195     "sub       r0, r0, #" STRINGIZE_VALUE_OF(PROBE_SIZE) "\n"
     198    "sub       r0, r0, #" STRINGIZE_VALUE_OF(PROBE_ALIGNED_SIZE) "\n"
    196199
    197200    // The ARM EABI specifies that the stack needs to be 16 byte aligned.
     
    210213    "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_PROBE_FUNCTION_OFFSET) "]" "\n"
    211214    "ldr       lr, [ip, #1 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
    212     "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_ARG1_OFFSET) "]" "\n"
     215    "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_ARG_OFFSET) "]" "\n"
    213216    "ldr       lr, [ip, #2 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
    214     "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_ARG2_OFFSET) "]" "\n"
     217    "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_R0_OFFSET) "]" "\n"
    215218    "ldr       lr, [ip, #3 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
    216     "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_R0_OFFSET) "]" "\n"
     219    "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_IP_OFFSET) "]" "\n"
    217220    "ldr       lr, [ip, #4 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
    218     "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_IP_OFFSET) "]" "\n"
     221    "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_LR_OFFSET) "]" "\n"
    219222    "ldr       lr, [ip, #5 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
    220     "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_LR_OFFSET) "]" "\n"
    221     "ldr       lr, [ip, #6 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
    222223    "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_SP_OFFSET) "]" "\n"
    223224
     
    325326#endif // COMPILER(GCC_OR_CLANG)
    326327
    327 void MacroAssemblerARMv7::probe(ProbeFunction function, void* arg1, void* arg2)
     328void MacroAssemblerARMv7::probe(ProbeFunction function, void* arg)
    328329{
    329330    push(RegisterID::lr);
     
    334335    push(RegisterID::r0);
    335336    // The following uses RegisterID::ip. So, they must come after we push ip above.
    336     push(trustedImm32FromPtr(arg2));
    337     push(trustedImm32FromPtr(arg1));
     337    push(trustedImm32FromPtr(arg));
    338338    push(trustedImm32FromPtr(function));
    339339
Note: See TracChangeset for help on using the changeset viewer.