Bug 911182 - Add test that incremental GC is enabled (r=luke)
authorBill McCloskey <wmccloskey@mozilla.com>
Mon, 30 Sep 2013 12:24:51 -0700
changeset 149370 cf1653866a2ed2f1f478006627107a192e2fce40
parent 149369 1207ad888b054f360adef51b76f85ce900de73b7
child 149371 9e6846fd74a236c838422e6f7ea2bc3ee4ecedc0
push id25386
push useremorley@mozilla.com
push dateTue, 01 Oct 2013 09:29:22 +0000
treeherdermozilla-central@6856c45f3688 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs911182
milestone27.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 911182 - Add test that incremental GC is enabled (r=luke)
js/src/jsobj.cpp
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -1289,17 +1289,29 @@ NewObject(ExclusiveContext *cx, const Cl
 
     /*
      * This will cancel an already-running incremental GC from doing any more
      * slices, and it will prevent any future incremental GCs.
      */
     if (clasp->trace && !(clasp->flags & JSCLASS_IMPLEMENTS_BARRIERS)) {
         if (!cx->shouldBeJSContext())
             return NULL;
-        cx->asJSContext()->runtime()->gcIncrementalEnabled = false;
+        JSRuntime *rt = cx->asJSContext()->runtime();
+        rt->gcIncrementalEnabled = false;
+
+#ifdef DEBUG
+        if (rt->gcMode == JSGC_MODE_INCREMENTAL) {
+            fprintf(stderr,
+                    "The class %s has a trace hook but does not declare the\n"
+                    "JSCLASS_IMPLEMENTS_BARRIERS flag. Please ensure that it correctly\n"
+                    "implements write barriers and then set the flag.\n",
+                    clasp->name);
+            MOZ_CRASH();
+        }
+#endif
     }
 
     Probes::createObject(cx, obj);
     return obj;
 }
 
 void
 NewObjectCache::fillProto(EntryIndex entry, const Class *clasp, js::TaggedProto proto,