Add debugging facilities for typemaps and fix sp_adj calculation for tree calls.

This commit is contained in:
Andreas Gal 2008-08-19 22:29:02 -07:00
parent 454c89d72b
commit 8569359e49
2 changed files with 23 additions and 1 deletions

View File

@ -1433,7 +1433,7 @@ TraceRecorder::emitTreeCallStackSetup(Fragment* inner)
if (callDepth > 0) { if (callDepth > 0) {
/* Calculate the amount we have to lift the native stack pointer by to compensate for /* Calculate the amount we have to lift the native stack pointer by to compensate for
any outer frames that the inner tree doesn't expect but the outer tree has. */ any outer frames that the inner tree doesn't expect but the outer tree has. */
ptrdiff_t sp_adj = nativeStackOffset(&cx->fp->argv[0]); ptrdiff_t sp_adj = nativeStackOffset(&cx->fp->argv[-1]) + sizeof(double);
/* Calculate the amount we have to lift the call stack by */ /* Calculate the amount we have to lift the call stack by */
ptrdiff_t rp_adj = callDepth * sizeof(FrameInfo); ptrdiff_t rp_adj = callDepth * sizeof(FrameInfo);
/* Guard that we have enough stack space for the tree we are trying to call on top /* Guard that we have enough stack space for the tree we are trying to call on top
@ -5426,6 +5426,24 @@ TraceRecorder::record_JSOP_HOLE()
return true; return true;
} }
#ifdef DEBUG
void
TraceRecorder::printTypeMap(uint8* globalTypeMap, uint8* stackTypeMap)
{
uint8* m = globalTypeMap;
const char* types[] = { "object", "int", "double", "int", "string", "int", "boolean", "int" };
FORALL_GLOBAL_SLOTS(cx, traceMonitor->globalSlots->length(), traceMonitor->globalSlots->data(),
printf("%s%d type=%s value=%lx\n", vpname, vpnum, types[(unsigned)*m], *vp);
++m;
);
m = stackTypeMap;
FORALL_SLOTS_IN_PENDING_FRAMES(cx, callDepth,
printf("%s%d type=%s value=%lx\n", vpname, vpnum, types[(unsigned)*m], *vp);
++m;
);
}
#endif DEBUG
#define UNUSED(op) bool TraceRecorder::record_##op() { return false; } #define UNUSED(op) bool TraceRecorder::record_##op() { return false; }
UNUSED(JSOP_UNUSED76) UNUSED(JSOP_UNUSED76)

View File

@ -302,6 +302,10 @@ class TraceRecorder {
bool interpretedFunctionCall(jsval& fval, JSFunction* fun, uintN argc); bool interpretedFunctionCall(jsval& fval, JSFunction* fun, uintN argc);
bool forInLoop(jsval* vp); bool forInLoop(jsval* vp);
#ifdef DEBUG
void printTypeMap(uint8* globalTypeMap, uint8* stackTypeMap);
#endif
public: public:
TraceRecorder(JSContext* cx, nanojit::GuardRecord*, nanojit::Fragment*, TreeInfo*, TraceRecorder(JSContext* cx, nanojit::GuardRecord*, nanojit::Fragment*, TreeInfo*,
unsigned ngslots, uint8* globalTypeMap, uint8* stackTypeMap); unsigned ngslots, uint8* globalTypeMap, uint8* stackTypeMap);