From e3724fb9c0d13386c06e0e4250360004773d939a Mon Sep 17 00:00:00 2001 From: Jason Orendorff Date: Thu, 22 Apr 2010 07:34:28 -0500 Subject: [PATCH] Bug 553671 part 10 - Get rid of "goto restart_at_beginning;". r=luke. --HG-- extra : rebase_source : 9d0128640af7d366133d59fed9c21160078ba5ca --- js/src/jsgc.cpp | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 143a6ffff32..7863a694153 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -3520,28 +3520,33 @@ js_GC(JSContext *cx, JSGCInvocationKind gckind) #endif TIMESTAMP(gcTimer.enter); - restart_at_beginning: - if (!FireGCBegin(cx, gckind)) - return; + for (;;) { + if (!FireGCBegin(cx, gckind)) + return; - /* Lock out other GC allocator and collector invocations. */ - if (!(gckind & GC_LOCK_HELD)) - JS_LOCK_GC(rt); + { + /* Lock out other GC allocator and collector invocations. */ + Conditionally lockIf(!(gckind & GC_LOCK_HELD), rt); - if (!BeginGCSession(cx, gckind)) { - /* We're already doing GC or another thread did GC for us. */ - if (!(gckind & GC_LOCK_HELD)) - JS_UNLOCK_GC(rt); - return; - } + if (!BeginGCSession(cx, gckind)) { + /* We're already doing GC or another thread did GC for us. */ + return; + } - if (gckind == GC_SET_SLOT_REQUEST && !ProcessAllSetSlotRequests(cx, &gckind)) - return; + if (gckind == GC_SET_SLOT_REQUEST && !ProcessAllSetSlotRequests(cx, &gckind)) + return; - if (gckind != GC_SET_SLOT_REQUEST) { - if (!JS_ON_TRACE(cx)) - GCUntilDone(cx, gckind GCTIMER_ARG); - rt->setGCLastBytes(rt->gcBytes); + if (gckind != GC_SET_SLOT_REQUEST) { + if (!JS_ON_TRACE(cx)) + GCUntilDone(cx, gckind GCTIMER_ARG); + rt->setGCLastBytes(rt->gcBytes); + } + + EndGCSession(cx); + } + + if (FireGCEnd(cx, gckind)) + break; } EndGCSession(cx);