Bug 1637314 - ZoneAllocPolicy's move assignment operator doesn't update the "zone_" member r=anba
authorJon Coppeard <jcoppeard@mozilla.com>
Thu, 14 May 2020 11:18:51 +0000
changeset 529851 9f648f9650c8a4fd3cbf6bfb6f1f4bdcfa7db78e
parent 529850 9ca31d0721fb91ef7345e024c68f387c481a83c3
child 529852 9685e26fe77d10bbb01174b755c4698b9be161f8
push id37416
push usercsabou@mozilla.com
push dateThu, 14 May 2020 16:15:31 +0000
treeherdermozilla-central@80ba3f3cfaf9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersanba
bugs1637314
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1637314 - ZoneAllocPolicy's move assignment operator doesn't update the "zone_" member r=anba Differential Revision: https://phabricator.services.mozilla.com/D75272
js/src/gc/ZoneAllocator.h
--- a/js/src/gc/ZoneAllocator.h
+++ b/js/src/gc/ZoneAllocator.h
@@ -242,17 +242,19 @@ class ZoneAllocPolicy : public MallocPro
 
   ZoneAllocPolicy& operator=(const ZoneAllocPolicy& other) {
     zone()->unregisterNonGCMemory(this, MemoryUse::ZoneAllocPolicy);
     zone_ = other.zone();
     zone()->registerNonGCMemory(this, MemoryUse::ZoneAllocPolicy);
     return *this;
   }
   ZoneAllocPolicy& operator=(ZoneAllocPolicy&& other) {
+    MOZ_ASSERT(this != &other);
     zone()->unregisterNonGCMemory(this, MemoryUse::ZoneAllocPolicy);
+    zone_ = other.zone();
     zone()->moveOtherMemory(this, &other, MemoryUse::ZoneAllocPolicy);
     other.zone_ = nullptr;
     return *this;
   }
 
   // Public methods required to fulfill the AllocPolicy interface.
 
   template <typename T>