<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Implement calls to JavaScript functions in WebAssembly"
   href="https://bugs.webkit.org/show_bug.cgi?id=149093#c3">Comment # 3</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Implement calls to JavaScript functions in WebAssembly"
   href="https://bugs.webkit.org/show_bug.cgi?id=149093">bug 149093</a>
              from <span class="vcard"><a class="email" href="mailto:utatane.tea&#64;gmail.com" title="Yusuke Suzuki &lt;utatane.tea&#64;gmail.com&gt;"> <span class="fn">Yusuke Suzuki</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=261064&amp;action=diff" name="attach_261064" title="Patch">attachment 261064</a> <a href="attachment.cgi?id=261064&amp;action=edit" title="Patch">[details]</a></span>
Patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=261064&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=261064&amp;action=review</a>

<span class="quote">&gt;&gt; Source/JavaScriptCore/wasm/WASMModuleParser.cpp:53
&gt;&gt; +    : m_exec(exec)
&gt; 
&gt; We should avoid doing this.  ExecState* really means a frame pointer, so it's only valid during execution, and using it here can cause three other problems:
&gt; 1) Impossible to make this code run concurrently.
&gt; 2) Too easy to introduce user-observable effects.  We usually only pass around ExecState* when we're in a context where it's OK to have user-observed effects.
&gt; 3) Too easy to make the parser impure - i.e. somehow dependent on the current state of the world.</span >

Currently, in asm.js[1] and our WebAssembly implementation, we use the simple object as the set of the exported names.
So to look up the property from it, we need ExecState*... (I don't think adding new method getOwnPropertySlot(VM&amp; ... ) to a lot of JSCell's derived class is good.)
But seeing the asm.js spec, it says that &quot;all property access must resolve to data properties;&quot;.
So getOwnPropertySlot does not cause any observable effect if we check the slot with `slot.isValue()` and retrieve the value.
What do you think of

1. Not storing ExecState* to the member field. It's transient value, so storing to the member is not good. Passing it as the parameter is better.
2. Using getOwnPropertySlot and ExecState* and writing the comment about &quot;The imported binding should be data property. We only retrieve the data property. So it does not cause any observable effect&quot;.
3. We should not use ExecState* except for getImportedValue.

And I believe this code will be replaced with the other one in the future, because

1. I believe that WebAssembly will be integrated into ES6 module loader. At that time, we don't use the object to link the functions. (currently, nothing about WebAssembly + Module is defined yet)
2. When the proxy is introduced, even `getOwnPropertySlot` becomes observable (Even [[HasProperty]] operation can throw errors!). So asm.js' linking semantics will be recasted. Or WebAssembly will replace  this semantics.

[1]: <a href="http://asmjs.org/spec/latest/">http://asmjs.org/spec/latest/</a></pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>