Bug 996509 - TraceLogger: Make it possible to toggle TraceLogger_Engine on and off, r=bbouvier

This commit is contained in:
Hannes Verschore 2014-11-20 17:43:58 +01:00
parent fac5c47c1a
commit 5ba0935fa4
4 changed files with 35 additions and 36 deletions

View File

@ -1725,21 +1725,12 @@ MacroAssembler::tracelogStop(Register logger, uint32_t textId)
Register temp = regs.takeGeneral();
#ifdef DEBUG
void (&TraceLogFunc)(TraceLogger*, uint32_t) = TraceLogStopEvent;
setupUnalignedABICall(2, temp);
passABIArg(logger);
move32(Imm32(textId), temp);
passABIArg(temp);
#else
void (&TraceLogFunc)(TraceLogger*) = TraceLogStopEvent;
setupUnalignedABICall(1, temp);
passABIArg(logger);
#endif
callWithABINoProfiling(JS_FUNC_TO_DATA_PTR(void *, TraceLogFunc));
callWithABINoProfiling(JS_FUNC_TO_DATA_PTR(void *, TraceLogStopEvent));
PopRegsInMask(RegisterSet::Volatile());
}
@ -1751,9 +1742,6 @@ MacroAssembler::tracelogStop(Register logger, Register textId)
RegisterSet regs = RegisterSet::Volatile();
regs.takeUnchecked(logger);
#ifdef DEBUG
void (&TraceLogFunc)(TraceLogger*, uint32_t) = TraceLogStopEvent;
regs.takeUnchecked(textId);
Register temp = regs.takeGeneral();
@ -1761,16 +1749,8 @@ MacroAssembler::tracelogStop(Register logger, Register textId)
setupUnalignedABICall(2, temp);
passABIArg(logger);
passABIArg(textId);
#else
void (&TraceLogFunc)(TraceLogger*) = TraceLogStopEvent;
Register temp = regs.takeGeneral();
setupUnalignedABICall(1, temp);
passABIArg(logger);
#endif
callWithABINoProfiling(JS_FUNC_TO_DATA_PTR(void *, TraceLogFunc));
callWithABINoProfiling(JS_FUNC_TO_DATA_PTR(void *, TraceLogStopEvent));
PopRegsInMask(RegisterSet::Volatile());
}

View File

@ -1763,7 +1763,7 @@ CASE(JSOP_RETRVAL)
if (activation.entryFrame() != REGS.fp()) {
// Stop the engine. (No details about which engine exactly, could be
// interpreter, Baseline or IonMonkey.)
TraceLogStopEvent(logger);
TraceLogStopEvent(logger, TraceLogger::Engine);
TraceLogStopEvent(logger, TraceLogger::Scripts);
interpReturnOK = Debugger::onLeaveFrame(cx, REGS.fp(), interpReturnOK);
@ -3491,7 +3491,7 @@ DEFAULT()
gc::MaybeVerifyBarriers(cx, true);
TraceLogStopEvent(logger);
TraceLogStopEvent(logger, TraceLogger::Engine);
TraceLogStopEvent(logger, scriptLogId);
/*

View File

@ -681,7 +681,9 @@ void
TraceLogger::stopEvent(uint32_t id)
{
#ifdef DEBUG
if (stack.size() > 1 && id != TraceLogger::Scripts && stack.lastEntry().active()) {
if (id != TraceLogger::Scripts && id != TraceLogger::Engine &&
stack.size() > 1 && stack.lastEntry().active())
{
TreeEntry entry;
MOZ_ASSERT(getTreeEntry(stack.lastEntry().treeId(), &entry));
MOZ_ASSERT(entry.textId() == id);
@ -801,6 +803,8 @@ TraceLogging::lazyInit()
"Specific log items:\n"
);
for (uint32_t i = 1; i < TraceLogger::LAST; i++) {
if (!TraceLogger::textIdIsToggable(i))
continue;
printf(" %s\n", text[i]);
}
printf("\n");
@ -808,11 +812,12 @@ TraceLogging::lazyInit()
/*NOTREACHED*/
}
for (uint32_t i = 1; i < TraceLogger::LAST; i++)
enabledTextIds[i] = ContainsFlag(env, text[i]);
enabledTextIds[TraceLogger::TL_Error] = true;
enabledTextIds[TraceLogger::TL] = true;
for (uint32_t i = 1; i < TraceLogger::LAST; i++) {
if (TraceLogger::textIdIsToggable(i))
enabledTextIds[i] = ContainsFlag(env, text[i]);
else
enabledTextIds[i] = true;
}
if (ContainsFlag(env, "Default")) {
enabledTextIds[TraceLogger::Bailout] = true;
@ -832,6 +837,7 @@ TraceLogging::lazyInit()
enabledTextIds[TraceLogger::IrregexpCompile] = true;
enabledTextIds[TraceLogger::IrregexpExecute] = true;
enabledTextIds[TraceLogger::Scripts] = true;
enabledTextIds[TraceLogger::Engine] = true;
}
if (ContainsFlag(env, "IonCompiler")) {
@ -859,6 +865,10 @@ TraceLogging::lazyInit()
enabledTextIds[TraceLogger::Scripts] = true;
}
enabledTextIds[TraceLogger::Interpreter] = enabledTextIds[TraceLogger::Engine];
enabledTextIds[TraceLogger::Baseline] = enabledTextIds[TraceLogger::Engine];
enabledTextIds[TraceLogger::IonMonkey] = enabledTextIds[TraceLogger::Engine];
const char *options = getenv("TLOPTIONS");
if (options) {
if (strstr(options, "help")) {

View File

@ -110,6 +110,7 @@ namespace jit {
_(Bailout) \
_(Baseline) \
_(BaselineCompilation) \
_(Engine) \
_(GC) \
_(GCAllocation) \
_(GCSweeping) \
@ -431,6 +432,18 @@ class TraceLogger
bool init(uint32_t loggerId);
static bool textIdIsToggable(uint32_t id) {
if (id == TL_Error)
return false;
if (id == TL)
return false;
// Cannot toggle the logging of one engine on/off, because at the stop
// event it is sometimes unknown which engine was running.
if (id == IonMonkey || id == Baseline || id == Interpreter)
return false;
return true;
}
bool enable();
bool enable(JSContext *cx);
bool disable();
@ -450,8 +463,10 @@ class TraceLogger
// correctness.
void startEvent(uint32_t id);
void stopEvent(uint32_t id);
private:
void stopEvent();
public:
static unsigned offsetOfEnabled() {
return offsetof(TraceLogger, enabled);
}
@ -595,12 +610,6 @@ inline void TraceLogStopEvent(TraceLogger *logger, uint32_t textId) {
logger->stopEvent(textId);
#endif
}
inline void TraceLogStopEvent(TraceLogger *logger) {
#ifdef JS_TRACE_LOGGING
if (logger)
logger->stopEvent();
#endif
}
// Automatic logging at the start and end of function call.
class AutoTraceLog {