Disable trees for the time being.

This commit is contained in:
Andreas Gal 2008-07-17 17:12:28 -07:00
parent 43fbfbfe1e
commit 19ed222624
2 changed files with 25 additions and 14 deletions

View File

@ -397,15 +397,16 @@ public:
int t = isNumber(v)
? (isPromoteInt(i) ? JSVAL_INT : JSVAL_DOUBLE)
: JSVAL_TAG(v);
return t;
return t;
}
/* Write out a type map for the current scopes and all outer scopes,
up until the entry scope. */
virtual LInsp insGuard(LOpcode v, LIns *c, SideExit *x) {
uint8* m = x->typeMap;
unsigned _ngslots = ((VMFragmentInfo*)_fragment->vmprivate)->ngslots;
uint16* _gslots = ((VMFragmentInfo*)_fragment->vmprivate)->gslots;
VMFragmentInfo* fi = (VMFragmentInfo*)_fragment->root->vmprivate;
unsigned _ngslots = fi->ngslots;
uint16* _gslots = fi->gslots;
FORALL_SLOTS_IN_PENDING_FRAMES(_cx, _ngslots, _gslots, _entryFrame, _cx->fp,
*m++ = getStoreType(*vp));
return out->insGuard(v, c, x);
@ -427,10 +428,12 @@ public:
}
};
TraceRecorder::TraceRecorder(JSContext* cx, Fragment* _fragment, uint8* typemap)
TraceRecorder::TraceRecorder(JSContext* cx, GuardRecord* _anchor,
Fragment* _fragment, uint8* typeMap)
{
this->cx = cx;
this->globalObj = JS_GetGlobalForObject(cx, cx->fp->scopeChain);
this->anchor = _anchor;
this->fragment = _fragment;
this->lirbuf = _fragment->lirbuf;
entryFrame = cx->fp;
@ -462,8 +465,8 @@ TraceRecorder::TraceRecorder(JSContext* cx, Fragment* _fragment, uint8* typemap)
lirbuf->sp = addName(lir->insLoadi(lirbuf->state, offsetof(InterpState, sp)), "sp");
lirbuf->rp = addName(lir->insLoadi(lirbuf->state, offsetof(InterpState, rp)), "rp");
cx_ins = addName(lir->insLoadi(lirbuf->state, offsetof(InterpState, cx)), "cx");
uint8* m = fragmentInfo->typeMap;
uint8* m = typeMap;
FORALL_SLOTS_IN_PENDING_FRAMES(cx, fragmentInfo->ngslots, fragmentInfo->gslots,
entryFrame, entryFrame,
import(vp, *m, vpname, vpnum);
@ -963,7 +966,13 @@ TraceRecorder::closeLoop(Fragmento* fragmento)
return;
}
fragment->lastIns = lir->insGuard(LIR_loop, lir->insImm(1), snapshot());
if (anchor) {
anchor->target = fragment;
fragment->addLink(anchor);
}
compile(fragmento->assm(), fragment);
if (anchor)
fragmento->assm()->patch(anchor);
#ifdef DEBUG
char* label;
asprintf(&label, "%s:%u", cx->fp->script->filename,
@ -1058,10 +1067,10 @@ js_DeleteRecorder(JSContext* cx)
}
bool
js_StartRecorder(JSContext* cx, Fragment* f, uint8* typeMap)
js_StartRecorder(JSContext* cx, GuardRecord* anchor, Fragment* f, uint8* typeMap)
{
/* start recording if no exception during construction */
JS_TRACE_MONITOR(cx).recorder = new (&gc) TraceRecorder(cx, f, typeMap);
JS_TRACE_MONITOR(cx).recorder = new (&gc) TraceRecorder(cx, anchor, f, typeMap);
if (cx->throwing) {
js_AbortRecording(cx, "setting up recorder failed");
return false;
@ -1118,13 +1127,13 @@ js_LoopEdge(JSContext* cx)
return false; /* we stay away from shared global objects */
}
#endif
if (cx->fp->regs->pc == r->getFragment()->ip) { /* did we hit the start point? */
if (cx->fp->regs->pc == r->getFragment()->root->ip) { /* did we hit the start point? */
AUDIT(traceCompleted);
r->closeLoop(JS_TRACE_MONITOR(cx).fragmento);
js_DeleteRecorder(cx);
} else {
AUDIT(returnToDifferentLoopHeader);
js_AbortRecording(cx, "Loop edge does not return to header.");
js_AbortRecording(cx, "Loop edge does not return to header");
}
return false; /* done recording */
}
@ -1180,7 +1189,7 @@ js_LoopEdge(JSContext* cx)
);
}
/* recording primary trace */
return js_StartRecorder(cx, f, fi->typeMap);
return js_StartRecorder(cx, NULL, f, fi->typeMap);
}
return false;
}
@ -1233,6 +1242,8 @@ js_LoopEdge(JSContext* cx)
AUDIT(sideExitIntoInterpreter);
return false; // disable trees for now
/* if the side exit terminates the loop, don't try to attach a trace here */
if (js_IsLoopExit(cx, cx->fp->script, cx->fp->regs->pc))
return false;
@ -1247,10 +1258,9 @@ js_LoopEdge(JSContext* cx)
c->parent = f;
c->root = f->root;
c->calldepth = lr->calldepth;
c->addLink(lr);
/* record secondary trace */
return js_StartRecorder(cx, c, lr->guard->exit()->typeMap);
return js_StartRecorder(cx, lr, c, lr->guard->exit()->typeMap);
}
void

View File

@ -130,6 +130,7 @@ class TraceRecorder {
struct JSStackFrame* entryFrame;
struct JSFrameRegs entryRegs;
JSAtom** atoms;
nanojit::GuardRecord* anchor;
nanojit::Fragment* fragment;
VMFragmentInfo* fragmentInfo;
nanojit::LirBuffer* lirbuf;
@ -212,7 +213,7 @@ class TraceRecorder {
bool guardDenseArrayIndexWithinBounds(JSObject* obj, jsint idx, nanojit::LIns* obj_ins,
nanojit::LIns*& dslots_ins, nanojit::LIns* idx_ins);
public:
TraceRecorder(JSContext* cx, nanojit::Fragment*, uint8* typemap);
TraceRecorder(JSContext* cx, nanojit::GuardRecord*, nanojit::Fragment*, uint8* typemap);
~TraceRecorder();
nanojit::SideExit* snapshot();