bug 601234 - followup to restore tolerance of calling the allocator during the GC.
authorIgor Bukanov <igor@mir2.org>
Thu, 19 May 2011 15:34:37 +0200
changeset 69944 0621dbdec4c2dcb0002addcfd926cb537c9f84d8
parent 69943 e67746e7febde6b4f0e404e81b4dc2dea371a0d5
child 69945 354f0ee56b8e22509df1f3bb9a5aa5341cd76f25
push id20142
push usercleary@mozilla.com
push dateMon, 23 May 2011 07:31:35 +0000
treeherdermozilla-central@0f9347d40121 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs601234
milestone6.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 601234 - followup to restore tolerance of calling the allocator during the GC.
js/src/jsgc.cpp
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -1358,16 +1358,25 @@ RunLastDitchGC(JSContext *cx)
 
     return rt->gcBytes < rt->gcMaxBytes;
 }
 
 template <typename T>
 inline Cell *
 RefillTypedFreeList(JSContext *cx, unsigned thingKind)
 {
+    JS_ASSERT(!cx->runtime->gcRunning);
+
+    /*
+     * For compatibility with older code we tolerate calling the allocator
+     * during the GC in optimized builds.
+     */
+    if (cx->runtime->gcRunning)
+        return NULL;
+
     JSCompartment *compartment = cx->compartment;
     JS_ASSERT(!compartment->freeLists.finalizables[thingKind]);
 
     bool canGC = !JS_ON_TRACE(cx) && !JS_THREAD_DATA(cx)->waiveGCQuota;
     bool runGC = canGC && JS_UNLIKELY(NeedLastDitchGC(cx));
     for (;;) {
         if (runGC) {
             if (!RunLastDitchGC(cx))