Bug 995570 - Tracelogging: Initially implementation of logging VM calls, r=luke

This commit is contained in:
Hannes Verschore 2014-04-17 12:26:16 +02:00
parent a9ee687d32
commit 6fffa6d59b
4 changed files with 37 additions and 25 deletions

View File

@ -14,6 +14,7 @@
#include "jit/MIR.h"
#include "jit/MIRGenerator.h"
#include "jit/ParallelFunctions.h"
#include "vm/TraceLogging.h"
#include "jit/IonFrames-inl.h"
@ -628,6 +629,11 @@ CodeGeneratorShared::callVM(const VMFunction &fun, LInstruction *ins, const Regi
}
#endif
#ifdef JS_TRACE_LOGGING
if (!emitTracelogStartEvent(TraceLogger::VM))
return false;
#endif
// Stack is:
// ... frame ...
// [args]
@ -667,6 +673,12 @@ CodeGeneratorShared::callVM(const VMFunction &fun, LInstruction *ins, const Regi
masm.implicitPop(fun.explicitStackSlots() * sizeof(void *) + framePop);
// Stack is:
// ... frame ...
#ifdef JS_TRACE_LOGGING
if (!emitTracelogStopEvent(TraceLogger::VM))
return false;
#endif
return true;
}
@ -1028,6 +1040,9 @@ CodeGeneratorShared::emitTracelogScript(bool isStart)
bool
CodeGeneratorShared::emitTracelogTree(bool isStart, uint32_t textId)
{
if (!TraceLogTextIdEnabled(textId))
return true;
RegisterSet regs = RegisterSet::Volatile();
Register logger = regs.takeGeneral();
@ -1037,28 +1052,15 @@ CodeGeneratorShared::emitTracelogTree(bool isStart, uint32_t textId)
if (!patchableTraceLoggers_.append(patchLocation))
return false;
if (isStart)
if (isStart) {
masm.tracelogStart(logger, textId);
else
} else {
#ifdef DEBUG
masm.tracelogStop(logger, textId);
masm.Pop(logger);
return true;
}
bool
CodeGeneratorShared::emitTracelogStopEvent()
{
RegisterSet regs = RegisterSet::Volatile();
Register logger = regs.takeGeneral();
masm.Push(logger);
CodeOffsetLabel patchLocation = masm.movWithPatch(ImmPtr(nullptr), logger);
if (!patchableTraceLoggers_.append(patchLocation))
return false;
masm.tracelogStop(logger);
#else
masm.tracelogStop(logger);
#endif
}
masm.Pop(logger);
return true;

View File

@ -467,13 +467,8 @@ class CodeGeneratorShared : public LInstructionVisitor
return emitTracelogTree(/* isStart =*/ true, textId);
}
bool emitTracelogStopEvent(uint32_t textId) {
#ifdef DEBUG
return emitTracelogTree(/* isStart =*/ false, textId);
#else
return emitTracelogScript(/* isStart =*/ false);
#endif
}
bool emitTracelogStopEvent();
#endif
};

View File

@ -90,6 +90,7 @@ const char* const text[] = {
"YarrCompile",
"YarrInterpret",
"YarrJIT",
"VM",
"SplitCriticalEdges",
"RenumberBlocks",
"DominatorTree",
@ -867,3 +868,9 @@ TraceLogging::create()
return logger;
}
bool
js::TraceLogTextIdEnabled(uint32_t textId)
{
return traceLoggers.isTextIdEnabled(textId);
}

View File

@ -227,6 +227,7 @@ class TraceLogger
YarrCompile,
YarrInterpret,
YarrJIT,
VM,
// Specific passes during ion compilation:
SplitCriticalEdges,
@ -470,6 +471,13 @@ inline uint32_t TraceLogCreateTextId(TraceLogger *logger, const char *text) {
#endif
return TraceLogger::TL_Error;
}
#ifdef JS_TRACE_LOGGING
bool TraceLogTextIdEnabled(uint32_t textId);
#else
inline bool TraceLogTextIdEnabled(uint32_t textId) {
return false;
}
#endif
inline void TraceLogTimestamp(TraceLogger *logger, uint32_t textId) {
#ifdef JS_TRACE_LOGGING
if (logger)