From 871762698e02eb656104f88a3ba23bf3d9233395 Mon Sep 17 00:00:00 2001 From: "shaver@mozilla.org" Date: Sat, 9 Aug 2008 15:05:34 -0400 Subject: [PATCH] improve naming of anonymous functions and excess args --- js/src/jstracer.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/js/src/jstracer.cpp b/js/src/jstracer.cpp index f543aa27aa39..ad679003c2a8 100644 --- a/js/src/jstracer.cpp +++ b/js/src/jstracer.cpp @@ -965,19 +965,22 @@ TraceRecorder::import(LIns* base, ptrdiff_t offset, jsval* p, uint8& t, JS_ASSERT(strlen(prefix) < 10); void* mark = NULL; jsuword* localNames = NULL; + const char* funName = NULL; if (*prefix == 'a' || *prefix == 'v') { mark = JS_ARENA_MARK(&cx->tempPool); localNames = js_GetLocalNameArray(cx, fp->fun, &cx->tempPool); + funName = fp->fun->atom ? js_AtomToPrintableString(cx, fp->fun->atom) : ""; } - if (!strcmp(prefix, "argv")) { JSAtom *atom = JS_LOCAL_NAME_TO_ATOM(localNames[index]); - JS_snprintf(name, sizeof name, "$%s.%s", js_AtomToPrintableString(cx, fp->fun->atom), - js_AtomToPrintableString(cx, atom)); + if (atom) { + JS_snprintf(name, sizeof name, "$%s.%s", funName, js_AtomToPrintableString(cx, atom)); + } else { + JS_snprintf(name, sizeof name, "$%s.", funName, index); + } } else if (!strcmp(prefix, "vars")) { JSAtom *atom = JS_LOCAL_NAME_TO_ATOM(localNames[fp->fun->nargs + index]); - JS_snprintf(name, sizeof name, "$%s.%s", js_AtomToPrintableString(cx, fp->fun->atom), - js_AtomToPrintableString(cx, atom)); + JS_snprintf(name, sizeof name, "$%s.%s", funName, js_AtomToPrintableString(cx, atom)); } else { JS_snprintf(name, sizeof name, "$%s%d", prefix, index); }