#ifndef js_compile_h #define js_compile_h enum js_OpCode { OP_POP, /* A -- */ OP_DUP, /* A -- A A */ OP_DUP2, /* A B -- A B A B */ OP_ROT2, /* A B -- B A */ OP_ROT3, /* A B C -- C A B */ OP_ROT4, /* A B C D -- D A B C */ OP_NUMBER_0, /* -- 0 */ OP_NUMBER_1, /* -- 1 */ OP_NUMBER_POS, /* -K- K */ OP_NUMBER_NEG, /* -K- -K */ OP_NUMBER, /* -N- */ OP_STRING, /* -S- */ OP_CLOSURE, /* -F- */ OP_NEWARRAY, OP_NEWOBJECT, OP_NEWREGEXP, /* -S,opts- */ OP_UNDEF, OP_NULL, OP_TRUE, OP_FALSE, OP_THIS, OP_CURRENT, /* currently executing function object */ OP_INITLOCAL, /* -K- */ OP_GETLOCAL, /* -K- */ OP_SETLOCAL, /* -K- */ OP_DELLOCAL, /* -K- false */ OP_INITVAR, /* -S- */ OP_DEFVAR, /* -S- */ OP_HASVAR, /* -S- ( | undefined ) */ OP_GETVAR, /* -S- */ OP_SETVAR, /* -S- */ OP_DELVAR, /* -S- */ OP_IN, /* -- */ OP_INITPROP, /* -- */ OP_INITGETTER, /* -- */ OP_INITSETTER, /* -- */ OP_GETPROP, /* -- */ OP_GETPROP_S, /* -S- */ OP_SETPROP, /* -- */ OP_SETPROP_S, /* -S- */ OP_DELPROP, /* -- */ OP_DELPROP_S, /* -S- */ OP_ITERATOR, /* -- */ OP_NEXTITER, /* -- ( true | false ) */ OP_EVAL, /* -(numargs)- */ OP_CALL, /* -(numargs)- */ OP_NEW, /* -(numargs)- */ OP_TYPEOF, OP_POS, OP_NEG, OP_BITNOT, OP_LOGNOT, OP_INC, /* -- ToNumber(x)+1 */ OP_DEC, /* -- ToNumber(x)-1 */ OP_POSTINC, /* -- ToNumber(x)+1 ToNumber(x) */ OP_POSTDEC, /* -- ToNumber(x)-1 ToNumber(x) */ OP_MUL, OP_DIV, OP_MOD, OP_ADD, OP_SUB, OP_SHL, OP_SHR, OP_USHR, OP_LT, OP_GT, OP_LE, OP_GE, OP_EQ, OP_NE, OP_STRICTEQ, OP_STRICTNE, OP_JCASE, OP_BITAND, OP_BITXOR, OP_BITOR, OP_INSTANCEOF, OP_THROW, OP_TRY, /* -ADDR- /jump/ or -ADDR- */ OP_ENDTRY, OP_CATCH, /* push scope chain with exception variable */ OP_ENDCATCH, OP_WITH, OP_ENDWITH, OP_DEBUGGER, OP_JUMP, OP_JTRUE, OP_JFALSE, OP_RETURN, OP_LINE, /* -K- */ }; struct js_Function { const char *name; int script; int lightweight; int strict; int arguments; int numparams; js_Instruction *code; int codecap, codelen; js_Function **funtab; int funcap, funlen; double *numtab; int numcap, numlen; const char **strtab; int strcap, strlen; const char **vartab; int varcap, varlen; const char *filename; int line, lastline; js_Function *gcnext; int gcmark; }; js_Function *jsC_compilefunction(js_State *J, js_Ast *prog); js_Function *jsC_compile(js_State *J, js_Ast *prog); const char *jsC_opcodestring(enum js_OpCode opcode); void jsC_dumpfunction(js_State *J, js_Function *fun); #endif