Extend dispatch table to include 256 extra cases for traceing.

This commit is contained in:
Andreas Gal 2008-07-03 22:28:01 -07:00
parent 62d0c7bbfb
commit 1d27756235

View File

@ -2594,6 +2594,13 @@ js_Interpret(JSContext *cx)
# undef OPDEF # undef OPDEF
}; };
static void *const recordingJumpTable[] = {
# define OPDEF(op,val,name,token,length,nuses,ndefs,prec,format) \
JS_EXTENSION &&R_##op,
# include "jsopcode.tbl"
# undef OPDEF
};
static void *const interruptJumpTable[] = { static void *const interruptJumpTable[] = {
# define OPDEF(op,val,name,token,length,nuses,ndefs,prec,format) \ # define OPDEF(op,val,name,token,length,nuses,ndefs,prec,format) \
JS_EXTENSION &&L_JSOP_INTERRUPT, JS_EXTENSION &&L_JSOP_INTERRUPT,
@ -2731,9 +2738,13 @@ js_Interpret(JSContext *cx)
((void) (jumpTable = (cx)->debugHooks->interruptHandler \ ((void) (jumpTable = (cx)->debugHooks->interruptHandler \
? interruptJumpTable \ ? interruptJumpTable \
: normalJumpTable)) : normalJumpTable))
# define ENABLE_TRACING(flag) \
((void) (jumpTable = recordingJumpTable))
#else #else
# define LOAD_INTERRUPT_HANDLER(cx) \ # define LOAD_INTERRUPT_HANDLER(cx) \
((void) (switchMask = (cx)->debugHooks->interruptHandler ? 0 : 255)) ((void) (switchMask = (cx)->debugHooks->interruptHandler ? 0 : 255))
# define ENABLE_TRACING(flag) \
((void) (switchMask = 0)
#endif #endif
LOAD_INTERRUPT_HANDLER(cx); LOAD_INTERRUPT_HANDLER(cx);
@ -2842,6 +2853,13 @@ js_Interpret(JSContext *cx)
goto error; goto error;
default:; default:;
} }
#if !JS_THREADED_INTERP
} else {
/* this was not a real interrupt, the tracer is trying to
record a trace */
switchOp = op + 256;
goto do_switch;
#endif
} }
LOAD_INTERRUPT_HANDLER(cx); LOAD_INTERRUPT_HANDLER(cx);
@ -6832,6 +6850,15 @@ js_Interpret(JSContext *cx)
goto error; goto error;
} }
#if JS_THREADED_INTERP
# define OPDEF(x,val,name,token,length,nuses,ndefs,prec,format) \
R_##x: goto L_##x;
#else
# define OPDEF(x,val,name,token,length,nuses,ndefs,prec,format) \
x: op -= 256; goto do_op;
#endif
#include "jsopcode.tbl"
#if !JS_THREADED_INTERP #if !JS_THREADED_INTERP
} /* switch (op) */ } /* switch (op) */