Don't try to access the name of arguments beyond nargs (r=brendan).

This commit is contained in:
Andreas Gal 2008-08-11 12:47:18 -07:00
parent 16a51ac34e
commit 44a2f2366a
2 changed files with 4 additions and 4 deletions

View File

@ -942,7 +942,7 @@ FlushNativeStackFrame(JSContext* cx, unsigned callDepth, uint8* mp, double* np)
/* Emit load instructions onto the trace that read the initial stack state. */
void
TraceRecorder::import(LIns* base, ptrdiff_t offset, jsval* p, uint8& t,
const char *prefix, int index, JSStackFrame *fp)
const char *prefix, uintN index, JSStackFrame *fp)
{
LIns* ins;
if (t == JSVAL_INT) { /* demoted */
@ -972,8 +972,8 @@ TraceRecorder::import(LIns* base, ptrdiff_t offset, jsval* p, uint8& t,
funName = fp->fun->atom ? js_AtomToPrintableString(cx, fp->fun->atom) : "<anonymous>";
}
if (!strcmp(prefix, "argv")) {
JSAtom *atom = JS_LOCAL_NAME_TO_ATOM(localNames[index]);
if (atom) {
if (index < fp->fun->nargs) {
JSAtom *atom = JS_LOCAL_NAME_TO_ATOM(localNames[index]);
JS_snprintf(name, sizeof name, "$%s.%s", funName, js_AtomToPrintableString(cx, atom));
} else {
JS_snprintf(name, sizeof name, "$%s.<arg%d>", funName, index);

View File

@ -213,7 +213,7 @@ class TraceRecorder {
ptrdiff_t nativeStackOffset(jsval* p) const;
ptrdiff_t nativeGlobalOffset(jsval* p) const;
void import(nanojit::LIns* base, ptrdiff_t offset, jsval* p, uint8& t,
const char *prefix, int index, JSStackFrame *fp);
const char *prefix, uintN index, JSStackFrame *fp);
void import(unsigned ngslots, uint8* globalTypeMap, uint8* stackTypeMap);
void trackNativeStackUse(unsigned slots);