summaryrefslogtreecommitdiff
path: root/test/wasm2js/loop.2asm.js
Commit message (Collapse)AuthorAgeFilesLines
* Stop emitting "almost asm" in wasm2js output (#2221)Alon Zakai2019-07-121-1/+0
| | | We don't ever emit "use asm" anymore, so this similar annotation is not really useful, it just increases size.
* wasm2js: Switch optimizations (#2141)Alon Zakai2019-05-281-10/+6
| | | | | This pattern-matches towers of blocks + a br_table into a JS switch. This is much smaller in code size and also avoids heavy nesting that can exceed the recursion limits of JS parsers. This is not enough yet, because it pattern-matches very specifically. In reality, switches can look slightly different. Followup PRs will extend this. For now, this passes the test suite (what passed before - not including the massive-switch tests) + fuzzing so it's a good start.
* wasm2js: optimize away unneeded load coercions (#2107)Alon Zakai2019-05-151-0/+1
|
* wasm2js: optimize loads (#2085)Alon Zakai2019-05-031-1/+0
| | | | When loading a boolean, prefer the signed heap (which is more commonly used, and may be faster). We never use HEAPU32 (HEAP32 is always enough), just remove it.
* wasm2js: avoid some slow operations when not optimizing (#2082)Alon Zakai2019-05-031-56/+222
| | | Without this PR, wasm2js0.test_printf in emscripten took an extremely long time to compile.
* wasm2js: don't emit obviously unnecessary parens (#2080)Alon Zakai2019-05-021-56/+28
| | | A minifier would probably remove them later anyhow, but they make reading the code annoying and hard.
* wasm2js: don't run coalesce-locals if not optimizing (#2076)Alon Zakai2019-05-011-179/+243
| | | That pass is very slow on unoptimized code (super-linear on the number of locals, which if unoptimized can be massive due to flatten).
* wasm2js: run more optimizations (#2073)Alon Zakai2019-05-011-292/+187
| | | In particular, coalesce-locals is useful even if closure is run later (apparently it finds stuff closure can't).
* wasm2js: run full optimizations during the pipeline (#2071)Alon Zakai2019-04-301-67/+80
| | | | | We flatten for the i64 lowering etc. passes, and it is worth optimizing afterwards, to clean up stuff they created. That is run if the user ran wasm2js with an optimization level (like wasm2js -O3). Split the test files to check both optimized and unoptimized code.
* wasm2js: optimize switches (#2067)Alon Zakai2019-04-301-4/+0
| | | | | | | | | | Don't emit unneeded breaks in switch cases, instead do case X: case Y: .. case W: break .. for each group. Also, the group with the default doesn't need any cases but the default itself.
* wasm2js: remove unneeded break/continue labels (#2058)Alon Zakai2019-04-261-5/+5
|
* wasm2js: optimize loops and eqz (#2051)Alon Zakai2019-04-251-25/+14
|
* Remove f32 legalization from LegalizeJSInterface (#2052)Sam Clegg2019-04-251-5/+1
| | | | | As well as i64 splitting this pass was also converting f32 to f64 at the wasm boundry. However it appears this is not actually useful and makes somethings (such as dynamic linking) harder.
* wasm2js: more js optimization (#2050)Alon Zakai2019-04-241-29/+14
| | | | | | * Emit ints as signed, so -1 isn't a big unsigned number. * x - -c (where c is a constant) is larger than x + c in js (but not wasm) * +(+x) => +x * Avoid unnecessary coercions on calls, return, load, etc. - we just need coercions when entering or exiting "wasm" (not internally), and on actual operations that need them.
* wasm2js: start to optionally optimize the JS (#2046)Alon Zakai2019-04-241-54/+54
| | | Removes redundant | 0s and similar things. (Apparently closure compiler doesn't do that, so makes sense to do here.)
* wasm2js: emit quoted properties for the exports, to support closure compiler ↵Alon Zakai2019-04-231-18/+18
| | | | (#2043)
* wasm2js: avoid non-ES5 stuff like "let" (#2041)Alon Zakai2019-04-231-20/+20
| | | Also fix the fuzzer's handling of feature flags so that wasm2js can work.
* wasm2js: remove more code we don't need since we have flat IR (#2039)Alon Zakai2019-04-221-227/+83
| | | Also run remove-unused-names which became more noticeably necessary after this change.
* wasm2js: get rid of some non-flat code assumptions (#2036)Alon Zakai2019-04-221-2/+1
| | | We run flatten there, which lets us simplify things a lot. Turns out that for assertions we didn't run it, which is why we still needed the old non-flat code paths. This adds flatten there and removes that old code and assumptions.
* wasm2js: unreachability fixes (#2037)Alon Zakai2019-04-221-5/+3
| | | Also test in pass-debug mode, for better coverage.
* wasm2js2 import fixes (#2031)Alon Zakai2019-04-191-4/+118
| | | | | | * Don't assume function types exist in legalize-js-interface. * Properly handle (ignore) imports in RemoveNonJSOps - do not try to recurse into them. * Run legalize-js-interface and remove-unused-module-elements in wasm2js, the first is necessary, the last is nice to have.
* wasm2js: do not try to be smart with not emitting if braces, the corner ↵Alon Zakai2019-04-181-20/+48
| | | | | cases are tricky (#2026) leave them for later optimizers/minifiers
* wasm2js: remove "use asm", we are not asm.js anymore (#2020)Alon Zakai2019-04-181-1/+1
| | | Also emit the memory growth code based on memory growth, and not whether we are "use asm" or not.
* Fix if else JS printing when if body is a labelled block (#2017)Alon Zakai2019-04-171-17/+17
| | | | | | | | | | | | Before, we'd print if (..) label: { .. }; else .. But that is wrong, as it ends the if too early. After this, we print if (..) label: { .. } else .. The bug was we checked if the if body was a block, but not if it was a labelled block.
* Use a single table in wasm2js (#2005)Alon Zakai2019-04-151-0/+1
| | | | | This replaces the multiple asm.js tables (of power-of-2 size) with a single simple table. Also supports importing the table.
* Wasm2js refactoring (#1997)Alon Zakai2019-04-111-0/+1
| | | | | | | | | | | | | Early work for #1929 * Leave core wasm module - the "asm.js function" - to Wasm2JSBuilder, and add Wasm2JSGlue which emits the code before and after that. Currently that's some ES6 code, but we may want to change that later. * Add add AssertionEmitter class for the sole purpose of emitting modules + assertions for testing. This avoids some hacks from before like starting from index 1 (assuming the module at first position was already parsed and printed) and printing of the f32Equal etc. functions not at the very top (which was due to technical limitations before). Logic-wise, there should be no visible change, except some whitespace and reodering, and that I made the exceptions print out the source of the assertion that failed from the wast: -if (!check2()) fail2(); +if (!check2()) throw 'assertion failed: ( assert_return ( call add ( i32.const 1 ) ( i32.const 1 ) ) ( i32.const 2 ) )'; (fail2 etc. did not exist, and seems to just have given a unique number for each assertion?)
* Optimize away sets of the same local (#1940)Alon Zakai2019-03-071-38/+8
|
* Optimize added constants with propagation only if we see we will remove all ↵Alon Zakai2019-03-061-3/+3
| | | | uses of the original add, as otherwise we may just be adding work (both an offset, and an add). Refactor local-utils.h, and make UnneededSetRemover also check for side effects, so it cleanly removes all traces of unneeded sets.
* Rename `wasm2asm` to `wasm2js`, emit ESM by default (#1642)Alex Crichton2018-08-301-0/+639
* Rename the `wasm2asm` tool to `wasm2js` This commit performs a relatively simple rename of the `wasm2asm` tool to `wasm2js`. The functionality of the tool doesn't change just yet but it's intended that we'll start generating an ES module instead of just an `asm.js` function soon. * wasm2js: Support `*.wasm` input files Previously `wasm2js` only supported `*.wast` files but to make it a bit easier to use in tooling pipelines this commit adds support for reading in a `*.wasm` file directly. Determining which parser to use depends on the input filename, where the binary parser is used with `*.wasm` files and the wast parser is used for all other files. * wasm2js: Emit ESM imports/exports by default This commit alters the default behavior of `wasm2js` to emit an ESM by default, either importing items from the environment or exporting. Items like initialization of memory are also handled here.