Bug 995442 - Don't post-barrier non-objects in the browser; r=sfink

This commit is contained in:
Terrence Cole 2014-04-11 14:29:14 -07:00
parent 0524b56789
commit ef5f219fda

View File

@ -652,12 +652,25 @@ struct GCMethods<T *>
static T *initial() { return nullptr; }
static ThingRootKind kind() { return RootKind<T *>::rootKind(); }
static bool poisoned(T *v) { return JS::IsPoisonedPtr(v); }
static bool needsPostBarrier(T *v) { return v; }
static bool needsPostBarrier(T *v) { return false; }
#ifdef JSGC_GENERATIONAL
static void postBarrier(T **vp) {
static void postBarrier(T **vp) {}
static void relocate(T **vp) {}
#endif
};
template <>
struct GCMethods<JSObject *>
{
static JSObject *initial() { return nullptr; }
static ThingRootKind kind() { return RootKind<JSObject *>::rootKind(); }
static bool poisoned(JSObject *v) { return JS::IsPoisonedPtr(v); }
static bool needsPostBarrier(JSObject *v) { return v; }
#ifdef JSGC_GENERATIONAL
static void postBarrier(JSObject **vp) {
JS::HeapCellPostBarrier(reinterpret_cast<js::gc::Cell **>(vp));
}
static void relocate(T **vp) {
static void relocate(JSObject **vp) {
JS::HeapCellRelocate(reinterpret_cast<js::gc::Cell **>(vp));
}
#endif