1439
V8: Behind the Scenes (December Edition) | Benedikt Meurer
It contains two functions f and g, the latter being exported and callable by regular JavaScript code, i.e. g is an entrypoint to the asm.js module. g doesn’t do much but calls f with whatever input you pass to g converted to a Number. According to the asm.js type annotations, f has type double -> double, but this information is only usable as long as the asm.js module validates, i.e. passes the type checks in the asm.js specification. The asm-wasm-builder does the necessary validation and is thus able to generate code that leverages this type information without having to perform type checks at runtime (type checks are still necessary on the boundary to JavaScript obviously). In this concrete example, the asm-wasm-builder knows after validation that f is only used internally in the asm.js module (i.e. it’s not exported to JavaScript) and all call sites pass a double and expect a double as result. For example, let’s run the module above through the new WebAssembly pipeline:
4 weeks ago
« earlier      
articles books buy career code cooking courses design diy fashion finance fitness health hikes humanities interesting interior investing jobs lel life lists livestreams management math ml movies papers physics pl pwetty recipes screencasts security self-improvement startups talks traveling tunes visualization

Copy this bookmark:



description:


tags: