From 08458a82d684e7dad43fe3637bfa43eca96e73d6 Mon Sep 17 00:00:00 2001 From: "brendan%mozilla.org" Date: Fri, 19 Sep 2003 18:36:50 +0000 Subject: [PATCH] Don't finish temp and code arena-pools in JS_GC, in case it's nesting in the compiler via the debugger (131712, r=rginda, sr=shaver). git-svn-id: svn://10.0.0.236/trunk@147065 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/js/src/jsapi.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mozilla/js/src/jsapi.c b/mozilla/js/src/jsapi.c index 9ecb4503d24..8a827bdf061 100644 --- a/mozilla/js/src/jsapi.c +++ b/mozilla/js/src/jsapi.c @@ -1665,10 +1665,13 @@ JS_MarkGCThing(JSContext *cx, void *thing, const char *name, void *arg) JS_PUBLIC_API(void) JS_GC(JSContext *cx) { + /* Don't nuke active arenas if executing or compiling. */ if (cx->stackPool.current == &cx->stackPool.first) JS_FinishArenaPool(&cx->stackPool); - JS_FinishArenaPool(&cx->codePool); - JS_FinishArenaPool(&cx->tempPool); + if (cx->codePool.current == &cx->codePool.first) + JS_FinishArenaPool(&cx->codePool); + if (cx->tempPool.current == &cx->tempPool.first) + JS_FinishArenaPool(&cx->tempPool); js_ForceGC(cx, 0); } @@ -2951,15 +2954,12 @@ CompileTokenStream(JSContext *cx, JSObject *obj, JSTokenStream *ts, if (!js_InitCodeGenerator(cx, &cg, ts->filename, ts->lineno, ts->principals)) { script = NULL; - goto out; - } - if (!js_CompileTokenStream(cx, obj, ts, &cg)) { + } else if (!js_CompileTokenStream(cx, obj, ts, &cg)) { script = NULL; eof = (ts->flags & TSF_EOF) != 0; - goto out; + } else { + script = js_NewScriptFromCG(cx, &cg, NULL); } - script = js_NewScriptFromCG(cx, &cg, NULL); -out: if (eofp) *eofp = eof; if (!js_CloseTokenStream(cx, ts)) {