summaryrefslogtreecommitdiff
path: root/test/wasm2js/br_table_temp.2asm.js.opt
Commit message (Collapse)AuthorAgeFilesLines
* Use hints when generating fresh labels in IRBuilder (#7086)Thomas Lively2024-11-181-10/+10
| | | | | | | | | | | | IRBuilder often has to generate new label names for blocks and other scopes. Previously it would generate each new name by starting with "block" or "label" and incrementing a suffix until finding a fresh name, but this made name generation quadratic in the number of names to generate. To spend less time generating names, track a hint index at which to start looking for a fresh name and increment it every time a name is generated. This speeds up a version of the binary parser that uses IRBuilder by about 15%.
* Use new wast parser in wasm2js (#6606)Thomas Lively2024-05-291-110/+110
| | | | When generating assertions, traverse the `WASTScript` data structure rather than interleaving assertion parsing with emitting.
* wasm2js: Stop emitting nan and infinity (#5391)Will Cohen2023-01-041-2/+0
| | | | | | | As noted in #4739, legacy language emitting nan and infinity exists, with the observation that it can be removed once asm.js is no longer used and global NaN is available. This commit removes that asm.js-specific code accordingly.
* wasm2js: Support for flexible module import naming (#5114)Sam Clegg2022-10-051-2/+1
| | | | | | | | The previous code was making emscripten-specific assumptions about imports basically all coming from the `env` module. I can't find a way to make this backwards compatible so may do a combined roll with the emscripten-side change: https://github.com/emscripten-core/emscripten/pull/17806
* wasm2js: Don't assume that `env.abort` can always be impored. (#5049)Sam Clegg2022-09-161-3/+2
| | | | | | This import was being injected and then used to implement trapping. Rather than injecting an import that doesn't exist in the original module we instead use the existing mechanism to implement this as an internal helper.
* wasm2js: Have instantiate function take standard import object (#5018)Sam Clegg2022-09-141-1/+2
| | | | | | | | | | | Previously we were assuming asmLibraryArg which is what emscripten passes as the `env` import object but using this method is more flexible and should allow wasm2js to work with import that are not all form a single object. The slight size increase here is just temporary until emscripten gets updated. See https://github.com/emscripten-core/emscripten/pull/17737
* CoalesceLocals: Use ValueNumbering (#4355)Alon Zakai2021-11-241-12/+9
| | | | | | | | | | | | This removes the old hardcoded value numbering in that pass and makes it use the new code that was split into helper code. The immediate benefit of this is to make the code aware of identical constants: if two locals have the same constant then they do not interfere. Future improvements to numbering will also automatically help here. This changes some constants in existing tests so that they keep testing what they were testing before, and adds new tests for the new benefit here. This implements a proposed TODO from #4314
* [wasm2js] Use native JavaScript Math.trunc (#3329)Max Graey2020-11-101-0/+1
|
* wasm2js: Remove global dict arguments to asmFunc (#3325)Sam Clegg2020-11-051-26/+13
|
* Optimize relations of subtractions and zero (#3275)Max Graey2020-10-251-3/+3
|
* wasm2js: Skip heap creation in the absence of wasm memory. NFC (#3167)Sam Clegg2020-09-241-11/+16
| | | | | Also, format the asmFunc call to make it more readable in the ES6 modules case.
* wasm2js: Support exported tables (#3152)Sam Clegg2020-09-211-1/+0
|
* wasm2js: Don't remove an | 0 or >>> 0 in a boolean context (#2993)Alon Zakai2020-07-281-1/+1
| | | | | | | | | | | | | It is usually fine to do if (x | 0) => if (x) since it just cares if the value is 0 or not. However, if the cast turns it into 0, then that is incorrect, which the fuzzer found as -2147483648 + -2147483648 | 0 (the sum is 2^32, which | 0 is 0). We can maybe look into doing this in a safe way, but for now just remove it. It doesn't have a big impact on code size as this is pretty rare (e.g. the minimal runtime code size test is not broken by this).
* wasm2js: Fix switch lowering, don't fall through after the hoisted parts (#2301)Alon Zakai2019-08-161-0/+3
| | | | | The switch lowering will "hoist" blocks of code into the JS switch when it can. If it can hoist some but not others, it must not fall through into those others (while it can fall through the hoisted ones - they began as nested blocks with falling-through between them). To fix this, after the hoisted ones issue a break out of the switch (which now contains all the hoisted code, so breaking out of it gets to the code right after the hoisted ones). fixes #2300
* 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-12401/+12356
| | | | | 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.
* Reflect instruction renaming in code (#2128)Heejin Ahn2019-05-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Reflected new renamed instruction names in code and tests: - `get_local` -> `local.get` - `set_local` -> `local.set` - `tee_local` -> `local.tee` - `get_global` -> `global.get` - `set_global` -> `global.set` - `current_memory` -> `memory.size` - `grow_memory` -> `memory.grow` - Removed APIs related to old instruction names in Binaryen.js and added APIs with new names if they are missing. - Renamed `typedef SortedVector LocalSet` to `SetsOfLocals` to prevent name clashes. - Resolved several TODO renaming items in wasm-binary.h: - `TableSwitch` -> `BrTable` - `I32ConvertI64` -> `I32WrapI64` - `I64STruncI32` -> `I64SExtendI32` - `I64UTruncI32` -> `I64UExtendI32` - `F32ConvertF64` -> `F32DemoteI64` - `F64ConvertF32` -> `F64PromoteF32` - Renamed `BinaryenGetFeatures` and `BinaryenSetFeatures` to `BinaryenModuleGetFeatures` and `BinaryenModuleSetFeatures` for consistency.
* wasm2js: more coercion optimization (#2109)Alon Zakai2019-05-151-1/+1
|
* wasm2js: optimize away unneeded load coercions (#2107)Alon Zakai2019-05-151-0/+1
|
* wasm2js: precompute bitwise operations (#2101)Alon Zakai2019-05-131-46/+46
| | | This happens on e.g. an i32 load of a constant offset, then we have constant >> 2.
* wasm2js: avoid reinterprets (#2094)Alon Zakai2019-05-101-61/+50
| | | | | In JS a reinterpret is especially expensive, as we implement it as a write to a temp buffer and a read using another view. This finds places where we load a value from memory, then reinterpret it later - in that case, we can load it using another view, at the cost of another load and another local. This is helpful on things like Box2D, where there are many reinterprets due to the main 2D vector class being an union over two floats/ints, and LLVM likes to do a single i64 load of them.
* 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: run more optimizations (#2073)Alon Zakai2019-05-011-6/+5
| | | 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-0/+12819
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.