Bug 1165843 - Don't fire the pre-barrier in HeapPtr destructor r=terrence

This commit is contained in:
Jon Coppeard 2015-05-19 10:15:06 +01:00
parent 5a1602109d
commit 8866b384ee

View File

@ -345,7 +345,6 @@ class BarrieredBase : public BarrieredBaseMixins<T>
T value; T value;
explicit BarrieredBase(T v) : value(v) {} explicit BarrieredBase(T v) : value(v) {}
~BarrieredBase() { pre(); }
public: public:
void init(T v) { void init(T v) {
@ -400,6 +399,7 @@ class PreBarriered : public BarrieredBase<T>
MOZ_IMPLICIT PreBarriered(T v) : BarrieredBase<T>(v) {} MOZ_IMPLICIT PreBarriered(T v) : BarrieredBase<T>(v) {}
explicit PreBarriered(const PreBarriered<T>& v) explicit PreBarriered(const PreBarriered<T>& v)
: BarrieredBase<T>(v.value) {} : BarrieredBase<T>(v.value) {}
~PreBarriered() { this->pre(); }
/* Use to set the pointer to nullptr. */ /* Use to set the pointer to nullptr. */
void clear() { void clear() {
@ -439,6 +439,7 @@ class HeapPtr : public BarrieredBase<T>
explicit HeapPtr(const HeapPtr<T>& v) : BarrieredBase<T>(v) { post(); } explicit HeapPtr(const HeapPtr<T>& v) : BarrieredBase<T>(v) { post(); }
#ifdef DEBUG #ifdef DEBUG
~HeapPtr() { ~HeapPtr() {
// No prebarrier necessary as this only happens when we are sweeping.
MOZ_ASSERT(CurrentThreadIsGCSweeping()); MOZ_ASSERT(CurrentThreadIsGCSweeping());
} }
#endif #endif
@ -534,6 +535,7 @@ class RelocatablePtr : public BarrieredBase<T>
} }
~RelocatablePtr() { ~RelocatablePtr() {
this->pre();
if (GCMethods<T>::needsPostBarrier(this->value)) if (GCMethods<T>::needsPostBarrier(this->value))
relocate(); relocate();
} }