Title: [233378] trunk/Source/_javascript_Core
Revision
233378
Author
sbar...@apple.com
Date
2018-06-29 17:05:36 -0700 (Fri, 29 Jun 2018)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (233377 => 233378)


--- trunk/Source/_javascript_Core/ChangeLog	2018-06-29 23:40:25 UTC (rev 233377)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-06-30 00:05:36 UTC (rev 233378)
@@ -1,5 +1,29 @@
 2018-06-29  Saam Barati  <sbar...@apple.com>
 
+        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):
+
+2018-06-29  Saam Barati  <sbar...@apple.com>
+
         We shouldn't recurse into the parser when gathering metadata about various function offsets
         https://bugs.webkit.org/show_bug.cgi?id=184074
         <rdar://problem/37165897>

Modified: trunk/Source/_javascript_Core/runtime/Options.h (233377 => 233378)


--- trunk/Source/_javascript_Core/runtime/Options.h	2018-06-29 23:40:25 UTC (rev 233377)
+++ trunk/Source/_javascript_Core/runtime/Options.h	2018-06-30 00:05:36 UTC (rev 233378)
@@ -512,7 +512,8 @@
     v(bool, useIntlPluralRules, enableIntlPluralRules, Normal, "If true, we will enable Intl.PluralRules.") \
     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.") \
     v(bool, forcePolyProto, false, Normal, "If true, create_this will always create an object with a poly proto structure.") \
-    v(bool, forceMiniVMMode, false, Normal, "If true, it will force mini VM mode on.")
+    v(bool, forceMiniVMMode, false, Normal, "If true, it will force mini VM mode on.") \
+    v(bool, useTracePoints, false, Normal, nullptr)
 
 
 enum OptionEquivalence {

Modified: trunk/Source/_javascript_Core/runtime/VMEntryScope.cpp (233377 => 233378)


--- trunk/Source/_javascript_Core/runtime/VMEntryScope.cpp	2018-06-29 23:40:25 UTC (rev 233377)
+++ trunk/Source/_javascript_Core/runtime/VMEntryScope.cpp	2018-06-30 00:05:36 UTC (rev 233378)
@@ -57,7 +57,8 @@
         if (SamplingProfiler* samplingProfiler = vm.samplingProfiler())
             samplingProfiler->noticeVMEntry();
 #endif
-        tracePoint(VMEntryScopeStart);
+        if (Options::useTracePoints())
+            tracePoint(VMEntryScopeStart);
     }
 
     vm.clearLastException();
@@ -73,7 +74,8 @@
     if (m_vm.entryScope != this)
         return;
 
-    tracePoint(VMEntryScopeEnd);
+    if (Options::useTracePoints())
+        tracePoint(VMEntryScopeEnd);
     
     if (m_vm.watchdog())
         m_vm.watchdog()->exitedVM();

Modified: trunk/Source/_javascript_Core/wasm/WasmBBQPlan.cpp (233377 => 233378)


--- trunk/Source/_javascript_Core/wasm/WasmBBQPlan.cpp	2018-06-29 23:40:25 UTC (rev 233377)
+++ trunk/Source/_javascript_Core/wasm/WasmBBQPlan.cpp	2018-06-30 00:05:36 UTC (rev 233378)
@@ -235,7 +235,9 @@
     if (!hasWork())
         return;
 
-    TraceScope traceScope(WebAssemblyCompileStart, WebAssemblyCompileEnd);
+    std::optional<TraceScope> traceScope;
+    if (Options::useTracePoints())
+        traceScope.emplace(WebAssemblyCompileStart, WebAssemblyCompileEnd);
     ThreadCountHolder holder(*this);
 
     size_t bytesCompiled = 0;

Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyFunction.cpp (233377 => 233378)


--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyFunction.cpp	2018-06-29 23:40:25 UTC (rev 233377)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyFunction.cpp	2018-06-30 00:05:36 UTC (rev 233378)
@@ -79,7 +79,9 @@
         }
     }
 
-    TraceScope traceScope(WebAssemblyExecuteStart, WebAssemblyExecuteEnd);
+    std::optional<TraceScope> traceScope;
+    if (Options::useTracePoints())
+        traceScope.emplace(WebAssemblyExecuteStart, WebAssemblyExecuteEnd);
 
     Vector<JSValue> boxedArgs;
     JSWebAssemblyInstance* instance = wasmFunction->instance();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to