Ignore:
Timestamp:
Jun 4, 2020, 2:07:42 PM (5 years ago)
Author:
[email protected]
Message:

Add Options::validateDoesGC() for turning DoesGC validation on/off.
https://bugs.webkit.org/show_bug.cgi?id=212773

Reviewed by Saam Barati.

It will default to on if ASSERT_ENABLED because we want testing to be done with
the validation on. When needed, we can turn it off if we need to e.g. to
de-clutter disassembly dumps while debugging.

If Options::validateDoesGC() is false, we turn off JIT code emission for this
check, as well as skip the validation checks. There are still places in C++
code that store to DoesGC::m_value without checking Options::validateDoesGC().
It doesn't hurt to just let these stores proceed, and performance-wise, it's
probably cheaper to just do the store unconditionally than to gate it on a load of
Options::validateDoesGC() first.

Also made it explicit that the check on validateDFGDoesGC is a constexpr check.

  • dfg/DFGDoesGCCheck.cpp:

(JSC::DFG::DoesGCCheck::verifyCanGC):

  • dfg/DFGOSRExit.cpp:

(JSC::DFG::OSRExit::compileExit):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::compileNode):

  • ftl/FTLOSRExitCompiler.cpp:

(JSC::FTL::compileStub):

  • runtime/OptionsList.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp

    r262562 r262570  
    207207    saveAllRegisters(jit, registerScratch);
    208208   
    209     if (validateDFGDoesGC) {
    210         // We're about to exit optimized code. So, there's no longer any optimized
    211         // code running that expects no GC. We need to set this before object
    212         // materialization below.
    213 
    214         // Even though we set Heap::m_doesGC in compileFTLOSRExit(), we also need
    215         // to set it here because compileFTLOSRExit() is only called on the first time
    216         // we exit from this site, but all subsequent exits will take this compiled
    217         // ramp without calling compileFTLOSRExit() first.
    218         jit.store32(CCallHelpers::TrustedImm32(DoesGCCheck::encode(true, DoesGCCheck::Special::FTLOSRExit)), vm.heap.addressOfDoesGC());
     209    if constexpr (validateDFGDoesGC) {
     210        if (Options::validateDoesGC()) {
     211            // We're about to exit optimized code. So, there's no longer any optimized
     212            // code running that expects no GC. We need to set this before object
     213            // materialization below.
     214
     215            // Even though we set Heap::m_doesGC in compileFTLOSRExit(), we also need
     216            // to set it here because compileFTLOSRExit() is only called on the first time
     217            // we exit from this site, but all subsequent exits will take this compiled
     218            // ramp without calling compileFTLOSRExit() first.
     219            jit.store32(CCallHelpers::TrustedImm32(DoesGCCheck::encode(true, DoesGCCheck::Special::FTLOSRExit)), vm.heap.addressOfDoesGC());
     220        }
    219221    }
    220222
     
    546548    VM& vm = callFrame->deprecatedVM();
    547549
    548     if (validateDFGDoesGC) {
     550    if constexpr (validateDFGDoesGC) {
    549551        // We're about to exit optimized code. So, there's no longer any optimized
    550552        // code running that expects no GC.
Note: See TracChangeset for help on using the changeset viewer.