mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1178976: Add a post-write barrier to ObjectWeakMap::add. r=terrence
This commit is contained in:
parent
d950f33c64
commit
c56cf91c4a
@ -345,8 +345,6 @@ TryPreserveReflector(JSContext* cx, HandleObject obj)
|
||||
static inline void
|
||||
WeakMapPostWriteBarrier(JSRuntime* rt, ObjectValueMap* weakMap, JSObject* key)
|
||||
{
|
||||
// Strip the barriers from the type before inserting into the store buffer.
|
||||
// This will automatically ensure that barriers do not fire during GC.
|
||||
if (key && IsInsideNursery(key))
|
||||
rt->gc.storeBuffer.putGeneric(gc::HashKeyRef<ObjectValueMap, JSObject*>(weakMap, key));
|
||||
}
|
||||
@ -708,6 +706,8 @@ ObjectWeakMap::add(JSContext* cx, JSObject* obj, JSObject* target)
|
||||
ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
if (IsInsideNursery(obj))
|
||||
cx->runtime()->gc.storeBuffer.putGeneric(StoreBufferRef(&map, obj));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ class ObjectWeakMap
|
||||
{
|
||||
private:
|
||||
ObjectValueMap map;
|
||||
typedef gc::HashKeyRef<ObjectValueMap, JSObject*> StoreBufferRef;
|
||||
|
||||
public:
|
||||
explicit ObjectWeakMap(JSContext* cx);
|
||||
|
Loading…
Reference in New Issue
Block a user