Support for B==0 in OP_CALL (signifies params are to top of the stack)

Wed, 07 Apr 2010 04:15:23 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 07 Apr 2010 04:15:23 +0100
changeset 18
ae0b4ec242a3
parent 17
ac02246fc1d1
child 19
8c9c1752272b

Support for B==0 in OP_CALL (signifies params are to top of the stack)

lvm.js file | annotate | diff | comparison | revisions
--- a/lvm.js	Wed Apr 07 03:07:10 2010 +0100
+++ b/lvm.js	Wed Apr 07 04:15:23 2010 +0100
@@ -284,7 +284,8 @@
 				break;
 			case OP_CALL:
 				var f = this.frame.reg[INS_A(instruction)].call(); // return JS or LValue
-				var args = this.frame.reg.slice(INS_A(instruction)+1, INS_A(instruction)+(INS_B(instruction)));
+				var A = INS_A(instruction), B = INS_B(instruction), undefined;
+				var args = this.frame.reg.slice(A+1, B==0?undefined:(A+B));
 				if(typeof(f) == "function")
 				{
 					// JS native function

mercurial