summaryrefslogtreecommitdiff
path: root/src/wasm/literal.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Update v128.const text formats (#1934)Thomas Lively2019-03-191-1/+1
| | | | | Parse the formats allowed by the spec proposal and emit the i32x4 canonical format.
* Align v128 text format with WABT (#1930)Daniel Wirtz2019-03-041-3/+8
| | | | | | | | This PR changes the formatting of v128.const literals in text format / stack ir like so - v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x80 + v128.const i32 0x04030201 0x08070605 0x0c0b0a09 0x800f0e0d Recently hit this when trying to load Binaryen generated text format with WABT, which errored with `error: unexpected token 0x5, expected ).
* NaN fuzzing improvements (#1913)Alon Zakai2019-02-191-0/+11
| | | | | | | | | * make DE_NAN avoid creating nan literals in the first place * add a reducer option `--denan` to not introduce nans in destructive reduction * add a `Literal::isNaN()` method * also remove the default exception logging from the fuzzer js glue, which is a source of non-useful VM differences (like nan nondeterminism) * added an option `--no-fuzz-nans` to make it easy to avoid nans when fuzzing (without hacking the source and recompiling). Background: trying to get fuzzing on jsc working despite this open issue: https://bugs.webkit.org/show_bug.cgi?id=175691
* Rename `idx` to `index` in SIMD code for consistency (#1836)Thomas Lively2018-12-181-28/+28
|
* SIMD (#1820)Thomas Lively2018-12-131-8/+676
| | | | | | | | | Implement and test the following functionality for SIMD. - Parsing and printing - Assembling and disassembling - Interpretation - C API - JS API
* Update wrap and demote literal op names (#1817)Thomas Lively2018-12-121-11/+6
| | | | | | * Update literal op names * Remove `demoteToF32` in favor of `demote`
* Implement nontrapping float-to-int instructions (#1780)Thomas Lively2018-12-041-4/+83
|
* Add v128 type (#1777)Thomas Lively2018-11-291-0/+10
|
* Remove default cases (#1757)Thomas Lively2018-11-271-11/+28
| | | | | | Where reasonable from a readability perspective, remove default cases in switches over types and instructions. This makes future feature additions easier by making the compiler complain about each location where new types and instructions are not yet handled.
* Change the Literal class's operator== to be bitwise (#1661)Alon Zakai2018-09-011-14/+2
| | | | | The change means that nan values will be compared bitwise when writing A == B, and so the float rule of a nan is different from itself would not apply. I think this is a safer default. In particular this PR fixes a fuzz bug in the rse pass, which placed Literals in a hash table, and due to nan != nan, an infinite loop... Also, looks like we really want a bitwise comparison pretty much everywhere anyhow, as can be seen in the diff here. Really the single place we need a floaty comparison is in the intepreter where we implement f32.eq etc., and there the code was already using the proper code path anyhow.
* Print Stack IR in proper .wat format (#1630)Alon Zakai2018-08-141-2/+1
| | | This now makes --generate-stack-ir --print-stack-ir emit a fully valid .wat wasm file, in stacky format.
* Refactor interpreter (#1508)Alon Zakai2018-04-131-6/+50
| | | | | | * Move more logic to the Literal class. We now leave all the work to there, except for handling traps. * Avoid switching on the type, then the opcode, then Literal method usually switches on the type again - instead, do one big switch for the opcodes (then the Literal method is unchanged) which is shorter and clearer, and avoids that first switching.
* Some simple integer math opts (#1504)Alon Zakai2018-04-111-2/+2
| | | | | | | | | Stuff like x + 5 != 2 => x != -3. Also some cleanups of utility functions I noticed while writing this, isTypeFloat => isFloatType. Inspired by https://github.com/golang/go/blob/master/src/cmd/compile/internal/ssa/gen/generic.rules
* Rename WasmType => Type (#1398)Alon Zakai2018-02-021-137/+137
| | | | * rename WasmType to Type. it's in the wasm:: namespace anyhow, and without Wasm- it fits in better alongside Index, Address, Expression, Module, etc.
* precompute-propagate pass (#1179)Alon Zakai2017-09-121-0/+6
| | | | | | | Implements #1172: this adds a variant of precompute, "precompute-propagate", which also does constant propagation. Precompute by itself just runs the interpreter on each expression and sees if it is in fact a constant; precompute-propagate also looks at the graph of connections between get and set locals, and propagates those constant values. This helps with cases as noticed in #1168 - while in most cases LLVM will do this already, it's important when inlining, e.g. inlining of the clamping math functions. This new pass is run when inlining, and otherwise only in -O3/-Oz, as it does increase compilation time noticeably if run on everything (and for almost no benefit if LLVM has run). Most of the code here is just refactoring out from the ssa pass the get/set graph computation, so it can now be used by both the ssa pass and precompute-propagate.
* Const hoisting (#1176)Alon Zakai2017-09-121-3/+3
| | | A pass that hoists repeating constants to a local, and replaces their uses with a get of that local. This can reduce binary size, but can also *increase* gzip size, so it's mostly for experimentation and not used by default.
* Output inf/-inf rather than infinity/-infinitySam Clegg2017-06-091-1/+1
| | | | | wast2wasm wes recently updated to only support the former: https://github.com/WebAssembly/wabt/pull/482
* Wasm h to cpp (#926)jgravelle-google2017-03-101-0/+649
* Move WasmType function implementations to wasm.cpp * Move Literal methods to wasm.cpp * Reorder wasm.cpp shared constants back to top * Move expression functions to wasm.cpp * Finish moving things to wasm.cpp * Split out Literal into its own .h/.cpp. Also factor out common wasm-type module * Remove unneeded/transitive includes from wasm.h * Add comment to try/check methods * Rename tryX/checkX methods to getXOrNull * Add missing include that should fix appveyor build breakage * More appveyor