merge, woo

This commit is contained in:
shaver@mozilla.org 2008-07-17 01:59:58 -07:00
commit 3a154456b3
2 changed files with 20 additions and 34 deletions

View File

@ -956,31 +956,6 @@ TraceRecorder::closeLoop(Fragmento* fragmento)
compile(fragmento->assm(), fragment); compile(fragmento->assm(), fragment);
} }
bool
TraceRecorder::loopEdge()
{
if (cx->fp->regs->pc == entryRegs.pc) {
closeLoop(JS_TRACE_MONITOR(cx).fragmento);
return false; /* done recording */
}
/* make sure the type map gets trashed if this was the root fragment that didn't complete */
stop();
return false; /* abort recording */
}
void
TraceRecorder::stop()
{
fragment->blacklist();
if (fragment->root == fragment) {
#ifdef DEBUG
printf("Root fragment aborted, trashing the type map.\n");
#endif
JS_ASSERT(fragmentInfo->typeMap);
fragmentInfo->typeMap = NULL;
}
}
int int
nanojit::StackFilter::getTop(LInsp guard) nanojit::StackFilter::getTop(LInsp guard)
{ {
@ -1076,6 +1051,7 @@ js_LoopEdge(JSContext* cx)
/* is the recorder currently active? */ /* is the recorder currently active? */
if (tm->recorder) { if (tm->recorder) {
TraceRecorder* r = tm->recorder;
#ifdef JS_THREADSAFE #ifdef JS_THREADSAFE
/* XXX should this test not be earlier, to avoid even recording? */ /* XXX should this test not be earlier, to avoid even recording? */
if (OBJ_SCOPE(JS_GetGlobalForObject(cx, cx->fp->scopeChain))->title.ownercx != cx) { if (OBJ_SCOPE(JS_GetGlobalForObject(cx, cx->fp->scopeChain))->title.ownercx != cx) {
@ -1085,9 +1061,11 @@ js_LoopEdge(JSContext* cx)
return false; /* we stay away from shared global objects */ return false; /* we stay away from shared global objects */
} }
#endif #endif
if (tm->recorder->loopEdge()) if (cx->fp->regs->pc == r->getFragment()->ip) { /* did we hit the start point? */
return true; /* keep recording */ r->closeLoop(JS_TRACE_MONITOR(cx).fragmento);
js_DeleteRecorder(cx); js_DeleteRecorder(cx);
} else
js_AbortRecording(cx, "Loop edge does not return to header.");
return false; /* done recording */ return false; /* done recording */
} }
@ -1210,7 +1188,17 @@ js_AbortRecording(JSContext* cx, const char* reason)
#ifdef DEBUG #ifdef DEBUG
printf("Abort recording: %s.\n", reason); printf("Abort recording: %s.\n", reason);
#endif #endif
JS_TRACE_MONITOR(cx).recorder->stop(); JS_ASSERT(JS_TRACE_MONITOR(cx).recorder != NULL);
Fragment* f = JS_TRACE_MONITOR(cx).recorder->getFragment();
f->blacklist();
if (f->root == f) {
#ifdef DEBUG
printf("Root fragment aborted, trashing the type map.\n");
#endif
VMFragmentInfo* fi = (VMFragmentInfo*)f->vmprivate;
JS_ASSERT(fi->typeMap);
fi->typeMap = NULL;
}
js_DeleteRecorder(cx); js_DeleteRecorder(cx);
} }

View File

@ -159,7 +159,6 @@ class TraceRecorder {
bool checkType(jsval& v, uint8& type); bool checkType(jsval& v, uint8& type);
bool verifyTypeStability(JSStackFrame* entryFrame, JSStackFrame* currentFrame, uint8* m); bool verifyTypeStability(JSStackFrame* entryFrame, JSStackFrame* currentFrame, uint8* m);
void closeLoop(nanojit::Fragmento* fragmento);
jsval& argval(unsigned n) const; jsval& argval(unsigned n) const;
jsval& varval(unsigned n) const; jsval& varval(unsigned n) const;
@ -216,10 +215,9 @@ public:
~TraceRecorder(); ~TraceRecorder();
nanojit::SideExit* snapshot(); nanojit::SideExit* snapshot();
nanojit::Fragment* getFragment() const { return fragment; }
bool loopEdge(); void closeLoop(nanojit::Fragmento* fragmento);
void stop();
bool record_EnterFrame(); bool record_EnterFrame();
#define OPDEF(op,val,name,token,length,nuses,ndefs,prec,format) \ #define OPDEF(op,val,name,token,length,nuses,ndefs,prec,format) \