<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>166486</bug_id>
          
          <creation_ts>2016-12-26 16:51:05 -0800</creation_ts>
          <short_desc>WebAssembly -&gt; JS: don&apos;t do a double entry</short_desc>
          <delta_ts>2017-01-02 17:31:45 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>165282</dependson>
          <blocked>161709</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="JF Bastien">jfbastien</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>jfbastien</cc>
    
    <cc>keith_miller</cc>
    
    <cc>saam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1262781</commentid>
    <comment_count>0</comment_count>
    <who name="JF Bastien">jfbastien</who>
    <bug_when>2016-12-26 16:51:05 -0800</bug_when>
    <thetext>We have createJSToWasmWrapper as well as WebAssemblyFunction::call. We should merge the two, probably to B3 code or MacroAssembler code.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1262782</commentid>
    <comment_count>1</comment_count>
    <who name="JF Bastien">jfbastien</who>
    <bug_when>2016-12-26 16:52:01 -0800</bug_when>
    <thetext>Let&apos;s also figure out what vmEntryToWasm should be.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1263371</commentid>
    <comment_count>2</comment_count>
    <who name="JF Bastien">jfbastien</who>
    <bug_when>2017-01-02 17:31:45 -0800</bug_when>
    <thetext>We should also consider optimizing as discussed here:

&gt; &gt; &gt; &gt; Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp:90
&gt; &gt; &gt; &gt; +        // Always start with a dummy Memory, so that wasm -&gt; wasm thunks avoid checking for a nullptr Memory when trying to set pinned registers.
&gt; &gt; &gt; &gt; +        Wasm::Memory memory;
&gt; &gt; &gt; &gt; +        instance-&gt;setMemory(vm, JSWebAssemblyMemory::create(vm, exec-&gt;lexicalGlobalObject()-&gt;WebAssemblyMemoryStructure(), WTFMove(memory)));
&gt; &gt; &gt; 
&gt; &gt; &gt; This makes me wonder if we&apos;re better off just having the callee instead of
&gt; &gt; &gt; caller generate a wasm-&gt;wasm call thunk. Maybe we should do that in a later
&gt; &gt; &gt; patch, or at least have a bug open to consider it.
&gt; &gt; 
&gt; &gt; Yeah I guess we could have an off-to-the-side entrypeint from &quot;other wasm&quot;,
&gt; &gt; in addition to the regular &quot;entry from this wasm instance&quot;, for all of the
&gt; &gt; exported functions. We&apos;d need to also change the callee codegen, but then we
&gt; &gt; wouldn&apos;t need to tail (or rather, we&apos;d inline that tail).
&gt; &gt; 
&gt; &gt; That could be more efficient.
&gt; Yeah, let&apos;s open a bug and deal with it later.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>