But how do you handle arguments or loop index variables? Your liveness is the entire function? You have to compile all the WASM chunks together in order to do any optimization? That seems ... problematic.

Edit: Yep. In article referenced from the original: http://troubles.md/posts/wasm-is-not-a-stack-machine/

Double edit: Some of this has already been fixed in WASM: https://github.com/WebAssembly/multi-value