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 593602 9f648f9650c8a4fd3cbf6bfb6f1f4bdcfa7db78e
parent 593601 9ca31d0721fb91ef7345e024c68f387c481a83c3
child 593603 9685e26fe77d10bbb01174b755c4698b9be161f8
push id13186
push userffxbld-merge
push dateMon, 01 Jun 2020 09:52:46 +0000
treeherdermozilla-beta@3e7c70a1e4a1 [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>