In this article on WebAssembly, it says:
...we have to talk about one more thing: stack machines. Although the browser compiles it to something more efficient...
Wondering how the browser makes a stack machine more efficient, what sort of techniques does it use.
It compiles it into the use of registers.
One way to think about Wasm's operand stack is that it is simply an (infinite) set of virtual registers. But instead of referencing these registers explicitly, each instruction implicitly references certain slots from the stack. But thanks to type checking and validation, the compiler always statically knows the number and types of values on the stack at any point in the program.
Hence the generated code never needs to materialise the stack, but can straightforwardly assign every stack slot, i.e. every virtual register, to a real hardware register (or spill them over to the hardware stack in the usual manner when register allocation runs out of registers).
The only reason Wasm is a stack machine and not a register machine is code compactness. It is a particularly compact way to describe register use.