<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#c4">Comment # 4</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:sukolsak@gmail.com" title="Sukolsak Sakshuwong <sukolsak@gmail.com>"> <span class="fn">Sukolsak Sakshuwong</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=148882#c3">comment #3</a>)
<span class="quote">> Comment on <span class=""><a href="attachment.cgi?id=260730&action=diff" name="attach_260730" title="Patch">attachment 260730</a> <a href="attachment.cgi?id=260730&action=edit" title="Patch">[details]</a></span>
> Patch
>
> View in context:
> <a href="https://bugs.webkit.org/attachment.cgi?id=260730&action=review">https://bugs.webkit.org/attachment.cgi?id=260730&action=review</a>
>
> r=me
>
> > Source/JavaScriptCore/tests/stress/wasm-arithmetic.js:45
> > + return (6 * 7) | 0;
>
> What's stopping the WASM compiler from just constant folding this operation
> and just returning a constant (thereby defeating this test)? Why not pass
> the values into the test functions as arguments? Unless there's a reason to
> not do so, please pass the args in to the test instead. I'm fine with doing
> a follow up patch to update all the tests to do this.</span >
pack-asmjs does not do constant folding. (I don't think they will ever do it. Optimization of asm.js should be done by Emscripten's.) But I will do it to be future-proof. It should also make the code easier to read.
<span class="quote">> > Source/JavaScriptCore/tests/stress/wasm-arithmetic.js:192
> > +shouldBe(module.multiplyOverflow(), -2147483648);
>
> What does it mean to multiplyOverflow? Does WASM require that we overflow
> silently?</span >
multiplyOverflow = the result from multiplication is larger than INT32_MAX. The WASM spec says "Sign-agnostic operations silently wrap overflowing results into the result type." It also says that multiplication on 32-bit integers is a sign-agnostic operation. <<a href="https://github.com/WebAssembly/design/blob/master/AstSemantics.md">https://github.com/WebAssembly/design/blob/master/AstSemantics.md</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>