mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-22 02:09:28 +00:00
Bug 1336467 - Don't blacken weakmap key unless both the delegate and the map are black r=mccr8
This commit is contained in:
parent
861ffe9744
commit
5dd6187a2c
@ -247,10 +247,10 @@ struct FixWeakMappingGrayBitsTracer : public js::WeakMapTracer
|
||||
void trace(JSObject* aMap, JS::GCCellPtr aKey, JS::GCCellPtr aValue) override
|
||||
{
|
||||
// If nothing that could be held alive by this entry is marked gray, return.
|
||||
bool delegateMightNeedMarking = aKey && JS::GCThingIsMarkedGray(aKey);
|
||||
bool keyMightNeedMarking = aKey && JS::GCThingIsMarkedGray(aKey);
|
||||
bool valueMightNeedMarking = aValue && JS::GCThingIsMarkedGray(aValue) &&
|
||||
aValue.kind() != JS::TraceKind::String;
|
||||
if (!delegateMightNeedMarking && !valueMightNeedMarking) {
|
||||
if (!keyMightNeedMarking && !valueMightNeedMarking) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -258,9 +258,11 @@ struct FixWeakMappingGrayBitsTracer : public js::WeakMapTracer
|
||||
aKey = nullptr;
|
||||
}
|
||||
|
||||
if (delegateMightNeedMarking && aKey.is<JSObject>()) {
|
||||
if (keyMightNeedMarking && aKey.is<JSObject>()) {
|
||||
JSObject* kdelegate = js::GetWeakmapKeyDelegate(&aKey.as<JSObject>());
|
||||
if (kdelegate && !JS::ObjectIsMarkedGray(kdelegate)) {
|
||||
if (kdelegate && !JS::ObjectIsMarkedGray(kdelegate) &&
|
||||
(!aMap || !JS::ObjectIsMarkedGray(aMap)))
|
||||
{
|
||||
if (JS::UnmarkGrayGCThingRecursively(aKey)) {
|
||||
mAnyMarked = true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user