Bug 531687 - Duplicate node names in TMFLAGS=aftersf printout (TM-specific part). r=jseward.

This commit is contained in:
Nicholas Nethercote 2010-03-18 10:53:26 +11:00
parent d1369b80ed
commit 13e08e42b7
2 changed files with 26 additions and 32 deletions

View File

@ -3098,7 +3098,7 @@ class RegExpNativeCompiler {
addName(LirBuffer* lirbuf, LIns* ins, const char* name) addName(LirBuffer* lirbuf, LIns* ins, const char* name)
{ {
#ifdef NJ_VERBOSE #ifdef NJ_VERBOSE
debug_only_stmt(lirbuf->names->addName(ins, name);) debug_only_stmt(lirbuf->printer->lirNameMap->addName(ins, name);)
#endif #endif
return ins; return ins;
} }
@ -3145,8 +3145,7 @@ class RegExpNativeCompiler {
{ {
fragment->lirbuf = lirbuf; fragment->lirbuf = lirbuf;
#ifdef DEBUG #ifdef DEBUG
LabelMap* labels = new (tempAlloc) LabelMap(tempAlloc, &LogController); lirbuf->printer = new (tempAlloc) LInsPrinter(tempAlloc);
lirbuf->names = new (tempAlloc) LirNameMap(tempAlloc, labels);
#endif #endif
} }
@ -3188,7 +3187,7 @@ class RegExpNativeCompiler {
#ifdef NJ_VERBOSE #ifdef NJ_VERBOSE
debug_only_stmt( debug_only_stmt(
if (LogController.lcbits & LC_TMRegexp) { if (LogController.lcbits & LC_TMRegexp) {
lir = verbose_filter = new VerboseWriter(tempAlloc, lir, lirbuf->names, lir = verbose_filter = new VerboseWriter(tempAlloc, lir, lirbuf->printer,
&LogController); &LogController);
} }
) )
@ -3248,8 +3247,7 @@ class RegExpNativeCompiler {
*/ */
JS_ASSERT(!lirbuf->sp && !lirbuf->rp); JS_ASSERT(!lirbuf->sp && !lirbuf->rp);
assm->compile(fragment, tempAlloc, /*optimize*/true assm->compile(fragment, tempAlloc, /*optimize*/true verbose_only(, lirbuf->printer));
verbose_only(, lirbuf->names->labels));
if (assm->error() != nanojit::None) if (assm->error() != nanojit::None)
goto fail; goto fail;

View File

@ -140,40 +140,38 @@ StackFilter::getTop(LIns* guard)
#if defined NJ_VERBOSE #if defined NJ_VERBOSE
void void
LirNameMap::formatGuard(LIns *i, char *out) LInsPrinter::formatGuard(InsBuf *buf, LIns *ins)
{ {
VMSideExit *x; RefBuf b1, b2;
VMSideExit *x = (VMSideExit *)ins->record()->exit;
x = (VMSideExit *)i->record()->exit; VMPI_snprintf(buf->buf, buf->len,
sprintf(out,
"%s: %s %s -> pc=%p imacpc=%p sp%+ld rp%+ld (GuardID=%03d)", "%s: %s %s -> pc=%p imacpc=%p sp%+ld rp%+ld (GuardID=%03d)",
formatRef(i), formatRef(&b1, ins),
lirNames[i->opcode()], lirNames[ins->opcode()],
i->oprnd1() ? formatRef(i->oprnd1()) : "", ins->oprnd1() ? formatRef(&b2, ins->oprnd1()) : "",
(void *)x->pc, (void *)x->pc,
(void *)x->imacpc, (void *)x->imacpc,
(long int)x->sp_adj, (long int)x->sp_adj,
(long int)x->rp_adj, (long int)x->rp_adj,
i->record()->profGuardID); ins->record()->profGuardID);
} }
void void
LirNameMap::formatGuardXov(LIns *i, char *out) LInsPrinter::formatGuardXov(InsBuf *buf, LIns *ins)
{ {
VMSideExit *x; RefBuf b1, b2, b3;
VMSideExit *x = (VMSideExit *)ins->record()->exit;
x = (VMSideExit *)i->record()->exit; VMPI_snprintf(buf->buf, buf->len,
sprintf(out,
"%s = %s %s, %s -> pc=%p imacpc=%p sp%+ld rp%+ld (GuardID=%03d)", "%s = %s %s, %s -> pc=%p imacpc=%p sp%+ld rp%+ld (GuardID=%03d)",
formatRef(i), formatRef(&b1, ins),
lirNames[i->opcode()], lirNames[ins->opcode()],
formatRef(i->oprnd1()), formatRef(&b2, ins->oprnd1()),
formatRef(i->oprnd2()), formatRef(&b3, ins->oprnd2()),
(void *)x->pc, (void *)x->pc,
(void *)x->imacpc, (void *)x->imacpc,
(long int)x->sp_adj, (long int)x->sp_adj,
(long int)x->rp_adj, (long int)x->rp_adj,
i->record()->profGuardID); ins->record()->profGuardID);
} }
#endif #endif
@ -2175,8 +2173,7 @@ TraceRecorder::TraceRecorder(JSContext* cx, VMSideExit* anchor, VMFragment* frag
fragment->lirbuf = lirbuf; fragment->lirbuf = lirbuf;
#ifdef DEBUG #ifdef DEBUG
LabelMap* labels = new (tempAlloc()) LabelMap(tempAlloc(), &LogController); lirbuf->printer = new (tempAlloc()) LInsPrinter(tempAlloc());
lirbuf->names = new (tempAlloc()) LirNameMap(tempAlloc(), labels);
#endif #endif
/* /*
@ -2222,7 +2219,7 @@ TraceRecorder::TraceRecorder(JSContext* cx, VMSideExit* anchor, VMFragment* frag
#endif #endif
debug_only_stmt( debug_only_stmt(
if (LogController.lcbits & LC_TMRecorder) { if (LogController.lcbits & LC_TMRecorder) {
lir = new (tempAlloc()) VerboseWriter(tempAlloc(), lir, lirbuf->names, lir = new (tempAlloc()) VerboseWriter(tempAlloc(), lir, lirbuf->printer,
&LogController); &LogController);
} }
) )
@ -2417,7 +2414,7 @@ TraceRecorder::addName(LIns* ins, const char* name)
* in adding names otherwise. * in adding names otherwise.
*/ */
if (LogController.lcbits > 0) if (LogController.lcbits > 0)
lirbuf->names->addName(ins, name); lirbuf->printer->lirNameMap->addName(ins, name);
#endif #endif
return ins; return ins;
} }
@ -4214,14 +4211,13 @@ TraceRecorder::compile()
char* label = (char*)js_malloc((filename ? strlen(filename) : 7) + 16); char* label = (char*)js_malloc((filename ? strlen(filename) : 7) + 16);
sprintf(label, "%s:%u", filename ? filename : "<stdin>", sprintf(label, "%s:%u", filename ? filename : "<stdin>",
js_FramePCToLineNumber(cx, cx->fp)); js_FramePCToLineNumber(cx, cx->fp));
lirbuf->names->labels->add(fragment, sizeof(Fragment), 0, label); lirbuf->printer->addrNameMap->addAddrRange(fragment, sizeof(Fragment), 0, label);
js_free(label); js_free(label);
#endif #endif
Assembler *assm = traceMonitor->assembler; Assembler *assm = traceMonitor->assembler;
JS_ASSERT(assm->error() == nanojit::None); JS_ASSERT(assm->error() == nanojit::None);
assm->compile(fragment, tempAlloc(), /*optimize*/true assm->compile(fragment, tempAlloc(), /*optimize*/true verbose_only(, lirbuf->printer));
verbose_only(, lirbuf->names->labels));
if (assm->error() != nanojit::None) { if (assm->error() != nanojit::None) {
assm->setError(nanojit::None); assm->setError(nanojit::None);