mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1157382 - Fix possible data race caused by accessing the mark bits of cells in another runtime r=terrence
This commit is contained in:
parent
483f850c06
commit
38e7afe7ef
@ -222,6 +222,8 @@ class JS_FRIEND_API(GCCellPtr)
|
||||
return reinterpret_cast<uintptr_t>(asCell());
|
||||
}
|
||||
|
||||
bool mayBeOwnedByOtherRuntime() const;
|
||||
|
||||
private:
|
||||
uintptr_t checkedCast(void* p, JSGCTraceKind traceKind) {
|
||||
js::gc::Cell* cell = static_cast<js::gc::Cell*>(p);
|
||||
@ -365,6 +367,8 @@ GCThingIsMarkedGray(GCCellPtr thing)
|
||||
{
|
||||
if (js::gc::IsInsideNursery(thing.asCell()))
|
||||
return false;
|
||||
if (thing.mayBeOwnedByOtherRuntime())
|
||||
return false;
|
||||
return js::gc::detail::CellIsMarkedGray(thing.asCell());
|
||||
}
|
||||
|
||||
|
@ -6984,6 +6984,13 @@ JS::GCCellPtr::outOfLineKind() const
|
||||
return MapAllocToTraceKind(asCell()->asTenured().getAllocKind());
|
||||
}
|
||||
|
||||
bool
|
||||
JS::GCCellPtr::mayBeOwnedByOtherRuntime() const
|
||||
{
|
||||
return (isString() && toString()->isPermanentAtom()) ||
|
||||
(isSymbol() && toSymbol()->isWellKnownSymbol());
|
||||
}
|
||||
|
||||
#ifdef JSGC_HASH_TABLE_CHECKS
|
||||
void
|
||||
js::gc::CheckHashTablesAfterMovingGC(JSRuntime* rt)
|
||||
|
Loading…
Reference in New Issue
Block a user