mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 13:57:32 +00:00
Bug 1212624 - Use range-based iteration for various LinkedList<T> in spidermonkey, r=Waldo
--HG-- extra : rebase_source : ccc41529a6423dfb87a8d845453473925c49bb11
This commit is contained in:
parent
2ac5b36223
commit
8c309b8afc
@ -220,7 +220,7 @@ struct PersistentRootedMarker
|
||||
static void
|
||||
markChain(JSTracer* trc, List& list, const char* name)
|
||||
{
|
||||
for (Element* r = list.getFirst(); r; r = r->getNext())
|
||||
for (Element* r : list)
|
||||
TraceFn(trc, r->address(), name);
|
||||
}
|
||||
};
|
||||
|
@ -2439,7 +2439,7 @@ Debugger::markIncomingCrossCompartmentEdges(JSTracer* trc)
|
||||
gc::State state = rt->gc.state();
|
||||
MOZ_ASSERT(state == gc::MARK_ROOTS || state == gc::COMPACT);
|
||||
|
||||
for (Debugger* dbg = rt->debuggerList.getFirst(); dbg; dbg = dbg->getNext()) {
|
||||
for (Debugger* dbg : rt->debuggerList) {
|
||||
Zone* zone = dbg->object->zone();
|
||||
if ((state == gc::MARK_ROOTS && !zone->isCollecting()) ||
|
||||
(state == gc::COMPACT && !zone->isGCCompacting()))
|
||||
@ -2535,7 +2535,7 @@ Debugger::markAllIteratively(GCMarker* trc)
|
||||
Debugger::markAll(JSTracer* trc)
|
||||
{
|
||||
JSRuntime* rt = trc->runtime();
|
||||
for (Debugger* dbg = rt->debuggerList.getFirst(); dbg; dbg = dbg->getNext()) {
|
||||
for (Debugger* dbg : rt->debuggerList) {
|
||||
WeakGlobalObjectSet& debuggees = dbg->debuggees;
|
||||
for (WeakGlobalObjectSet::Enum e(debuggees); !e.empty(); e.popFront()) {
|
||||
GlobalObject* global = e.front();
|
||||
@ -2607,7 +2607,7 @@ Debugger::sweepAll(FreeOp* fop)
|
||||
{
|
||||
JSRuntime* rt = fop->runtime();
|
||||
|
||||
for (Debugger* dbg = rt->debuggerList.getFirst(); dbg; dbg = dbg->getNext()) {
|
||||
for (Debugger* dbg : rt->debuggerList) {
|
||||
if (IsAboutToBeFinalized(&dbg->object)) {
|
||||
/*
|
||||
* dbg is being GC'd. Detach it from its debuggees. The debuggee
|
||||
@ -2638,10 +2638,7 @@ Debugger::findZoneEdges(Zone* zone, js::gc::ComponentFinder<Zone>& finder)
|
||||
* This ensure that debuggers and their debuggees are finalized in the same
|
||||
* group.
|
||||
*/
|
||||
for (Debugger* dbg = zone->runtimeFromMainThread()->debuggerList.getFirst();
|
||||
dbg;
|
||||
dbg = dbg->getNext())
|
||||
{
|
||||
for (Debugger* dbg : zone->runtimeFromMainThread()->debuggerList) {
|
||||
Zone* w = dbg->object->zone();
|
||||
if (w == zone || !w->isGCMarking())
|
||||
continue;
|
||||
@ -8479,7 +8476,7 @@ FireOnGarbageCollectionHook(JSContext* cx, JS::dbg::GarbageCollectionEvent::Ptr&
|
||||
// participated in this GC.
|
||||
AutoCheckCannotGC noGC;
|
||||
|
||||
for (Debugger* dbg = cx->runtime()->debuggerList.getFirst(); dbg; dbg = dbg->getNext()) {
|
||||
for (Debugger* dbg : cx->runtime()->debuggerList) {
|
||||
if (dbg->enabled &&
|
||||
dbg->observedGC(data->majorGCNumber()) &&
|
||||
dbg->getHook(Debugger::OnGarbageCollection))
|
||||
|
@ -93,16 +93,6 @@ class DebuggerWeakMap : private WeakMap<PreBarriered<UnbarrieredKey>, Relocatabl
|
||||
compartment(cx->compartment())
|
||||
{ }
|
||||
|
||||
~DebuggerWeakMap() {
|
||||
// If our owning Debugger fails construction after already initializing
|
||||
// this DebuggerWeakMap, we need to make sure that we aren't in the
|
||||
// compartment's weak map list anymore. Normally, when we are destroyed
|
||||
// because the GC finds us unreachable, the GC takes care of removing us
|
||||
// from this list.
|
||||
if (WeakMapBase::isInList())
|
||||
WeakMapBase::removeWeakMapFromList(this);
|
||||
}
|
||||
|
||||
public:
|
||||
/* Expose those parts of HashMap public interface that are used by Debugger methods. */
|
||||
|
||||
@ -210,6 +200,7 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
|
||||
friend class DebuggerMemory;
|
||||
friend class SavedStacks;
|
||||
friend class mozilla::LinkedListElement<Debugger>;
|
||||
friend class mozilla::LinkedList<Debugger>;
|
||||
friend bool (::JS_DefineDebuggerObject)(JSContext* cx, JS::HandleObject obj);
|
||||
friend bool (::JS::dbg::IsDebugger)(JSObject&);
|
||||
friend bool (::JS::dbg::GetDebuggeeGlobals)(JSContext*, JSObject&, AutoObjectVector&);
|
||||
|
@ -1780,10 +1780,7 @@ ComputePlainObjectLayout(ExclusiveContext* cx, Shape* templateShape,
|
||||
// properties, which will allow us to generate better code if the objects
|
||||
// have a subtype/supertype relation and are accessed at common sites.
|
||||
UnboxedLayout* bestExisting = nullptr;
|
||||
for (UnboxedLayout* existing = cx->compartment()->unboxedLayouts.getFirst();
|
||||
existing;
|
||||
existing = existing->getNext())
|
||||
{
|
||||
for (UnboxedLayout* existing : cx->compartment()->unboxedLayouts) {
|
||||
if (PropertiesAreSuperset(properties, existing)) {
|
||||
if (!bestExisting ||
|
||||
existing->properties().length() > bestExisting->properties().length())
|
||||
|
Loading…
x
Reference in New Issue
Block a user