Skip to content
Snippets Groups Projects
Commit 672c5e11 authored by rswindell's avatar rswindell
Browse files

Use common JS branch callback (from js_internal.c).

parent da0e4b52
No related branches found
No related tags found
No related merge requests found
......@@ -532,28 +532,7 @@ js_BranchCallback(JSContext *cx, JSScript *script)
if((sbbs=(sbbs_t*)JS_GetContextPrivate(cx))==NULL)
return(JS_FALSE);
sbbs->js_branch.counter++;
/* Terminated? */
if(sbbs->js_branch.auto_terminate && sbbs->terminated) {
JS_ReportError(cx,"Terminated");
sbbs->js_branch.counter=0;
return(JS_FALSE);
}
/* Infinite loop? */
if(sbbs->js_branch.limit && sbbs->js_branch.counter>sbbs->js_branch.limit) {
JS_ReportError(cx,"Infinite loop (%lu branches) detected",sbbs->js_branch.counter);
sbbs->js_branch.counter=0;
return(JS_FALSE);
}
/* Give up timeslices every once in a while */
if(sbbs->js_branch.yield_interval && (sbbs->js_branch.counter%sbbs->js_branch.yield_interval)==0)
YIELD();
if(sbbs->js_branch.gc_interval && (sbbs->js_branch.counter%sbbs->js_branch.gc_interval)==0)
JS_MaybeGC(cx), sbbs->js_branch.gc_attempts++;
return(JS_TRUE);
return(js_CommonBranchCallback(cx,&sbbs->js_branch));
}
static const char* js_ext(const char* fname)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment