From 8866b384eeb83b3e9979d9b55dbb04bc7231a53c Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Tue, 19 May 2015 10:15:06 +0100 Subject: [PATCH] Bug 1165843 - Don't fire the pre-barrier in HeapPtr destructor r=terrence --- js/src/gc/Barrier.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/src/gc/Barrier.h b/js/src/gc/Barrier.h index be1f98b75ff..16dc08d2029 100644 --- a/js/src/gc/Barrier.h +++ b/js/src/gc/Barrier.h @@ -345,7 +345,6 @@ class BarrieredBase : public BarrieredBaseMixins T value; explicit BarrieredBase(T v) : value(v) {} - ~BarrieredBase() { pre(); } public: void init(T v) { @@ -400,6 +399,7 @@ class PreBarriered : public BarrieredBase MOZ_IMPLICIT PreBarriered(T v) : BarrieredBase(v) {} explicit PreBarriered(const PreBarriered& v) : BarrieredBase(v.value) {} + ~PreBarriered() { this->pre(); } /* Use to set the pointer to nullptr. */ void clear() { @@ -439,6 +439,7 @@ class HeapPtr : public BarrieredBase explicit HeapPtr(const HeapPtr& v) : BarrieredBase(v) { post(); } #ifdef DEBUG ~HeapPtr() { + // No prebarrier necessary as this only happens when we are sweeping. MOZ_ASSERT(CurrentThreadIsGCSweeping()); } #endif @@ -534,6 +535,7 @@ class RelocatablePtr : public BarrieredBase } ~RelocatablePtr() { + this->pre(); if (GCMethods::needsPostBarrier(this->value)) relocate(); }