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/MacroAssemblerARM.cpp

    r215196 r215592  
    108108#define PTR_SIZE 4
    109109#define PROBE_PROBE_FUNCTION_OFFSET (0 * PTR_SIZE)
    110 #define PROBE_ARG1_OFFSET (1 * PTR_SIZE)
    111 #define PROBE_ARG2_OFFSET (2 * PTR_SIZE)
    112 
    113 #define PROBE_FIRST_GPREG_OFFSET (4 * PTR_SIZE)
     110#define PROBE_ARG_OFFSET (1 * PTR_SIZE)
     111
     112#define PROBE_FIRST_GPREG_OFFSET (2 * PTR_SIZE)
    114113
    115114#define GPREG_SIZE 4
     
    155154
    156155#define PROBE_SIZE (PROBE_FIRST_FPREG_OFFSET + (16 * FPREG_SIZE))
     156#define PROBE_ALIGNED_SIZE (PROBE_SIZE)
    157157
    158158// These ASSERTs remind you that if you change the layout of ProbeContext,
     
    160160#define PROBE_OFFSETOF(x) offsetof(struct ProbeContext, x)
    161161COMPILE_ASSERT(PROBE_OFFSETOF(probeFunction) == PROBE_PROBE_FUNCTION_OFFSET, ProbeContext_probeFunction_offset_matches_ctiMasmProbeTrampoline);
    162 COMPILE_ASSERT(PROBE_OFFSETOF(arg1) == PROBE_ARG1_OFFSET, ProbeContext_arg1_offset_matches_ctiMasmProbeTrampoline);
    163 COMPILE_ASSERT(PROBE_OFFSETOF(arg2) == PROBE_ARG2_OFFSET, ProbeContext_arg2_offset_matches_ctiMasmProbeTrampoline);
     162COMPILE_ASSERT(PROBE_OFFSETOF(arg) == PROBE_ARG_OFFSET, ProbeContext_arg_offset_matches_ctiMasmProbeTrampoline);
     163
     164COMPILE_ASSERT(!(PROBE_CPU_R0_OFFSET & 0x3), ProbeContext_cpu_r0_offset_should_be_4_byte_aligned);
    164165
    165166COMPILE_ASSERT(PROBE_OFFSETOF(cpu.r0) == PROBE_CPU_R0_OFFSET, ProbeContext_cpu_r0_offset_matches_ctiMasmProbeTrampoline);
     
    183184COMPILE_ASSERT(PROBE_OFFSETOF(cpu.fpscr) == PROBE_CPU_FPSCR_OFFSET, ProbeContext_cpu_fpscr_offset_matches_ctiMasmProbeTrampoline);
    184185
     186COMPILE_ASSERT(!(PROBE_CPU_D0_OFFSET & 0xf), ProbeContext_cpu_d0_offset_should_be_16_byte_aligned);
     187
    185188COMPILE_ASSERT(PROBE_OFFSETOF(cpu.d0) == PROBE_CPU_D0_OFFSET, ProbeContext_cpu_d0_offset_matches_ctiMasmProbeTrampoline);
    186189COMPILE_ASSERT(PROBE_OFFSETOF(cpu.d1) == PROBE_CPU_D1_OFFSET, ProbeContext_cpu_d1_offset_matches_ctiMasmProbeTrampoline);
     
    199202COMPILE_ASSERT(PROBE_OFFSETOF(cpu.d14) == PROBE_CPU_D14_OFFSET, ProbeContext_cpu_d14_offset_matches_ctiMasmProbeTrampoline);
    200203COMPILE_ASSERT(PROBE_OFFSETOF(cpu.d15) == PROBE_CPU_D15_OFFSET, ProbeContext_cpu_d15_offset_matches_ctiMasmProbeTrampoline);
     204
    201205COMPILE_ASSERT(sizeof(ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline);
     206COMPILE_ASSERT(!(PROBE_ALIGNED_SIZE & 0xf), ProbeContext_aligned_size_offset_should_be_16_byte_aligned);
    202207#undef PROBE_OFFSETOF
    203208
     
    212217    // The top of stack now looks like this:
    213218    //     esp[0 * ptrSize]: probeFunction
    214     //     esp[1 * ptrSize]: arg1
    215     //     esp[2 * ptrSize]: arg2
    216     //     esp[3 * ptrSize]: saved r3 / S0
    217     //     esp[4 * ptrSize]: saved ip
    218     //     esp[5 * ptrSize]: saved lr
    219     //     esp[6 * ptrSize]: saved sp
     219    //     esp[1 * ptrSize]: arg
     220    //     esp[2 * ptrSize]: saved r3 / S0
     221    //     esp[3 * ptrSize]: saved ip
     222    //     esp[4 * ptrSize]: saved lr
     223    //     esp[5 * ptrSize]: saved sp
    220224
    221225    "mov       ip, sp" "\n"
    222226    "mov       r3, sp" "\n"
    223     "sub       r3, r3, #" STRINGIZE_VALUE_OF(PROBE_SIZE) "\n"
     227    "sub       r3, r3, #" STRINGIZE_VALUE_OF(PROBE_ALIGNED_SIZE) "\n"
    224228
    225229    // The ARM EABI specifies that the stack needs to be 16 byte aligned.
     
    238242    "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_PROBE_FUNCTION_OFFSET) "]" "\n"
    239243    "ldr       lr, [ip, #1 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
    240     "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_ARG1_OFFSET) "]" "\n"
     244    "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_ARG_OFFSET) "]" "\n"
    241245    "ldr       lr, [ip, #2 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
    242     "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_ARG2_OFFSET) "]" "\n"
     246    "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_R3_OFFSET) "]" "\n"
    243247    "ldr       lr, [ip, #3 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
    244     "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_R3_OFFSET) "]" "\n"
     248    "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_IP_OFFSET) "]" "\n"
    245249    "ldr       lr, [ip, #4 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
    246     "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_IP_OFFSET) "]" "\n"
     250    "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_LR_OFFSET) "]" "\n"
    247251    "ldr       lr, [ip, #5 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
    248     "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_LR_OFFSET) "]" "\n"
    249     "ldr       lr, [ip, #6 * " STRINGIZE_VALUE_OF(PTR_SIZE) "]" "\n"
    250252    "str       lr, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_SP_OFFSET) "]" "\n"
    251253
     
    348350#endif // COMPILER(GCC_OR_CLANG)
    349351
    350 void MacroAssemblerARM::probe(ProbeFunction function, void* arg1, void* arg2)
     352void MacroAssemblerARM::probe(ProbeFunction function, void* arg)
    351353{
    352354    push(RegisterID::sp);
     
    355357    push(RegisterID::S0);
    356358    // The following uses RegisterID::S0. So, they must come after we push S0 above.
    357     push(trustedImm32FromPtr(arg2));
    358     push(trustedImm32FromPtr(arg1));
     359    push(trustedImm32FromPtr(arg));
    359360    push(trustedImm32FromPtr(function));
    360361
Note: See TracChangeset for help on using the changeset viewer.