lvm.js

changeset 39
53d5bf6654ba
parent 38
ba347b4b655f
child 40
3a074ec1790f
equal deleted inserted replaced
38:ba347b4b655f 39:53d5bf6654ba
1 1
2 var OP_MOVE = 0; 2 var OP_MOVE = 0;
3 var OP_LOADK = 1; 3 var OP_LOADK = 1;
4 var OP_LOADBOOL = 2;
4 var OP_LOADNIL = 3; 5 var OP_LOADNIL = 3;
5 var OP_GETUPVAL = 4; 6 var OP_GETUPVAL = 4;
6 var OP_GETGLOBAL = 5; 7 var OP_GETGLOBAL = 5;
7 var OP_GETTABLE = 6; 8 var OP_GETTABLE = 6;
8 var OP_SETGLOBAL = 7; 9 var OP_SETGLOBAL = 7;
297 this.frame.reg[INS_A(instruction)] = this.frame.reg[INS_B(instruction)]; 298 this.frame.reg[INS_A(instruction)] = this.frame.reg[INS_B(instruction)];
298 break; 299 break;
299 case OP_LOADNIL: 300 case OP_LOADNIL:
300 for(var i = INS_A(instruction);i<=INS_B(instruction);i++) 301 for(var i = INS_A(instruction);i<=INS_B(instruction);i++)
301 this.frame.reg[i] = new LValue("nil", null); 302 this.frame.reg[i] = new LValue("nil", null);
303 break;
304 case OP_LOADBOOL:
305 this.frame.reg[INS_A(instruction)] = new LValue("boolean", INS_B(instruction)!=0);
306 if(INS_C(instruction)!=0)
307 this.frame.pc++;
302 break; 308 break;
303 case OP_GETUPVAL: 309 case OP_GETUPVAL:
304 this.frame.reg[INS_A(instruction)] = this.frame.f.upvalues[INS_B(instruction)]; 310 this.frame.reg[INS_A(instruction)] = this.frame.f.upvalues[INS_B(instruction)];
305 break; 311 break;
306 case OP_GETGLOBAL: 312 case OP_GETGLOBAL:

mercurial