зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1248726 - Simplify PCLocationMap even further; r=fitzgen
--HG-- extra : rebase_source : 67a0d2a65524b4caae980f86efab0302582e68dc
This commit is contained in:
Родитель
a22220e378
Коммит
d3d4918db0
|
@ -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;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче