<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Implement all the arithmetic and logical instructions in WebAssembly"
   href="https://bugs.webkit.org/show_bug.cgi?id=148882#c5">Comment # 5</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Implement all the arithmetic and logical instructions in WebAssembly"
   href="https://bugs.webkit.org/show_bug.cgi?id=148882">bug 148882</a>
              from <span class="vcard"><a class="email" href="mailto:mark.lam&#64;apple.com" title="Mark Lam &lt;mark.lam&#64;apple.com&gt;"> <span class="fn">Mark Lam</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=148882#c4">comment #4</a>)
<span class="quote">&gt; (In reply to <a href="show_bug.cgi?id=148882#c3">comment #3</a>)
&gt; &gt; Comment on <span class=""><a href="attachment.cgi?id=260730&amp;action=diff" name="attach_260730" title="Patch">attachment 260730</a> <a href="attachment.cgi?id=260730&amp;action=edit" title="Patch">[details]</a></span>
&gt; &gt; Patch
&gt; &gt; 
&gt; &gt; View in context:
&gt; &gt; <a href="https://bugs.webkit.org/attachment.cgi?id=260730&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=260730&amp;action=review</a>
&gt; &gt; 
&gt; &gt; r=me
&gt; &gt; 
&gt; &gt; &gt; Source/JavaScriptCore/tests/stress/wasm-arithmetic.js:45
&gt; &gt; &gt; +        return (6 * 7) | 0;
&gt; &gt; 
&gt; &gt; What's stopping the WASM compiler from just constant folding this operation
&gt; &gt; and just returning a constant (thereby defeating this test)?  Why not pass
&gt; &gt; the values into the test functions as arguments?  Unless there's a reason to
&gt; &gt; not do so, please pass the args in to the test instead.  I'm fine with doing
&gt; &gt; a follow up patch to update all the tests to do this.
&gt; 
&gt; pack-asmjs does not do constant folding. (I don't think they will ever do
&gt; it. Optimization of asm.js should be done by Emscripten's.) But I will do it
&gt; to be future-proof. It should also make the code easier to read.</span >

OK.  Let's do this in a separate patch since there are other tests (than the ones in this patch) that would benefit from this refactoring as well.

<span class="quote">&gt; &gt; &gt; Source/JavaScriptCore/tests/stress/wasm-arithmetic.js:192
&gt; &gt; &gt; +shouldBe(module.multiplyOverflow(), -2147483648);
&gt; &gt; 
&gt; &gt; What does it mean to multiplyOverflow?  Does WASM require that we overflow
&gt; &gt; silently?
&gt; 
&gt; multiplyOverflow = the result from multiplication is larger than INT32_MAX.
&gt; The WASM spec says &quot;Sign-agnostic operations silently wrap overflowing
&gt; results into the result type.&quot; It also says that multiplication on 32-bit
&gt; integers is a sign-agnostic operation.
&gt; &lt;<a href="https://github.com/WebAssembly/design/blob/master/AstSemantics.md">https://github.com/WebAssembly/design/blob/master/AstSemantics.md</a>&gt;</span >

OK.</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>