mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 813419. Add a non-null-checking version of xpc_UnmarkGrayObject. r=mccr8
This commit is contained in:
parent
0dc548ff6f
commit
4479610b88
@ -478,10 +478,13 @@ template <class T>
|
||||
inline bool
|
||||
WrapNewBindingObject(JSContext* cx, JSObject* scope, T* value, JS::Value* vp)
|
||||
{
|
||||
JSObject* obj = value->GetWrapper();
|
||||
if (obj && js::GetObjectCompartment(obj) == js::GetObjectCompartment(scope)) {
|
||||
*vp = JS::ObjectValue(*obj);
|
||||
return true;
|
||||
JSObject* obj = value->GetWrapperPreserveColor();
|
||||
if (obj) {
|
||||
xpc_UnmarkNonNullGrayObject(obj);
|
||||
if (js::GetObjectCompartment(obj) == js::GetObjectCompartment(scope)) {
|
||||
*vp = JS::ObjectValue(*obj);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!obj) {
|
||||
|
@ -140,16 +140,23 @@ xpc_GCThingIsGrayCCThing(void *thing);
|
||||
extern void
|
||||
xpc_UnmarkGrayGCThingRecursive(void *thing, JSGCTraceKind kind);
|
||||
|
||||
// Unmark gray for known-nonnull cases
|
||||
MOZ_ALWAYS_INLINE void
|
||||
xpc_UnmarkNonNullGrayObject(JSObject *obj)
|
||||
{
|
||||
if (xpc_IsGrayGCThing(obj))
|
||||
xpc_UnmarkGrayGCThingRecursive(obj, JSTRACE_OBJECT);
|
||||
else if (JS::IsIncrementalBarrierNeededOnGCThing(obj))
|
||||
js::IncrementalReferenceBarrier(obj);
|
||||
}
|
||||
|
||||
// Remove the gray color from the given JSObject and any other objects that can
|
||||
// be reached through it.
|
||||
inline JSObject *
|
||||
MOZ_ALWAYS_INLINE JSObject *
|
||||
xpc_UnmarkGrayObject(JSObject *obj)
|
||||
{
|
||||
if (obj) {
|
||||
if (xpc_IsGrayGCThing(obj))
|
||||
xpc_UnmarkGrayGCThingRecursive(obj, JSTRACE_OBJECT);
|
||||
else if (JS::IsIncrementalBarrierNeededOnGCThing(obj))
|
||||
js::IncrementalReferenceBarrier(obj);
|
||||
xpc_UnmarkNonNullGrayObject(obj);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user