Thanks for your comments everyone. I thought @throw worked that way. Gnusto has implemented it wrongly.
I've now more thoroughly tested it in Chrome and have pushed an update so that it works in Chrome, FF and IE. However I haven't tested every file in existence, and the test suites aren't comprehensive enough yet, so, if you use Parchment, I would appreciate you trying ZVM next time you use it.
Juhana, ifvms.js is a new way of writing JIT VMs, by using Abstract Syntax Trees. My plan is that there will be a common core, which ZVM and a future VM for Glulx and maybe even one for TADS would be built on top of. The big advantage is that an AST is much more manipulatable than the JIT systems of Gnusto and Quixe are, which just write out code to run. Instructions can easily be reordered, and structures like loops can be identified and converted into real JS loops, rather than a series of branches and jumps. Previously if you had a loop the JITer would have to stop before and after it, so that you would have three code sections. ifvms.js can compile a loop in place, with the code before and after it, and a JS loop in the middle which will run itself, rather than the VM framework telling it to run multiple times.
Here's an example of the code it generates, which has a while loop inside a block if statement. This would be close to impossible under Gnusto. It's not pretty code, but it's fast.
(But not fast enough. The .incdec() function needs to be inlined, and the push/pop can be optimised too.)
Code:
if(!(!(m.getUint16(2985)==1))) {
l[5]= 0;
while(!(!(e.U2S(l[5])<8))) {
s.push( m.getUint16(3559+2*e.U2S(l[5])));
m.setUint16(l[0]+2*e.U2S(l[5]), s.pop());
e.incdec(6,1)
};
m.setUint16(2985, 0);
e.ret(1); return
};