зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1232672 - Use MOZ_WARN_UNUSED_RESULT to make ordered hash table clients check for failure r=sfink
This commit is contained in:
Родитель
498b421261
Коммит
ca7c3a9a54
|
@ -702,16 +702,19 @@ class OrderedHashMap
|
||||||
typedef typename Impl::Range Range;
|
typedef typename Impl::Range Range;
|
||||||
|
|
||||||
explicit OrderedHashMap(AllocPolicy ap = AllocPolicy()) : impl(ap) {}
|
explicit OrderedHashMap(AllocPolicy ap = AllocPolicy()) : impl(ap) {}
|
||||||
bool init() { return impl.init(); }
|
MOZ_WARN_UNUSED_RESULT bool init() { return impl.init(); }
|
||||||
uint32_t count() const { return impl.count(); }
|
uint32_t count() const { return impl.count(); }
|
||||||
bool has(const Key& key) const { return impl.has(key); }
|
bool has(const Key& key) const { return impl.has(key); }
|
||||||
Range all() { return impl.all(); }
|
Range all() { return impl.all(); }
|
||||||
const Entry* get(const Key& key) const { return impl.get(key); }
|
const Entry* get(const Key& key) const { return impl.get(key); }
|
||||||
Entry* get(const Key& key) { return impl.get(key); }
|
Entry* get(const Key& key) { return impl.get(key); }
|
||||||
template <typename V>
|
|
||||||
bool put(const Key& key, V&& value) { return impl.put(Entry(key, Forward<V>(value))); }
|
|
||||||
bool remove(const Key& key, bool* foundp) { return impl.remove(key, foundp); }
|
bool remove(const Key& key, bool* foundp) { return impl.remove(key, foundp); }
|
||||||
bool clear() { return impl.clear(); }
|
MOZ_WARN_UNUSED_RESULT bool clear() { return impl.clear(); }
|
||||||
|
|
||||||
|
template <typename V>
|
||||||
|
MOZ_WARN_UNUSED_RESULT bool put(const Key& key, V&& value) {
|
||||||
|
return impl.put(Entry(key, Forward<V>(value)));
|
||||||
|
}
|
||||||
|
|
||||||
void rekeyOneEntry(const Key& current, const Key& newKey) {
|
void rekeyOneEntry(const Key& current, const Key& newKey) {
|
||||||
const Entry* e = get(current);
|
const Entry* e = get(current);
|
||||||
|
@ -739,13 +742,13 @@ class OrderedHashSet
|
||||||
typedef typename Impl::Range Range;
|
typedef typename Impl::Range Range;
|
||||||
|
|
||||||
explicit OrderedHashSet(AllocPolicy ap = AllocPolicy()) : impl(ap) {}
|
explicit OrderedHashSet(AllocPolicy ap = AllocPolicy()) : impl(ap) {}
|
||||||
bool init() { return impl.init(); }
|
MOZ_WARN_UNUSED_RESULT bool init() { return impl.init(); }
|
||||||
uint32_t count() const { return impl.count(); }
|
uint32_t count() const { return impl.count(); }
|
||||||
bool has(const T& value) const { return impl.has(value); }
|
bool has(const T& value) const { return impl.has(value); }
|
||||||
Range all() { return impl.all(); }
|
Range all() { return impl.all(); }
|
||||||
bool put(const T& value) { return impl.put(value); }
|
MOZ_WARN_UNUSED_RESULT bool put(const T& value) { return impl.put(value); }
|
||||||
bool remove(const T& value, bool* foundp) { return impl.remove(value, foundp); }
|
bool remove(const T& value, bool* foundp) { return impl.remove(value, foundp); }
|
||||||
bool clear() { return impl.clear(); }
|
MOZ_WARN_UNUSED_RESULT bool clear() { return impl.clear(); }
|
||||||
|
|
||||||
void rekeyOneEntry(const T& current, const T& newKey) {
|
void rekeyOneEntry(const T& current, const T& newKey) {
|
||||||
return impl.rekeyOneEntry(current, newKey, newKey);
|
return impl.rekeyOneEntry(current, newKey, newKey);
|
||||||
|
|
|
@ -1764,8 +1764,11 @@ GCMarker::stop()
|
||||||
|
|
||||||
/* Free non-ballast stack memory. */
|
/* Free non-ballast stack memory. */
|
||||||
stack.reset();
|
stack.reset();
|
||||||
for (GCZonesIter zone(runtime()); !zone.done(); zone.next())
|
AutoEnterOOMUnsafeRegion oomUnsafe;
|
||||||
zone->gcWeakKeys.clear();
|
for (GCZonesIter zone(runtime()); !zone.done(); zone.next()) {
|
||||||
|
if (!zone->gcWeakKeys.clear())
|
||||||
|
oomUnsafe.crash("clearing weak keys in GCMarker::stop()");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1820,8 +1823,11 @@ GCMarker::leaveWeakMarkingMode()
|
||||||
|
|
||||||
// Table is expensive to maintain when not in weak marking mode, so we'll
|
// Table is expensive to maintain when not in weak marking mode, so we'll
|
||||||
// rebuild it upon entry rather than allow it to contain stale data.
|
// rebuild it upon entry rather than allow it to contain stale data.
|
||||||
for (GCZonesIter zone(runtime()); !zone.done(); zone.next())
|
AutoEnterOOMUnsafeRegion oomUnsafe;
|
||||||
zone->gcWeakKeys.clear();
|
for (GCZonesIter zone(runtime()); !zone.done(); zone.next()) {
|
||||||
|
if (!zone->gcWeakKeys.clear())
|
||||||
|
oomUnsafe.crash("clearing weak keys in GCMarker::leaveWeakMarkingMode()");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -4310,13 +4310,14 @@ js::gc::MarkingValidator::nonIncrementalMark()
|
||||||
if (!WeakMapBase::saveZoneMarkedWeakMaps(zone, markedWeakMaps))
|
if (!WeakMapBase::saveZoneMarkedWeakMaps(zone, markedWeakMaps))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
AutoEnterOOMUnsafeRegion oomUnsafe;
|
||||||
for (gc::WeakKeyTable::Range r = zone->gcWeakKeys.all(); !r.empty(); r.popFront()) {
|
for (gc::WeakKeyTable::Range r = zone->gcWeakKeys.all(); !r.empty(); r.popFront()) {
|
||||||
AutoEnterOOMUnsafeRegion oomUnsafe;
|
|
||||||
if (!savedWeakKeys.put(Move(r.front().key), Move(r.front().value)))
|
if (!savedWeakKeys.put(Move(r.front().key), Move(r.front().value)))
|
||||||
oomUnsafe.crash("saving weak keys table for validator");
|
oomUnsafe.crash("saving weak keys table for validator");
|
||||||
}
|
}
|
||||||
|
|
||||||
zone->gcWeakKeys.clear();
|
if (!zone->gcWeakKeys.clear())
|
||||||
|
oomUnsafe.crash("clearing weak keys table for validator");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -4387,7 +4388,9 @@ js::gc::MarkingValidator::nonIncrementalMark()
|
||||||
|
|
||||||
for (GCZonesIter zone(runtime); !zone.done(); zone.next()) {
|
for (GCZonesIter zone(runtime); !zone.done(); zone.next()) {
|
||||||
WeakMapBase::unmarkZone(zone);
|
WeakMapBase::unmarkZone(zone);
|
||||||
zone->gcWeakKeys.clear();
|
AutoEnterOOMUnsafeRegion oomUnsafe;
|
||||||
|
if (!zone->gcWeakKeys.clear())
|
||||||
|
oomUnsafe.crash("clearing weak keys table for validator");
|
||||||
}
|
}
|
||||||
|
|
||||||
WeakMapBase::restoreMarkedWeakMaps(markedWeakMaps);
|
WeakMapBase::restoreMarkedWeakMaps(markedWeakMaps);
|
||||||
|
@ -5074,7 +5077,9 @@ GCRuntime::beginSweepingZoneGroup()
|
||||||
zone->gcWeakRefs.clear();
|
zone->gcWeakRefs.clear();
|
||||||
|
|
||||||
/* No need to look up any more weakmap keys from this zone group. */
|
/* No need to look up any more weakmap keys from this zone group. */
|
||||||
zone->gcWeakKeys.clear();
|
AutoEnterOOMUnsafeRegion oomUnsafe;
|
||||||
|
if (!zone->gcWeakKeys.clear())
|
||||||
|
oomUnsafe.crash("clearing weak keys in beginSweepingZoneGroup()");
|
||||||
}
|
}
|
||||||
|
|
||||||
FreeOp fop(rt);
|
FreeOp fop(rt);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче