mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1248726 - Simplify PCLocationMap even further; r=fitzgen
This commit is contained in:
parent
97fa807eb0
commit
403ceb2af6
@ -999,10 +999,8 @@ SavedFrame::toStringMethod(JSContext* cx, unsigned argc, Value* vp)
|
||||
bool
|
||||
SavedStacks::init()
|
||||
{
|
||||
if (!pcLocationMap.init())
|
||||
return false;
|
||||
|
||||
return frames.init();
|
||||
return frames.init() &&
|
||||
pcLocationMap.init();
|
||||
}
|
||||
|
||||
bool
|
||||
@ -1049,13 +1047,7 @@ SavedStacks::sweep()
|
||||
void
|
||||
SavedStacks::trace(JSTracer* trc)
|
||||
{
|
||||
if (pcLocationMap.initialized()) {
|
||||
// Mark each of the source strings in our pc to location cache.
|
||||
for (PCLocationMap::Enum e(pcLocationMap); !e.empty(); e.popFront()) {
|
||||
LocationValue& loc = e.front().value();
|
||||
TraceEdge(trc, &loc.source, "SavedStacks::PCLocationMap's memoized script source name");
|
||||
}
|
||||
}
|
||||
pcLocationMap.trace(trc);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
|
@ -223,6 +223,7 @@ class SavedStacks {
|
||||
RelocatablePtrScript script;
|
||||
jsbytecode* pc;
|
||||
|
||||
void trace(JSTracer* trc) { /* PCKey is weak. */ }
|
||||
bool needsSweep() { return IsAboutToBeFinalized(&script); }
|
||||
};
|
||||
|
||||
@ -239,8 +240,12 @@ class SavedStacks {
|
||||
}
|
||||
|
||||
bool needsSweep() {
|
||||
// LocationValue is always held strongly, but in a weak map.
|
||||
// Assert that it has been marked already, but allow it to be
|
||||
// ejected from the map when the key dies.
|
||||
MOZ_ASSERT(source);
|
||||
return IsAboutToBeFinalized(&source);
|
||||
MOZ_ASSERT(!IsAboutToBeFinalized(&source));
|
||||
return true;
|
||||
}
|
||||
|
||||
RelocatablePtrAtom source;
|
||||
@ -282,6 +287,13 @@ class SavedStacks {
|
||||
}
|
||||
};
|
||||
|
||||
// We eagerly Atomize the script source stored in LocationValue because
|
||||
// asm.js does not always have a JSScript and the source might not be
|
||||
// available when we need it later. However, since the JSScript does not
|
||||
// actually hold this atom, we have to trace it strongly to keep it alive.
|
||||
// Thus, it takes two GC passes to fully clean up this table: the first GC
|
||||
// removes the dead script; the second will clear out the source atom since
|
||||
// it is no longer held by the table.
|
||||
using PCLocationMap = GCHashMap<PCKey, LocationValue, PCLocationHasher, SystemAllocPolicy>;
|
||||
PCLocationMap pcLocationMap;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user