Bug 1240527: Fix tracing of RegExpStaticsObject; r=nbp
authorBenjamin Bouvier <benj@benj.me>
Mon, 18 Jan 2016 17:23:30 +0100
changeset 280754 bdaf35f4626f794e18842c53c8bf28fa37b6b550
parent 280753 14854a8f77dc201da02d4a7fad88f68032ba58b2
child 280755 8e7c3457b7f687b7b9c3654f9c36691f7e216518
push id29922
push usercbook@mozilla.com
push dateThu, 21 Jan 2016 10:51:00 +0000
treeherdermozilla-central@977d78a8dd78 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1240527
milestone46.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 1240527: Fix tracing of RegExpStaticsObject; r=nbp
js/src/jit-test/tests/gc/bug-1240527.js
js/src/vm/RegExpStatics.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/gc/bug-1240527.js
@@ -0,0 +1,14 @@
+if (typeof offThreadCompileScript !== 'function' ||
+    typeof runOffThreadScript !== 'function' ||
+    typeof oomTest !== 'function' ||
+    typeof fullcompartmentchecks !== 'function' ||
+    helperThreadCount() === 0)
+{
+    quit(0);
+}
+
+offThreadCompileScript(`
+ oomTest(() => "".search(/d/));
+ fullcompartmentchecks(3);
+`);
+runOffThreadScript();
--- a/js/src/vm/RegExpStatics.cpp
+++ b/js/src/vm/RegExpStatics.cpp
@@ -25,19 +25,18 @@ resc_finalize(FreeOp* fop, JSObject* obj
     RegExpStatics* res = static_cast<RegExpStatics*>(obj->as<RegExpStaticsObject>().getPrivate());
     fop->delete_(res);
 }
 
 static void
 resc_trace(JSTracer* trc, JSObject* obj)
 {
     void* pdata = obj->as<RegExpStaticsObject>().getPrivate();
-    MOZ_ASSERT(pdata);
-    RegExpStatics* res = static_cast<RegExpStatics*>(pdata);
-    res->mark(trc);
+    if (pdata)
+        static_cast<RegExpStatics*>(pdata)->mark(trc);
 }
 
 const Class RegExpStaticsObject::class_ = {
     "RegExpStatics",
     JSCLASS_HAS_PRIVATE,
     nullptr, /* addProperty */
     nullptr, /* delProperty */
     nullptr, /* getProperty */