Bug 1028358. r=jonco, a=sledru
authorTerrence Cole <terrence@mozilla.com>
Mon, 23 Jun 2014 12:36:36 -0700
changeset 207382 8494ff92590ed8d0bd57a06ee56d1b3b53d16e00
parent 207381 dd22a3c18f5cf9ae0a42e1e2dc86ee12f94ed44c
child 207383 7ee79c993016fe6e6bdc4ca9155b54ef117f899e
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco, sledru
bugs1028358
milestone32.0a2
Bug 1028358. r=jonco, a=sledru
js/public/RootingAPI.h
--- a/js/public/RootingAPI.h
+++ b/js/public/RootingAPI.h
@@ -675,16 +675,34 @@ struct GCMethods<JSObject *>
         JS::HeapCellPostBarrier(reinterpret_cast<js::gc::Cell **>(vp));
     }
     static void relocate(JSObject **vp) {
         JS::HeapCellRelocate(reinterpret_cast<js::gc::Cell **>(vp));
     }
 #endif
 };
 
+template <>
+struct GCMethods<JSFunction *>
+{
+    static JSFunction *initial() { return nullptr; }
+    static bool poisoned(JSFunction *v) { return JS::IsPoisonedPtr(v); }
+    static bool needsPostBarrier(JSFunction *v) {
+        return v != nullptr && gc::IsInsideNursery(reinterpret_cast<gc::Cell *>(v));
+    }
+#ifdef JSGC_GENERATIONAL
+    static void postBarrier(JSFunction **vp) {
+        JS::HeapCellPostBarrier(reinterpret_cast<js::gc::Cell **>(vp));
+    }
+    static void relocate(JSFunction **vp) {
+        JS::HeapCellRelocate(reinterpret_cast<js::gc::Cell **>(vp));
+    }
+#endif
+};
+
 #ifdef JS_DEBUG
 /* This helper allows us to assert that Rooted<T> is scoped within a request. */
 extern JS_PUBLIC_API(bool)
 IsInRequest(JSContext *cx);
 #endif
 
 } /* namespace js */