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);
}
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
nanojit::StackFilter::getTop(LInsp guard)
{
@ -1076,6 +1051,7 @@ js_LoopEdge(JSContext* cx)
/* is the recorder currently active? */
if (tm->recorder) {
TraceRecorder* r = tm->recorder;
#ifdef JS_THREADSAFE
/* XXX should this test not be earlier, to avoid even recording? */
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 */
}
#endif
if (tm->recorder->loopEdge())
return true; /* keep recording */
js_DeleteRecorder(cx);
if (cx->fp->regs->pc == r->getFragment()->ip) { /* did we hit the start point? */
r->closeLoop(JS_TRACE_MONITOR(cx).fragmento);
js_DeleteRecorder(cx);
} else
js_AbortRecording(cx, "Loop edge does not return to header.");
return false; /* done recording */
}
@ -1210,7 +1188,17 @@ js_AbortRecording(JSContext* cx, const char* reason)
#ifdef DEBUG
printf("Abort recording: %s.\n", reason);
#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);
}

View File

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