Changeset 233378 in webkit


Ignore:
Timestamp:
Jun 29, 2018 5:05:36 PM (6 years ago)
Author:
sbarati@apple.com
Message:

Don't use tracePoints in JS/Wasm entry
https://bugs.webkit.org/show_bug.cgi?id=187196

Reviewed by Mark Lam.

This puts VM entry and Wasm entry tracePoints behind a runtime
option. This is a ~4x speedup on a soon to be released Wasm
benchmark. tracePoints should basically never run more than 50
times a second. Entering the VM and entering Wasm are user controlled,
and can happen hundreds of thousands of times in a second. Depending
on how the Wasm/JS code is structured, this can be disastrous for
performance.

  • runtime/Options.h:
  • runtime/VMEntryScope.cpp:

(JSC::VMEntryScope::VMEntryScope):
(JSC::VMEntryScope::~VMEntryScope):

  • wasm/WasmBBQPlan.cpp:

(JSC::Wasm::BBQPlan::compileFunctions):

  • wasm/js/WebAssemblyFunction.cpp:

(JSC::callWebAssemblyFunction):

Location:
trunk/Source/JavaScriptCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r233377 r233378  
     12018-06-29  Saam Barati  <sbarati@apple.com>
     2
     3        Don't use tracePoints in JS/Wasm entry
     4        https://bugs.webkit.org/show_bug.cgi?id=187196
     5
     6        Reviewed by Mark Lam.
     7
     8        This puts VM entry and Wasm entry tracePoints behind a runtime
     9        option. This is a ~4x speedup on a soon to be released Wasm
     10        benchmark. tracePoints should basically never run more than 50
     11        times a second. Entering the VM and entering Wasm are user controlled,
     12        and can happen hundreds of thousands of times in a second. Depending
     13        on how the Wasm/JS code is structured, this can be disastrous for
     14        performance.
     15
     16        * runtime/Options.h:
     17        * runtime/VMEntryScope.cpp:
     18        (JSC::VMEntryScope::VMEntryScope):
     19        (JSC::VMEntryScope::~VMEntryScope):
     20        * wasm/WasmBBQPlan.cpp:
     21        (JSC::Wasm::BBQPlan::compileFunctions):
     22        * wasm/js/WebAssemblyFunction.cpp:
     23        (JSC::callWebAssemblyFunction):
     24
    1252018-06-29  Saam Barati  <sbarati@apple.com>
    226
  • trunk/Source/JavaScriptCore/runtime/Options.h

    r232526 r233378  
    513513    v(bool, useArrayAllocationProfiling, true, Normal, "If true, we will use our normal array allocation profiling. If false, the allocation profile will always claim to be undecided.") \
    514514    v(bool, forcePolyProto, false, Normal, "If true, create_this will always create an object with a poly proto structure.") \
    515     v(bool, forceMiniVMMode, false, Normal, "If true, it will force mini VM mode on.")
     515    v(bool, forceMiniVMMode, false, Normal, "If true, it will force mini VM mode on.") \
     516    v(bool, useTracePoints, false, Normal, nullptr)
    516517
    517518
  • trunk/Source/JavaScriptCore/runtime/VMEntryScope.cpp

    r232490 r233378  
    5858            samplingProfiler->noticeVMEntry();
    5959#endif
    60         tracePoint(VMEntryScopeStart);
     60        if (Options::useTracePoints())
     61            tracePoint(VMEntryScopeStart);
    6162    }
    6263
     
    7475        return;
    7576
    76     tracePoint(VMEntryScopeEnd);
     77    if (Options::useTracePoints())
     78        tracePoint(VMEntryScopeEnd);
    7779   
    7880    if (m_vm.watchdog())
  • trunk/Source/JavaScriptCore/wasm/WasmBBQPlan.cpp

    r230748 r233378  
    236236        return;
    237237
    238     TraceScope traceScope(WebAssemblyCompileStart, WebAssemblyCompileEnd);
     238    std::optional<TraceScope> traceScope;
     239    if (Options::useTracePoints())
     240        traceScope.emplace(WebAssemblyCompileStart, WebAssemblyCompileEnd);
    239241    ThreadCountHolder holder(*this);
    240242
  • trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp

    r231839 r233378  
    8080    }
    8181
    82     TraceScope traceScope(WebAssemblyExecuteStart, WebAssemblyExecuteEnd);
     82    std::optional<TraceScope> traceScope;
     83    if (Options::useTracePoints())
     84        traceScope.emplace(WebAssemblyExecuteStart, WebAssemblyExecuteEnd);
    8385
    8486    Vector<JSValue> boxedArgs;
Note: See TracChangeset for help on using the changeset viewer.