mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-02 15:15:23 +00:00
Factor out js_ContinueRecording from js_LoopEdge.
This commit is contained in:
parent
1157b3a775
commit
471c0b9fbb
@ -1444,40 +1444,43 @@ js_AttemptToExtendTree(JSContext* cx, GuardRecord* lr, Fragment* f)
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool
|
||||
js_ContinueRecording(JSContext* cx, TraceRecorder* r, jsbytecode* oldpc)
|
||||
{
|
||||
#ifdef JS_THREADSAFE
|
||||
if (OBJ_SCOPE(JS_GetGlobalForObject(cx, cx->fp->scopeChain))->title.ownercx != cx) {
|
||||
#ifdef DEBUG
|
||||
printf("Global object not owned by this context.\n");
|
||||
#endif
|
||||
return false; /* we stay away from shared global objects */
|
||||
}
|
||||
#endif
|
||||
if (r->isLoopHeader(cx)) { /* did we hit the start point? */
|
||||
AUDIT(traceCompleted);
|
||||
r->closeLoop(JS_TRACE_MONITOR(cx).fragmento);
|
||||
js_DeleteRecorder(cx);
|
||||
return false; /* done recording */
|
||||
}
|
||||
if (++r->backEdgeCount >= MAX_XJUMPS) {
|
||||
AUDIT(returnToDifferentLoopHeader);
|
||||
debug_only(printf("loop edge %d -> %d, header %d\n",
|
||||
oldpc - cx->fp->script->code,
|
||||
cx->fp->regs->pc - cx->fp->script->code,
|
||||
(jsbytecode*)r->getFragment()->root->ip - cx->fp->script->code));
|
||||
js_AbortRecording(cx, oldpc, "Loop edge does not return to header");
|
||||
return false; /* done recording */
|
||||
}
|
||||
return true; /* keep recording (attempting to unroll inner loop) */
|
||||
}
|
||||
|
||||
bool
|
||||
js_LoopEdge(JSContext* cx, jsbytecode* oldpc, uintN& inlineCallCount)
|
||||
{
|
||||
JSTraceMonitor* tm = &JS_TRACE_MONITOR(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) {
|
||||
#ifdef DEBUG
|
||||
printf("Global object not owned by this context.\n");
|
||||
#endif
|
||||
return false; /* we stay away from shared global objects */
|
||||
}
|
||||
#endif
|
||||
if (r->isLoopHeader(cx)) { /* did we hit the start point? */
|
||||
AUDIT(traceCompleted);
|
||||
r->closeLoop(JS_TRACE_MONITOR(cx).fragmento);
|
||||
js_DeleteRecorder(cx);
|
||||
return false; /* done recording */
|
||||
}
|
||||
if (++r->backEdgeCount >= MAX_XJUMPS) {
|
||||
AUDIT(returnToDifferentLoopHeader);
|
||||
debug_only(printf("loop edge %d -> %d, header %d\n",
|
||||
oldpc - cx->fp->script->code,
|
||||
cx->fp->regs->pc - cx->fp->script->code,
|
||||
(jsbytecode*)r->getFragment()->root->ip - cx->fp->script->code));
|
||||
js_AbortRecording(cx, oldpc, "Loop edge does not return to header");
|
||||
return false; /* done recording */
|
||||
}
|
||||
return true; /* keep recording (attempting to unroll inner loop) */
|
||||
}
|
||||
if (tm->recorder)
|
||||
return js_ContinueRecording(cx, tm->recorder, oldpc);
|
||||
|
||||
Fragment* f = tm->fragmento->getLoop(cx->fp->regs->pc);
|
||||
if (!f->code()) {
|
||||
|
Loading…
Reference in New Issue
Block a user