Fri, 19 Nov 2010 16:08:51 +0000
Update all opcodes to use RK() that need it
lvm.js | file | annotate | diff | comparison | revisions |
--- a/lvm.js Fri Nov 19 16:06:12 2010 +0000 +++ b/lvm.js Fri Nov 19 16:08:51 2010 +0000 @@ -412,9 +412,7 @@ break; case OP_GETTABLE: var C = INS_C(instruction); - var keysource = (C&0x100)?frame.f.constants:frame.reg; - var key = keysource[C&0xff]; - var value = frame.reg[INS_B(instruction)].index(key).value; + var value = frame.reg[INS_B(instruction)].index(RK(frame, C)).value; frame.reg[INS_A(instruction)] = this.LValue(value); break; case OP_SETTABLE: @@ -423,9 +421,7 @@ var value = valuesource[C&0xff]; var B = INS_B(instruction); - var keysource = (B&0x100)?frame.f.constants:frame.reg; - var key = keysource[B&0xff]; - frame.reg[INS_A(instruction)].setIndex(key, value); + frame.reg[INS_A(instruction)].setIndex(RK(frame, B), value); break; case OP_CALL: var f = frame.reg[INS_A(instruction)].precall(); // return JS or LValue @@ -499,9 +495,7 @@ var table = frame.reg[INS_B(instruction)]; frame.reg[INS_A(instruction)+1] = table; var C = INS_C(instruction); - var keysource = (C&0x100)?frame.f.constants:frame.reg; - var key = keysource[C&0xff]; // FIXME: Should this be made an LValue? - frame.reg[INS_A(instruction)] = table.index(key); + frame.reg[INS_A(instruction)] = table.index(RK(frame, C)); break; case OP_FORPREP: frame.pc+=(INS_sBx(instruction));