Ignore:
Timestamp:
Nov 13, 2014, 3:00:07 PM (11 years ago)
Author:
[email protected]
Message:

Change X86/64 JIT probes to save/restore xmm regs as double instead of m128.
<https://webkit.org/b/138708>

Reviewed by Michael Saboff.

The JIT code only uses the xmm regs as double registers. This patch changes
the storage types of the FP registers in X86Assembler.h to double instead of
m128, and updates the X86 and X86_64 JIT probe implementations accordingly.

Also made some minor cosmetic changes in the output of the probe dump functions.

  • assembler/MacroAssemblerX86Common.cpp:

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

  • assembler/X86Assembler.h:
  • jit/JITStubsX86.h:
  • jit/JITStubsX86Common.h:
  • jit/JITStubsX86_64.h:
File:
1 edited

Legend:

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

    r176031 r176095  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5151#define PROBE_ARG2_OFFSET (2 * PTR_SIZE)
    5252
    53 #define PROBE_CPU_EAX_OFFSET (4 * PTR_SIZE)
    54 #define PROBE_CPU_EBX_OFFSET (5 * PTR_SIZE)
    55 #define PROBE_CPU_ECX_OFFSET (6 * PTR_SIZE)
    56 #define PROBE_CPU_EDX_OFFSET (7 * PTR_SIZE)
    57 #define PROBE_CPU_ESI_OFFSET (8 * PTR_SIZE)
    58 #define PROBE_CPU_EDI_OFFSET (9 * PTR_SIZE)
    59 #define PROBE_CPU_EBP_OFFSET (10 * PTR_SIZE)
    60 #define PROBE_CPU_ESP_OFFSET (11 * PTR_SIZE)
     53#define PROBE_FIRST_GPR_OFFSET (3 * PTR_SIZE)
     54#define PROBE_CPU_EAX_OFFSET (PROBE_FIRST_GPR_OFFSET + (0 * PTR_SIZE))
     55#define PROBE_CPU_ECX_OFFSET (PROBE_FIRST_GPR_OFFSET + (1 * PTR_SIZE))
     56#define PROBE_CPU_EDX_OFFSET (PROBE_FIRST_GPR_OFFSET + (2 * PTR_SIZE))
     57#define PROBE_CPU_EBX_OFFSET (PROBE_FIRST_GPR_OFFSET + (3 * PTR_SIZE))
     58#define PROBE_CPU_ESP_OFFSET (PROBE_FIRST_GPR_OFFSET + (4 * PTR_SIZE))
     59#define PROBE_CPU_EBP_OFFSET (PROBE_FIRST_GPR_OFFSET + (5 * PTR_SIZE))
     60#define PROBE_CPU_ESI_OFFSET (PROBE_FIRST_GPR_OFFSET + (6 * PTR_SIZE))
     61#define PROBE_CPU_EDI_OFFSET (PROBE_FIRST_GPR_OFFSET + (7 * PTR_SIZE))
    6162
    6263#if CPU(X86)
    63 #define PROBE_FIRST_SPECIAL_OFFSET (12 * PTR_SIZE)
     64#define PROBE_FIRST_SPECIAL_OFFSET (PROBE_FIRST_GPR_OFFSET + (8 * PTR_SIZE))
    6465#else // CPU(X86_64)
    65 #define PROBE_CPU_R8_OFFSET (12 * PTR_SIZE)
    66 #define PROBE_CPU_R9_OFFSET (13 * PTR_SIZE)
    67 #define PROBE_CPU_R10_OFFSET (14 * PTR_SIZE)
    68 #define PROBE_CPU_R11_OFFSET (15 * PTR_SIZE)
    69 #define PROBE_CPU_R12_OFFSET (16 * PTR_SIZE)
    70 #define PROBE_CPU_R13_OFFSET (17 * PTR_SIZE)
    71 #define PROBE_CPU_R14_OFFSET (18 * PTR_SIZE)
    72 #define PROBE_CPU_R15_OFFSET (19 * PTR_SIZE)
    73 #define PROBE_FIRST_SPECIAL_OFFSET (20 * PTR_SIZE)
     66#define PROBE_CPU_R8_OFFSET (PROBE_FIRST_GPR_OFFSET + (8 * PTR_SIZE))
     67#define PROBE_CPU_R9_OFFSET (PROBE_FIRST_GPR_OFFSET + (9 * PTR_SIZE))
     68#define PROBE_CPU_R10_OFFSET (PROBE_FIRST_GPR_OFFSET + (10 * PTR_SIZE))
     69#define PROBE_CPU_R11_OFFSET (PROBE_FIRST_GPR_OFFSET + (11 * PTR_SIZE))
     70#define PROBE_CPU_R12_OFFSET (PROBE_FIRST_GPR_OFFSET + (12 * PTR_SIZE))
     71#define PROBE_CPU_R13_OFFSET (PROBE_FIRST_GPR_OFFSET + (13 * PTR_SIZE))
     72#define PROBE_CPU_R14_OFFSET (PROBE_FIRST_GPR_OFFSET + (14 * PTR_SIZE))
     73#define PROBE_CPU_R15_OFFSET (PROBE_FIRST_GPR_OFFSET + (15 * PTR_SIZE))
     74#define PROBE_FIRST_SPECIAL_OFFSET (PROBE_FIRST_GPR_OFFSET + (16 * PTR_SIZE))
    7475#endif // CPU(X86_64)
    7576
    7677#define PROBE_CPU_EIP_OFFSET (PROBE_FIRST_SPECIAL_OFFSET + (0 * PTR_SIZE))
    7778#define PROBE_CPU_EFLAGS_OFFSET (PROBE_FIRST_SPECIAL_OFFSET + (1 * PTR_SIZE))
     79#define PROBE_FIRST_XMM_OFFSET (PROBE_FIRST_SPECIAL_OFFSET + (2 * PTR_SIZE))
    7880
    79 #if CPU(X86)
    80 #define PROBE_FIRST_XMM_OFFSET (PROBE_FIRST_SPECIAL_OFFSET + (4 * PTR_SIZE)) // After padding.
    81 #else // CPU(X86_64)
    82 #define PROBE_FIRST_XMM_OFFSET (PROBE_FIRST_SPECIAL_OFFSET + (2 * PTR_SIZE)) // After padding.
    83 #endif // CPU(X86_64)
    84 
    85 #define XMM_SIZE 16
     81#define XMM_SIZE 8
    8682#define PROBE_CPU_XMM0_OFFSET (PROBE_FIRST_XMM_OFFSET + (0 * XMM_SIZE))
    8783#define PROBE_CPU_XMM1_OFFSET (PROBE_FIRST_XMM_OFFSET + (1 * XMM_SIZE))
     
    9389#define PROBE_CPU_XMM7_OFFSET (PROBE_FIRST_XMM_OFFSET + (7 * XMM_SIZE))
    9490
     91#if CPU(X86)
    9592#define PROBE_SIZE (PROBE_CPU_XMM7_OFFSET + XMM_SIZE)
     93#else // CPU(X86_64)
     94#define PROBE_CPU_XMM8_OFFSET (PROBE_FIRST_XMM_OFFSET + (8 * XMM_SIZE))
     95#define PROBE_CPU_XMM9_OFFSET (PROBE_FIRST_XMM_OFFSET + (9 * XMM_SIZE))
     96#define PROBE_CPU_XMM10_OFFSET (PROBE_FIRST_XMM_OFFSET + (10 * XMM_SIZE))
     97#define PROBE_CPU_XMM11_OFFSET (PROBE_FIRST_XMM_OFFSET + (11 * XMM_SIZE))
     98#define PROBE_CPU_XMM12_OFFSET (PROBE_FIRST_XMM_OFFSET + (12 * XMM_SIZE))
     99#define PROBE_CPU_XMM13_OFFSET (PROBE_FIRST_XMM_OFFSET + (13 * XMM_SIZE))
     100#define PROBE_CPU_XMM14_OFFSET (PROBE_FIRST_XMM_OFFSET + (14 * XMM_SIZE))
     101#define PROBE_CPU_XMM15_OFFSET (PROBE_FIRST_XMM_OFFSET + (15 * XMM_SIZE))
     102#define PROBE_SIZE (PROBE_CPU_XMM15_OFFSET + XMM_SIZE)
     103#endif // CPU(X86_64)
    96104
    97105// These ASSERTs remind you that if you change the layout of ProbeContext,
     
    133141COMPILE_ASSERT(PROBE_OFFSETOF(cpu.xmm7) == PROBE_CPU_XMM7_OFFSET, ProbeContext_cpu_xmm7_offset_matches_ctiMasmProbeTrampoline);
    134142
     143#if CPU(X86_64)
     144COMPILE_ASSERT(PROBE_OFFSETOF(cpu.xmm8) == PROBE_CPU_XMM8_OFFSET, ProbeContext_cpu_xmm8_offset_matches_ctiMasmProbeTrampoline);
     145COMPILE_ASSERT(PROBE_OFFSETOF(cpu.xmm9) == PROBE_CPU_XMM9_OFFSET, ProbeContext_cpu_xmm9_offset_matches_ctiMasmProbeTrampoline);
     146COMPILE_ASSERT(PROBE_OFFSETOF(cpu.xmm10) == PROBE_CPU_XMM10_OFFSET, ProbeContext_cpu_xmm10_offset_matches_ctiMasmProbeTrampoline);
     147COMPILE_ASSERT(PROBE_OFFSETOF(cpu.xmm11) == PROBE_CPU_XMM11_OFFSET, ProbeContext_cpu_xmm11_offset_matches_ctiMasmProbeTrampoline);
     148COMPILE_ASSERT(PROBE_OFFSETOF(cpu.xmm12) == PROBE_CPU_XMM12_OFFSET, ProbeContext_cpu_xmm12_offset_matches_ctiMasmProbeTrampoline);
     149COMPILE_ASSERT(PROBE_OFFSETOF(cpu.xmm13) == PROBE_CPU_XMM13_OFFSET, ProbeContext_cpu_xmm13_offset_matches_ctiMasmProbeTrampoline);
     150COMPILE_ASSERT(PROBE_OFFSETOF(cpu.xmm14) == PROBE_CPU_XMM14_OFFSET, ProbeContext_cpu_xmm14_offset_matches_ctiMasmProbeTrampoline);
     151COMPILE_ASSERT(PROBE_OFFSETOF(cpu.xmm15) == PROBE_CPU_XMM15_OFFSET, ProbeContext_cpu_xmm15_offset_matches_ctiMasmProbeTrampoline);
     152#endif // CPU(X86_64)
     153
    135154COMPILE_ASSERT(sizeof(MacroAssembler::ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline);
    136155
    137 // Also double check that the xmm registers are 16 byte (128-bit) aligned as
    138 // required by the movdqa instruction used in the trampoline.
    139 COMPILE_ASSERT(!(PROBE_OFFSETOF(cpu.xmm0) % 16), ProbeContext_xmm0_offset_not_aligned_properly);
    140156#undef PROBE_OFFSETOF
    141157
Note: See TracChangeset for help on using the changeset viewer.