Title: [235778] trunk/Source/_javascript_Core
Revision
235778
Author
[email protected]
Date
2018-09-06 21:40:12 -0700 (Thu, 06 Sep 2018)

Log Message

[WebAssembly] Optimize JS to Wasm call by removing Vector allocation
https://bugs.webkit.org/show_bug.cgi?id=189353

Reviewed by Mark Lam.

JS to Wasm call always allocates Vector for the arguments. This is really costly if the wasm function is small.
This patch adds an initial size parameter to the Vector to avoid allocations for small sized arguments.

* runtime/ArgList.h:
* wasm/js/WebAssemblyFunction.cpp:
(JSC::callWebAssemblyFunction):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (235777 => 235778)


--- trunk/Source/_javascript_Core/ChangeLog	2018-09-07 04:24:38 UTC (rev 235777)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-09-07 04:40:12 UTC (rev 235778)
@@ -1,3 +1,17 @@
+2018-09-06  Yusuke Suzuki  <[email protected]>
+
+        [WebAssembly] Optimize JS to Wasm call by removing Vector allocation
+        https://bugs.webkit.org/show_bug.cgi?id=189353
+
+        Reviewed by Mark Lam.
+
+        JS to Wasm call always allocates Vector for the arguments. This is really costly if the wasm function is small.
+        This patch adds an initial size parameter to the Vector to avoid allocations for small sized arguments.
+
+        * runtime/ArgList.h:
+        * wasm/js/WebAssemblyFunction.cpp:
+        (JSC::callWebAssemblyFunction):
+
 2018-08-31  Yusuke Suzuki  <[email protected]>
 
         [JSC] Clean up StructureStubClearingWatchpoint

Modified: trunk/Source/_javascript_Core/runtime/ArgList.h (235777 => 235778)


--- trunk/Source/_javascript_Core/runtime/ArgList.h	2018-09-07 04:24:38 UTC (rev 235777)
+++ trunk/Source/_javascript_Core/runtime/ArgList.h	2018-09-07 04:40:12 UTC (rev 235778)
@@ -34,12 +34,11 @@
     friend class VM;
     friend class ArgList;
 
-private:
+public:
     using Base = RecordOverflow;
     static const size_t inlineCapacity = 8;
     typedef HashSet<MarkedArgumentBuffer*> ListSet;
 
-public:
     // Constructor for a read-write list, to which you may append values.
     // FIXME: Remove all clients of this API, then remove this API.
     MarkedArgumentBuffer()

Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyFunction.cpp (235777 => 235778)


--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyFunction.cpp	2018-09-07 04:24:38 UTC (rev 235777)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyFunction.cpp	2018-09-07 04:40:12 UTC (rev 235778)
@@ -83,7 +83,7 @@
     if (Options::useTracePoints())
         traceScope.emplace(WebAssemblyExecuteStart, WebAssemblyExecuteEnd);
 
-    Vector<JSValue> boxedArgs;
+    Vector<JSValue, MarkedArgumentBuffer::inlineCapacity> boxedArgs;
     JSWebAssemblyInstance* instance = wasmFunction->instance();
     Wasm::Instance* wasmInstance = &instance->instance();
     // When we don't use fast TLS to store the context, the JS
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to