Changeset 213302 in webkit


Ignore:
Timestamp:
Mar 2, 2017 2:06:04 PM (7 years ago)
Author:
mark.lam@apple.com
Message:

Add Options::alwaysCheckTraps() and Options::usePollingTraps() options.
https://bugs.webkit.org/show_bug.cgi?id=169088

Reviewed by Keith Miller.

Options::alwaysCheckTraps() forces the op_check_traps bytecode to always be
generated. This is useful for testing purposes until we have signal based
traps, at which point, we will always emit the op_check_traps bytecode and remove
this option.

Options::usePollingTraps() enables the use of polling VM traps all the time.
This will be useful for benchmark comparisons, (between polling and non-polling
traps), as well as for forcing polling traps later for ports that don't support
signal based traps.

Note: signal based traps are not fully implemented yet. As a result, if the VM
watchdog is in use, we will force Options::usePollingTraps() to be true.

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::emitCheckTraps):

  • dfg/DFGClobberize.h:

(JSC::DFG::clobberize):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileCheckTraps):

  • dfg/DFGSpeculativeJIT32_64.cpp:

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

  • dfg/DFGSpeculativeJIT64.cpp:

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

  • ftl/FTLLowerDFGToB3.cpp:

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

  • runtime/Options.cpp:

(JSC::recomputeDependentOptions):

  • runtime/Options.h:
Location:
trunk/Source/JavaScriptCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r213299 r213302  
     12017-03-02  Mark Lam  <mark.lam@apple.com>
     2
     3        Add Options::alwaysCheckTraps() and Options::usePollingTraps() options.
     4        https://bugs.webkit.org/show_bug.cgi?id=169088
     5
     6        Reviewed by Keith Miller.
     7
     8        Options::alwaysCheckTraps() forces the op_check_traps bytecode to always be
     9        generated.  This is useful for testing purposes until we have signal based
     10        traps, at which point, we will always emit the op_check_traps bytecode and remove
     11        this option.
     12
     13        Options::usePollingTraps() enables the use of polling VM traps all the time.
     14        This will be useful for benchmark comparisons, (between polling and non-polling
     15        traps), as well as for forcing polling traps later for ports that don't support
     16        signal based traps.
     17
     18        Note: signal based traps are not fully implemented yet.  As a result, if the VM
     19        watchdog is in use, we will force Options::usePollingTraps() to be true.
     20
     21        * bytecompiler/BytecodeGenerator.cpp:
     22        (JSC::BytecodeGenerator::emitCheckTraps):
     23        * dfg/DFGClobberize.h:
     24        (JSC::DFG::clobberize):
     25        * dfg/DFGSpeculativeJIT.cpp:
     26        (JSC::DFG::SpeculativeJIT::compileCheckTraps):
     27        * dfg/DFGSpeculativeJIT32_64.cpp:
     28        (JSC::DFG::SpeculativeJIT::compile):
     29        * dfg/DFGSpeculativeJIT64.cpp:
     30        (JSC::DFG::SpeculativeJIT::compile):
     31        * ftl/FTLLowerDFGToB3.cpp:
     32        (JSC::FTL::DFG::LowerDFGToB3::compileNode):
     33        (JSC::FTL::DFG::LowerDFGToB3::compileCheckTraps):
     34        * runtime/Options.cpp:
     35        (JSC::recomputeDependentOptions):
     36        * runtime/Options.h:
     37
    1382017-03-02  Keith Miller  <keith_miller@apple.com>
    239
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r213165 r213302  
    12751275void BytecodeGenerator::emitCheckTraps()
    12761276{
    1277     if (vm()->watchdog() || vm()->needAsynchronousTerminationSupport())
     1277    if (Options::alwaysCheckTraps() || vm()->watchdog() || vm()->needAsynchronousTerminationSupport())
    12781278        emitOpcode(op_check_traps);
    12791279}
  • trunk/Source/JavaScriptCore/dfg/DFGClobberize.h

    r213107 r213302  
    435435        return;
    436436
     437    case CheckTraps:
     438        if (Options::usePollingTraps()) {
     439            read(InternalState);
     440            write(InternalState);
     441        } else
     442            write(Watchpoint_fire);
     443        return;
     444
    437445    case InvalidationPoint:
    438446        write(SideState);
     
    14121420       
    14131421    case CountExecution:
    1414     case CheckTraps:
    14151422        read(InternalState);
    14161423        write(InternalState);
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r213107 r213302  
    18991899void SpeculativeJIT::compileCheckTraps(Node*)
    19001900{
     1901    ASSERT(Options::usePollingTraps());
    19011902    GPRTemporary unused(this);
    19021903    GPRReg unusedGPR = unused.gpr();
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp

    r213107 r213302  
    55455545
    55465546    case CheckTraps:
    5547         compileCheckTraps(node);
     5547        if (Options::usePollingTraps())
     5548            compileCheckTraps(node);
     5549        else
     5550            noResult(node); // This is a no-op.
    55485551        break;
    55495552
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp

    r213107 r213302  
    53295329
    53305330    case CheckTraps:
    5331         compileCheckTraps(node);
     5331        if (Options::usePollingTraps())
     5332            compileCheckTraps(node);
     5333        else
     5334            noResult(node); // This is a no-op.
    53325335        break;
    53335336
  • trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

    r213233 r213302  
    10241024            break;
    10251025        case CheckTraps:
    1026             compileCheckTraps();
     1026            if (Options::usePollingTraps())
     1027                compileCheckTraps();
    10271028            break;
    10281029        case CreateRest:
     
    89878988    void compileCheckTraps()
    89888989    {
     8990        ASSERT(Options::usePollingTraps());
    89898991        LBasicBlock needTrapHandling = m_out.newBlock();
    89908992        LBasicBlock continuation = m_out.newBlock();
  • trunk/Source/JavaScriptCore/runtime/Options.h

    r213209 r213302  
    407407    \
    408408    v(unsigned, watchdog, 0, Normal, "watchdog timeout (0 = Disabled, N = a timeout period of N milliseconds)") \
     409    v(bool, alwaysCheckTraps, false, Normal, "always emit op_check_traps bytecode") \
     410    v(bool, usePollingTraps, false, Normal, "use polling (instead of signalling) VM traps") \
    409411    \
    410412    v(bool, useICStats, false, Normal, nullptr) \
  • trunk/Source/JavaScriptCore/runtime/VM.cpp

    r213295 r213302  
    463463{
    464464    if (!m_watchdog) {
     465        Options::usePollingTraps() = true; // Force polling traps on until we have support for signal based traps.
     466
    465467        m_watchdog = adoptRef(new Watchdog(this));
    466468       
     
    974976}
    975977
     978void VM::setNeedAsynchronousTerminationSupport()
     979{
     980    Options::usePollingTraps() = true; // Force polling traps on until we have support for signal based traps.
     981    m_needAsynchronousTerminationSupport = true;
     982}
     983
    976984} // namespace JSC
  • trunk/Source/JavaScriptCore/runtime/VM.h

    r213295 r213302  
    681681
    682682    bool needAsynchronousTerminationSupport() const { return m_needAsynchronousTerminationSupport; }
    683     void setNeedAsynchronousTerminationSupport() { m_needAsynchronousTerminationSupport = true; }
     683    JS_EXPORT_PRIVATE void setNeedAsynchronousTerminationSupport();
    684684
    685685private:
Note: See TracChangeset for help on using the changeset viewer.