Bug 949038 - Fix windows browser build error in jsweakmap.h with generational GC r=terrence
This commit is contained in:
@@ -269,17 +269,26 @@ TryPreserveReflector(JSContext *cx, HandleObject obj)
|
||||
}
|
||||
|
||||
static inline void
|
||||
WeakMapPostWriteBarrier(JSRuntime *rt, ObjectValueMap *map, JSObject *key)
|
||||
WeakMapPostWriteBarrier(JSRuntime *rt, ObjectValueMap *weakMap, JSObject *key)
|
||||
{
|
||||
#ifdef JSGC_GENERATIONAL
|
||||
/*
|
||||
* Strip the barriers from the type before inserting into the store buffer.
|
||||
* This will automatically ensure that barriers do not fire during GC.
|
||||
*
|
||||
* Some compilers complain about instantiating the WeakMap class for
|
||||
* unbarriered type arguments, so we cast to a HashMap instead. Because of
|
||||
* WeakMap's multiple inheritace, We need to do this in two stages, first to
|
||||
* the HashMap base class and then to the unbarriered version.
|
||||
*/
|
||||
typedef WeakMap<JSObject *, Value> UnbarrieredObjectValueMap;
|
||||
typedef gc::HashKeyRef<UnbarrieredObjectValueMap, JSObject *> Ref;
|
||||
ObjectValueMap::Base *baseHashMap = static_cast<ObjectValueMap::Base *>(weakMap);
|
||||
|
||||
typedef HashMap<JSObject *, Value> UnbarrieredMap;
|
||||
UnbarrieredMap *unbarrieredMap = reinterpret_cast<UnbarrieredMap *>(baseHashMap);
|
||||
|
||||
typedef gc::HashKeyRef<UnbarrieredMap, JSObject *> Ref;
|
||||
if (key && IsInsideNursery(rt, key))
|
||||
rt->gcStoreBuffer.putGeneric(Ref(reinterpret_cast<UnbarrieredObjectValueMap *>(map), key));
|
||||
rt->gcStoreBuffer.putGeneric(Ref((unbarrieredMap), key));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user