WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
148882
Implement all the arithmetic and logical instructions in WebAssembly
https://bugs.webkit.org/show_bug.cgi?id=148882
Summary
Implement all the arithmetic and logical instructions in WebAssembly
Sukolsak Sakshuwong
Reported
2015-09-04 21:50:23 PDT
Implement all the arithmetic and logical instructions for WebAssembly files generated by pack-asmjs <
https://github.com/WebAssembly/polyfill-prototype-1
>.
Attachments
Patch
(13.98 KB, patch)
2015-09-04 21:59 PDT
,
Sukolsak Sakshuwong
no flags
Details
Formatted Diff
Diff
Patch
(14.10 KB, patch)
2015-09-07 00:10 PDT
,
Sukolsak Sakshuwong
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Sukolsak Sakshuwong
Comment 1
2015-09-04 21:59:27 PDT
Created
attachment 260675
[details]
Patch
Sukolsak Sakshuwong
Comment 2
2015-09-07 00:10:37 PDT
Created
attachment 260730
[details]
Patch
Mark Lam
Comment 3
2015-09-08 10:19:05 PDT
Comment on
attachment 260730
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=260730&action=review
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.
> 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?
Sukolsak Sakshuwong
Comment 4
2015-09-08 10:42:52 PDT
(In reply to
comment #3
)
> Comment on
attachment 260730
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=260730&action=review
> > 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.
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.
> > 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?
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. <
https://github.com/WebAssembly/design/blob/master/AstSemantics.md
>
Mark Lam
Comment 5
2015-09-08 10:45:38 PDT
(In reply to
comment #4
)
> (In reply to
comment #3
) > > Comment on
attachment 260730
[details]
> > Patch > > > > View in context: > >
https://bugs.webkit.org/attachment.cgi?id=260730&action=review
> > > > 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. > > 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.
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.
> > > 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? > > 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. > <
https://github.com/WebAssembly/design/blob/master/AstSemantics.md
>
OK.
WebKit Commit Bot
Comment 6
2015-09-08 11:34:31 PDT
Comment on
attachment 260730
[details]
Patch Clearing flags on attachment: 260730 Committed
r189499
: <
http://trac.webkit.org/changeset/189499
>
WebKit Commit Bot
Comment 7
2015-09-08 11:34:36 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug