mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 17:25:36 +00:00
Bug 1257982 - root some hashtables r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D23620 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
c10602d229
commit
961f447726
@ -78,6 +78,11 @@ class UsedNameTracker {
|
||||
|
||||
UsedNameInfo(UsedNameInfo&& other) : uses_(std::move(other.uses_)) {}
|
||||
|
||||
UsedNameInfo& operator=(UsedNameInfo&& other) {
|
||||
uses_ = std::move(other.uses_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool noteUsedInScope(uint32_t scriptId, uint32_t scopeId) {
|
||||
if (uses_.empty() || uses_.back().scopeId < scopeId) {
|
||||
return uses_.append(Use{scriptId, scopeId});
|
||||
@ -105,11 +110,13 @@ class UsedNameTracker {
|
||||
}
|
||||
};
|
||||
|
||||
using UsedNameMap = HashMap<JSAtom*, UsedNameInfo, DefaultHasher<JSAtom*>>;
|
||||
using UsedNameMap = GCHashMap<JSAtom*, UsedNameInfo, DefaultHasher<JSAtom*>>;
|
||||
|
||||
private:
|
||||
// The map of names to chains of uses.
|
||||
UsedNameMap map_;
|
||||
// The map of names to chains of uses. UsedNameTracker is not used in LIFO
|
||||
// order with Rooteds, so must use PersistentRooted (for the arbitrary
|
||||
// ordering capability, not for persistence.)
|
||||
PersistentRooted<UsedNameMap> map_;
|
||||
|
||||
// Monotonically increasing id for all nested scripts.
|
||||
uint32_t scriptCounter_;
|
||||
@ -119,7 +126,7 @@ class UsedNameTracker {
|
||||
|
||||
public:
|
||||
explicit UsedNameTracker(JSContext* cx)
|
||||
: map_(cx), scriptCounter_(0), scopeCounter_(0) {}
|
||||
: map_(cx, cx), scriptCounter_(0), scopeCounter_(0) {}
|
||||
|
||||
uint32_t nextScriptId() {
|
||||
MOZ_ASSERT(scriptCounter_ != UINT32_MAX,
|
||||
@ -665,4 +672,12 @@ class ParseContext : public Nestable<ParseContext> {
|
||||
|
||||
} // namespace js
|
||||
|
||||
namespace JS {
|
||||
|
||||
template <>
|
||||
struct GCPolicy<js::frontend::UsedNameTracker::UsedNameInfo>
|
||||
: public IgnoreGCPolicy {};
|
||||
|
||||
} // namespace JS
|
||||
|
||||
#endif // frontend_ParseContext_h
|
||||
|
@ -4538,7 +4538,7 @@ class MOZ_STACK_CLASS Debugger::ScriptQuery : public Debugger::QueryBase {
|
||||
hasLine(false),
|
||||
line(0),
|
||||
innermost(false),
|
||||
innermostForRealm(cx->zone()),
|
||||
innermostForRealm(cx, cx->zone()),
|
||||
scriptVector(cx, ScriptVector(cx)),
|
||||
lazyScriptVector(cx, LazyScriptVector(cx)),
|
||||
wasmInstanceVector(cx, WasmInstanceObjectVector(cx)) {}
|
||||
@ -4806,14 +4806,14 @@ class MOZ_STACK_CLASS Debugger::ScriptQuery : public Debugger::QueryBase {
|
||||
bool innermost;
|
||||
|
||||
using RealmToScriptMap =
|
||||
HashMap<Realm*, JSScript*, DefaultHasher<Realm*>, ZoneAllocPolicy>;
|
||||
GCHashMap<Realm*, JSScript*, DefaultHasher<Realm*>, ZoneAllocPolicy>;
|
||||
|
||||
/*
|
||||
* For 'innermost' queries, a map from realms to the innermost script
|
||||
* we've seen so far in that realm. (Template instantiation code size
|
||||
* explosion ho!)
|
||||
*/
|
||||
RealmToScriptMap innermostForRealm;
|
||||
Rooted<RealmToScriptMap> innermostForRealm;
|
||||
|
||||
/*
|
||||
* Accumulate the scripts in an Rooted<ScriptVector> and
|
||||
|
@ -3719,7 +3719,7 @@ bool js::GetFrameEnvironmentAndScope(JSContext* cx, AbstractFramePtr frame,
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
typedef HashSet<PropertyName*> PropertyNameSet;
|
||||
using PropertyNameSet = GCHashSet<PropertyName*>;
|
||||
|
||||
static bool RemoveReferencedNames(JSContext* cx, HandleScript script,
|
||||
PropertyNameSet& remainingNames) {
|
||||
@ -3797,7 +3797,7 @@ static bool RemoveReferencedNames(JSContext* cx, HandleScript script,
|
||||
static bool AnalyzeEntrainedVariablesInScript(JSContext* cx,
|
||||
HandleScript script,
|
||||
HandleScript innerScript) {
|
||||
PropertyNameSet remainingNames(cx);
|
||||
Rooted<PropertyNameSet> remainingNames(cx, cx);
|
||||
|
||||
for (BindingIter bi(script); bi; bi++) {
|
||||
if (bi.closedOver()) {
|
||||
@ -3809,7 +3809,7 @@ static bool AnalyzeEntrainedVariablesInScript(JSContext* cx,
|
||||
}
|
||||
}
|
||||
|
||||
if (!RemoveReferencedNames(cx, innerScript, remainingNames)) {
|
||||
if (!RemoveReferencedNames(cx, innerScript, remainingNames.get())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user