Back out b4c82e9838d5 (bug 939464) for make check assertions

CLOSED TREE
This commit is contained in:
Phil Ringnalda 2013-11-16 20:24:41 -08:00
parent 8480b24f62
commit a9a15f167e

View File

@ -365,34 +365,22 @@ class ZonesIter {
struct CompartmentsInZoneIter
{
// This is for the benefit of CompartmentsIterT::comp.
friend class mozilla::Maybe<CompartmentsInZoneIter>;
private:
JSCompartment **it, **end;
CompartmentsInZoneIter()
: it(nullptr), end(nullptr)
{}
public:
CompartmentsInZoneIter(JS::Zone *zone) {
it = zone->compartments.begin();
end = zone->compartments.end();
}
bool done() const {
JS_ASSERT(it);
return it == end;
}
bool done() const { return it == end; }
void next() {
JS_ASSERT(!done());
it++;
}
JSCompartment *get() const {
JS_ASSERT(it);
return *it;
}
JSCompartment *get() const { return *it; }
operator JSCompartment *() const { return get(); }
JSCompartment *operator->() const { return get(); }
@ -413,19 +401,15 @@ class CompartmentsIterT
CompartmentsIterT(JSRuntime *rt)
: zone(rt)
{
if (zone.done())
comp.construct();
else
if (!zone.done())
comp.construct(zone);
}
CompartmentsIterT(JSRuntime *rt, ZoneSelector selector)
: zone(rt, selector)
{
if (zone.done())
comp.construct();
else
comp.construct();
if (!zone.done())
comp.construct(zone);
}
bool done() const { return zone.done(); }
@ -435,6 +419,7 @@ class CompartmentsIterT
JS_ASSERT(!comp.ref().done());
comp.ref().next();
if (comp.ref().done()) {
comp.destroy();
zone.next();
if (!zone.done())
comp.construct(zone);