495 if(i<available) |
495 if(i<available) |
496 frame.reg[A+i] = prevframe.reg[base+i+1]; |
496 frame.reg[A+i] = prevframe.reg[base+i+1]; |
497 else |
497 else |
498 frame.reg[A+i] = new LValue(this, "nil", null); |
498 frame.reg[A+i] = new LValue(this, "nil", null); |
499 } |
499 } |
|
500 break; |
|
501 case OP_TAILCALL: |
|
502 var f = frame.reg[INS_A(instruction)].precall(); |
|
503 var A = INS_A(instruction), B = INS_B(instruction); |
|
504 var undefined, args; |
|
505 if(B != 1) |
|
506 args = frame.reg.slice(A+1, B==0?undefined:(A+B)); |
|
507 else |
|
508 args = []; |
|
509 if(args.length > f.numParameters) |
|
510 args.length = f.numParameters; |
|
511 for(var i=args.length;i<f.maxStackSize;i++) |
|
512 args[i] = new LValue(this, "nil", null); |
|
513 // Patch frame for new function |
|
514 frame.f = f; frame.pc = 0; frame.reg = args; |
500 break; |
515 break; |
501 case OP_CALL: |
516 case OP_CALL: |
502 var f = frame.reg[INS_A(instruction)].precall(); // return JS or LValue |
517 var f = frame.reg[INS_A(instruction)].precall(); // return JS or LValue |
503 var A = INS_A(instruction), B = INS_B(instruction), C = INS_C(instruction); |
518 var A = INS_A(instruction), B = INS_B(instruction), C = INS_C(instruction); |
504 var undefined; |
519 var undefined; |