Changeset 220579 in webkit


Ignore:
Timestamp:
Aug 10, 2017 10:31:32 PM (7 years ago)
Author:
mark.lam@apple.com
Message:

Make the MASM_PROBE mechanism mandatory for DFG and FTL builds.
https://bugs.webkit.org/show_bug.cgi?id=175446
<rdar://problem/33836545>

Reviewed by Saam Barati.

Source/JavaScriptCore:

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

(JSC::MacroAssembler::probe):

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

(JSC::MacroAssembler::probe):

  • assembler/MacroAssemblerARM.h:

(JSC::MacroAssemblerARM::trustedImm32FromPtr):

  • assembler/MacroAssemblerARM64.cpp:

(JSC::MacroAssembler::probe):

  • assembler/MacroAssemblerARMv7.cpp:

(JSC::MacroAssembler::probe):

  • assembler/MacroAssemblerARMv7.h:

(JSC::MacroAssemblerARMv7::trustedImm32FromPtr):

  • assembler/MacroAssemblerPrinter.cpp:
  • assembler/MacroAssemblerPrinter.h:
  • assembler/MacroAssemblerX86Common.cpp:
  • assembler/testmasm.cpp:

(JSC::isSpecialGPR):
(JSC::testProbeModifiesProgramCounter):
(JSC::run):

  • b3/B3LowerToAir.cpp:

(JSC::B3::Air::LowerToAir::print):

  • b3/air/AirPrintSpecial.cpp:
  • b3/air/AirPrintSpecial.h:

Source/WTF:

This is needed in order to support https://bugs.webkit.org/show_bug.cgi?id=174645.
One consequence of this is that the DFG will now be disabled for the MIPS and
Windows ports. See:

https://bugs.webkit.org/show_bug.cgi?id=175447
https://bugs.webkit.org/show_bug.cgi?id=175449

Also, we should only ENABLE_SIGNAL_BASED_VM_TRAPS if the DFG is enabled. It was
never meaningful to use SIGNAL_BASED_VM_TRAPS with the baseline JIT anyway. This
is a mis-configuration error that is now fixed.

  • wtf/Platform.h:
Location:
trunk/Source
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r220556 r220579  
     12017-08-10  Mark Lam  <mark.lam@apple.com>
     2
     3        Make the MASM_PROBE mechanism mandatory for DFG and FTL builds.
     4        https://bugs.webkit.org/show_bug.cgi?id=175446
     5        <rdar://problem/33836545>
     6
     7        Reviewed by Saam Barati.
     8
     9        * assembler/AbstractMacroAssembler.h:
     10        * assembler/MacroAssembler.cpp:
     11        (JSC::MacroAssembler::probe):
     12        * assembler/MacroAssembler.h:
     13        * assembler/MacroAssemblerARM.cpp:
     14        (JSC::MacroAssembler::probe):
     15        * assembler/MacroAssemblerARM.h:
     16        (JSC::MacroAssemblerARM::trustedImm32FromPtr):
     17        * assembler/MacroAssemblerARM64.cpp:
     18        (JSC::MacroAssembler::probe):
     19        * assembler/MacroAssemblerARMv7.cpp:
     20        (JSC::MacroAssembler::probe):
     21        * assembler/MacroAssemblerARMv7.h:
     22        (JSC::MacroAssemblerARMv7::trustedImm32FromPtr):
     23        * assembler/MacroAssemblerPrinter.cpp:
     24        * assembler/MacroAssemblerPrinter.h:
     25        * assembler/MacroAssemblerX86Common.cpp:
     26        * assembler/testmasm.cpp:
     27        (JSC::isSpecialGPR):
     28        (JSC::testProbeModifiesProgramCounter):
     29        (JSC::run):
     30        * b3/B3LowerToAir.cpp:
     31        (JSC::B3::Air::LowerToAir::print):
     32        * b3/air/AirPrintSpecial.cpp:
     33        * b3/air/AirPrintSpecial.h:
     34
    1352017-08-10  Mark Lam  <mark.lam@apple.com>
    236
  • trunk/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h

    r219740 r220579  
    4444#if ENABLE(ASSEMBLER)
    4545
    46 #if ENABLE(MASM_PROBE)
    4746struct ProbeContext;
    4847typedef void (*ProbeFunction)(struct ProbeContext*);
    49 #endif
    5048   
    5149class AllowMacroScratchRegisterUsage;
  • trunk/Source/JavaScriptCore/assembler/MacroAssembler.cpp

    r215592 r220579  
    3535const double MacroAssembler::twoToThe32 = (double)0x100000000ull;
    3636
    37 #if ENABLE(MASM_PROBE)
    3837static void stdFunctionCallback(ProbeContext* context)
    3938{
     
    4645    probe(stdFunctionCallback, new std::function<void(ProbeContext*)>(func));
    4746}
    48 #endif // ENABLE(MASM_PROBE)
    4947
    5048} // namespace JSC
  • trunk/Source/JavaScriptCore/assembler/MacroAssembler.h

    r219790 r220579  
    18251825    }
    18261826
    1827 #if ENABLE(MASM_PROBE)
    18281827    struct CPUState;
    18291828
     
    18491848
    18501849    JS_EXPORT_PRIVATE void probe(std::function<void(ProbeContext*)>);
    1851 #endif // ENABLE(MASM_PROBE)
    18521850
    18531851    // Let's you print from your JIT generated code.
    1854     // This only works if ENABLE(MASM_PROBE). Otherwise, print() is a no-op.
    18551852    // See comments in MacroAssemblerPrinter.h for examples of how to use this.
    18561853    template<typename... Arguments>
     
    18591856    void print(Printer::PrintRecordList*);
    18601857};
    1861 
    1862 #if ENABLE(MASM_PROBE)
    18631858
    18641859struct MacroAssembler::CPUState {
     
    19641959    void*& sp() { return cpu.sp(); }
    19651960};
    1966 #endif // ENABLE(MASM_PROBE)
    19671961   
    19681962} // namespace JSC
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp

    r219885 r220579  
    9797#endif // CPU(ARMV5_OR_LOWER)
    9898
    99 #if ENABLE(MASM_PROBE)
    100 
    10199extern "C" void ctiMasmProbeTrampoline();
    102100
     
    383381
    384382}
    385 #endif // ENABLE(MASM_PROBE)
    386383
    387384} // namespace JSC
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.h

    r219437 r220579  
    15871587    }
    15881588
    1589 #if ENABLE(MASM_PROBE)
    15901589    inline TrustedImm32 trustedImm32FromPtr(void* ptr)
    15911590    {
     
    16021601        return TrustedImm32(TrustedImmPtr(reinterpret_cast<void*>(function)));
    16031602    }
    1604 #endif
    16051603
    16061604private:
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM64.cpp

    r219951 r220579  
    3232
    3333namespace JSC {
    34 
    35 #if ENABLE(MASM_PROBE)
    3634
    3735extern "C" void ctiMasmProbeTrampoline();
     
    552550    add64(TrustedImm32(sizeof(OutgoingProbeRecord)), sp);
    553551}
    554 #endif // ENABLE(MASM_PROBE)
    555552
    556553} // namespace JSC
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.cpp

    r219885 r220579  
    3232
    3333namespace JSC {
    34 
    35 #if ENABLE(MASM_PROBE)
    3634
    3735extern "C" void ctiMasmProbeTrampoline();
     
    360358    m_assembler.blx(RegisterID::ip);
    361359}
    362 #endif // ENABLE(MASM_PROBE)
    363360
    364361} // namespace JSC
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h

    r219437 r220579  
    21082108    }
    21092109   
    2110 #if ENABLE(MASM_PROBE)
    21112110    inline TrustedImm32 trustedImm32FromPtr(void* ptr)
    21122111    {
     
    21232122        return TrustedImm32(TrustedImmPtr(reinterpret_cast<void*>(function)));
    21242123    }
    2125 #endif
    21262124
    21272125private:
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerPrinter.cpp

    r219790 r220579  
    2727#include "MacroAssemblerPrinter.h"
    2828
    29 #if ENABLE(MASM_PROBE)
    30 
    3129#include "MacroAssembler.h"
     30#include <inttypes.h>
    3231
    3332namespace JSC {
     
    5453
    5554#if USE(JSVALUE32_64)
    56     #define INTPTR_HEX_VALUE_FORMAT "0x%08lx"
     55    #define INTPTR_HEX_VALUE_FORMAT "0x%08" PRIxPTR
    5756#else
    58     #define INTPTR_HEX_VALUE_FORMAT "0x%016lx"
     57    #define INTPTR_HEX_VALUE_FORMAT "0x%016" PRIxPTR
    5958#endif
    6059
    6160    for (auto id = MacroAssembler::firstRegister(); id <= MacroAssembler::lastRegister(); id = nextID(id)) {
    6261        intptr_t value = static_cast<intptr_t>(cpu.gpr(id));
    63         INDENT, out.printf("    %6s: " INTPTR_HEX_VALUE_FORMAT "  %ld\n", cpu.gprName(id), value, value);
     62        INDENT, out.printf("    %6s: " INTPTR_HEX_VALUE_FORMAT "  %" PRIdPTR "\n", cpu.gprName(id), value, value);
    6463    }
    6564    for (auto id = MacroAssembler::firstSPRegister(); id <= MacroAssembler::lastSPRegister(); id = nextID(id)) {
    6665        intptr_t value = static_cast<intptr_t>(cpu.spr(id));
    67         INDENT, out.printf("    %6s: " INTPTR_HEX_VALUE_FORMAT "  %ld\n", cpu.sprName(id), value, value);
     66        INDENT, out.printf("    %6s: " INTPTR_HEX_VALUE_FORMAT "  %" PRIdPTR "\n", cpu.sprName(id), value, value);
    6867    }
    6968    #undef INTPTR_HEX_VALUE_FORMAT
     
    7271        uint64_t u = bitwise_cast<uint64_t>(cpu.fpr(id));
    7372        double d = cpu.fpr(id);
    74         INDENT, out.printf("    %6s: 0x%016llx  %.13g\n", cpu.fprName(id), u, d);
     73        INDENT, out.printf("    %6s: 0x%016" PRIx64 "  %.13g\n", cpu.fprName(id), u, d);
    7574    }
    7675
     
    10099    const char* name = CPUState::fprName(regID);
    101100    double value = context.probeContext.fpr(regID);
    102     out.printf("%s:<0x%016llx %.13g>", name, bitwise_cast<uint64_t>(value), value);
     101    out.printf("%s:<0x%016" PRIx64 " %.13g>", name, bitwise_cast<uint64_t>(value), value);
    103102}
    104103
     
    147146        if (memory.numBytes == sizeof(int64_t)) {
    148147            auto p = reinterpret_cast<int64_t*>(ptr);
    149             out.printf("%p:<0x%016llx %lld>", p, *p, *p);
     148            out.printf("%p:<0x%016" PRIx64 " %" PRId64 ">", p, *p, *p);
    150149            return;
    151150        }
     
    184183} // namespace JSC
    185184
    186 #endif // ENABLE(MASM_PROBE)
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerPrinter.h

    r215642 r220579  
    3333#if ENABLE(ASSEMBLER)
    3434
    35 #if ENABLE(MASM_PROBE)
    36    
    3735// What is MacroAssembler::print()?
    3836// ===============================
     
    241239}
    242240
    243 #else // ENABLE(MASM_PROBE)
    244 
    245 template<typename... Arguments>
    246 inline void MacroAssembler::print(Arguments&&...) { }
    247 
    248 inline void MacroAssembler::print(Printer::PrintRecordList*) { }
    249 
    250 #endif // ENABLE(MASM_PROBE)
    251 
    252241#endif // ENABLE(ASSEMBLER)
    253242
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp

    r219885 r220579  
    3333namespace JSC {
    3434
    35 #if ENABLE(MASM_PROBE)
    36 
    3735extern "C" void ctiMasmProbeTrampoline();
    3836
     
    524522
    525523#endif // COMPILER(GCC_OR_CLANG)
     524
     525#if OS(WINDOWS)
     526extern "C" NO_RETURN_DUE_TO_ASSERT void ctiMasmProbeTrampoline()
     527{
     528    RELEASE_ASSERT_NOT_REACHED();
     529}
     530#endif // OS(WINDOWS)
    526531
    527532// What code is emitted for the probe?
     
    576581}
    577582
    578 #endif // ENABLE(MASM_PROBE)
    579 
    580583#if CPU(X86) && !OS(MAC_OS_X)
    581584MacroAssemblerX86Common::SSE2CheckState MacroAssemblerX86Common::s_sse2CheckState = NotCheckedSSE2;
  • trunk/Source/JavaScriptCore/assembler/testmasm.cpp

    r220308 r220579  
    8686    CHECK(bitwise_cast<uint64_t>(a) == bitwise_cast<uint64_t>(a))
    8787
    88 #if ENABLE(MASM_PROBE)
    8988bool isPC(MacroAssembler::RegisterID id)
    9089{
     
    117116    return false;
    118117}
    119 #endif // ENABLE(MASM_PROBE)
    120118
    121119MacroAssemblerCodeRef compile(Generator&& generate)
     
    150148}
    151149
    152 #if ENABLE(MASM_PROBE)
    153150void testProbeReadsArgumentRegisters()
    154151{
     
    494491    CHECK(continuationWasReached);
    495492}
    496 #endif // ENABLE(MASM_PROBE)
    497493
    498494#define RUN(test) do {                          \
     
    520516    RUN(testSimple());
    521517
    522 #if ENABLE(MASM_PROBE)
    523518    RUN(testProbeReadsArgumentRegisters());
    524519    RUN(testProbeWritesArgumentRegisters());
     
    527522    RUN(testProbeModifiesStackPointerToNBytesBelowSP());
    528523    RUN(testProbeModifiesProgramCounter());
    529 #endif
    530524
    531525    if (tasks.isEmpty())
  • trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp

    r219899 r220579  
    11501150    }
    11511151
    1152 #if ENABLE(MASM_PROBE)
    11531152    template<typename... Arguments>
    11541153    void print(Arguments&&... arguments)
     
    11671166        append(WTFMove(inst));
    11681167    }
    1169 #else
    1170     template<typename... Arguments>
    1171     void print(Arguments&&...) { }
    1172 #endif // ENABLE(MASM_PROBE)
    11731168
    11741169    template<typename... Arguments>
  • trunk/Source/JavaScriptCore/b3/air/AirPrintSpecial.cpp

    r216306 r220579  
    2828
    2929#if ENABLE(B3_JIT)
    30 #if ENABLE(MASM_PROBE)
    3130
    3231#include "MacroAssemblerPrinter.h"
     
    126125} // namespace JSC
    127126
    128 #endif // ENABLE(MASM_PROBE)
    129127#endif // ENABLE(B3_JIT)
  • trunk/Source/JavaScriptCore/b3/air/AirPrintSpecial.h

    r216306 r220579  
    2727
    2828#if ENABLE(B3_JIT)
    29 #if ENABLE(MASM_PROBE)
    3029
    3130#include "AirInst.h"
     
    130129} } } // namespace JSC::B3::Air
    131130
    132 #endif // ENABLE(MASM_PROBE)
    133131#endif // ENABLE(B3_JIT)
  • trunk/Source/WTF/ChangeLog

    r220574 r220579  
     12017-08-10  Mark Lam  <mark.lam@apple.com>
     2
     3        Make the MASM_PROBE mechanism mandatory for DFG and FTL builds.
     4        https://bugs.webkit.org/show_bug.cgi?id=175446
     5        <rdar://problem/33836545>
     6
     7        Reviewed by Saam Barati.
     8
     9        This is needed in order to support https://bugs.webkit.org/show_bug.cgi?id=174645.
     10        One consequence of this is that the DFG will now be disabled for the MIPS and
     11        Windows ports. See:
     12            https://bugs.webkit.org/show_bug.cgi?id=175447
     13            https://bugs.webkit.org/show_bug.cgi?id=175449
     14
     15        Also, we should only ENABLE_SIGNAL_BASED_VM_TRAPS if the DFG is enabled.  It was
     16        never meaningful to use SIGNAL_BASED_VM_TRAPS with the baseline JIT anyway.  This
     17        is a mis-configuration error that is now fixed.
     18
     19        * wtf/Platform.h:
     20
    1212017-08-10  Brady Eidson  <beidson@apple.com>
    222
  • trunk/Source/WTF/wtf/Platform.h

    r219994 r220579  
    771771#if !defined(ENABLE_DFG_JIT) && ENABLE(JIT)
    772772/* Enable the DFG JIT on X86 and X86_64. */
    773 #if (CPU(X86) || CPU(X86_64)) && (OS(DARWIN) || OS(LINUX) || OS(FREEBSD) || OS(WINDOWS) || OS(HURD))
     773#if (CPU(X86) || CPU(X86_64)) && (OS(DARWIN) || OS(LINUX) || OS(FREEBSD) || OS(HURD))
    774774#define ENABLE_DFG_JIT 1
    775775#endif
     
    778778#define ENABLE_DFG_JIT 1
    779779#endif
    780 /* Enable the DFG JIT on ARM and MIPS. */
    781 #if CPU(ARM_TRADITIONAL) || CPU(MIPS)
     780/* Enable the DFG JIT on ARM. */
     781#if CPU(ARM_TRADITIONAL)
    782782#define ENABLE_DFG_JIT 1
    783783#endif
     784/* FIXME: MIPS cannot enable the DFG until it has support for MacroAssembler::probe().
     785   https://bugs.webkit.org/show_bug.cgi?id=175447
     786*/
     787/* FIXME: Windows cannot enable the DFG until it has support for MacroAssembler::probe().
     788   https://bugs.webkit.org/show_bug.cgi?id=175449
     789*/
    784790#endif
    785791
     
    800806#endif
    801807
    802 /* This controls whether B3 is built. B3 is needed for FTL JIT and WebAssembly */
    803 #if ENABLE(FTL_JIT) || ENABLE(WEBASSEMBLY)
    804 #define ENABLE_B3_JIT 1
    805 #endif
    806 
    807808/* If the baseline jit is not available, then disable upper tiers as well: */
    808809#if !ENABLE(JIT)
    809810#undef ENABLE_DFG_JIT
    810811#undef ENABLE_FTL_JIT
    811 #undef ENABLE_B3_JIT
    812812#define ENABLE_DFG_JIT 0
    813813#define ENABLE_FTL_JIT 0
    814 #define ENABLE_B3_JIT 0
     814#endif
     815
     816/* If the DFG jit is not available, then disable upper tiers as well: */
     817#if !ENABLE(DFG_JIT)
     818#undef ENABLE_FTL_JIT
     819#define ENABLE_FTL_JIT 0
     820#endif
     821
     822/* This controls whether B3 is built. B3 is needed for FTL JIT and WebAssembly */
     823#if ENABLE(FTL_JIT) || ENABLE(WEBASSEMBLY)
     824#define ENABLE_B3_JIT 1
    815825#endif
    816826
     
    949959#endif
    950960
    951 /* Enable the following if you want to use the MacroAssembler::probe() facility
    952    to do JIT debugging. */
    953 #if (CPU(X86) || CPU(X86_64) || CPU(ARM64) || (CPU(ARM_THUMB2) && PLATFORM(IOS))) && ENABLE(JIT) && OS(DARWIN)
    954 #define ENABLE_MASM_PROBE 1
    955 #else
    956 #define ENABLE_MASM_PROBE 0
    957 #endif
    958 
    959961#ifndef ENABLE_EXCEPTION_SCOPE_VERIFICATION
    960962#ifdef NDEBUG
     
    965967#endif
    966968
    967 #if ENABLE(JIT) && HAVE(MACHINE_CONTEXT) && (CPU(X86) || CPU(X86_64) || CPU(ARM64))
     969#if ENABLE(DFG_JIT) && HAVE(MACHINE_CONTEXT) && (CPU(X86) || CPU(X86_64) || CPU(ARM64))
    968970#define ENABLE_SIGNAL_BASED_VM_TRAPS 1
    969971#endif
Note: See TracChangeset for help on using the changeset viewer.