3 ms·
Compiling JS to WASM has the same problems as just compiling JS to normal assembly ahead of time: It's just too dynamic. The thing which you can compile ahead
by Matthias247 9y ago
Compiling JS to WASM has the same problems as just compiling JS to normal assembly ahead of time: It's just too dynamic.
The thing which you can compile ahead of time is an interpreter, which then checks during runtime what the actual types are and what needs to be done. You can run such an interpreter in WASM, but that will be a lot slower than what the current JS engines are able to do with Just In Time compilation.
I don't know whether it's possible to implement a JIT compiler in WASM (and thereby dynamically output and execute WASM), but running a JIT-in-WASM on top of a native-JIT (the JS engine) sounds not really desirable.
- sbarre 9y agoThank you for explaining!