Bug 1457193 - Always initialise Arena header fields to fix assertion failures under valgrind r=sfink
authorJon Coppeard <jcoppeard@mozilla.com>
Mon, 30 Apr 2018 10:22:40 +0100
changeset 469813 9263b4c0044716e788fa6f6097c305501cb12faa
parent 469812 dded77ad7ac088527f220743cece9aca2f3ff764
child 469814 13ec6c3b62f0591e37faf6dfa60d48a1817f2258
push id9179
push userarchaeopteryx@coole-files.de
push dateThu, 03 May 2018 15:28:18 +0000
treeherdermozilla-beta@e6f9ade8bca7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1457193
milestone61.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 1457193 - Always initialise Arena header fields to fix assertion failures under valgrind r=sfink
js/src/gc/Heap-inl.h
--- a/js/src/gc/Heap-inl.h
+++ b/js/src/gc/Heap-inl.h
@@ -10,32 +10,36 @@
 #include "gc/Heap.h"
 
 #include "gc/StoreBuffer.h"
 #include "gc/Zone.h"
 
 inline void
 js::gc::Arena::init(JS::Zone* zoneArg, AllocKind kind, const AutoLockGC& lock)
 {
-    MOZ_MAKE_MEM_UNDEFINED(this, ArenaSize);
-
     MOZ_ASSERT(firstFreeSpan.isEmpty());
     MOZ_ASSERT(!zone);
     MOZ_ASSERT(!allocated());
     MOZ_ASSERT(!hasDelayedMarking);
     MOZ_ASSERT(!markOverflow);
     MOZ_ASSERT(!auxNextLink);
 
+    MOZ_MAKE_MEM_UNDEFINED(this, ArenaSize);
+
     zone = zoneArg;
     allocKind = size_t(kind);
-    setAsFullyUnused();
+    hasDelayedMarking = 0;
+    markOverflow = 0;
+    auxNextLink = 0;
     if (zone->isAtomsZone())
         zone->runtimeFromAnyThread()->gc.atomMarking.registerArena(this, lock);
     else
         bufferedCells() = &ArenaCellSet::Empty;
+
+    setAsFullyUnused();
 }
 
 inline void
 js::gc::Arena::release(const AutoLockGC& lock)
 {
     if (zone->isAtomsZone())
         zone->runtimeFromAnyThread()->gc.atomMarking.unregisterArena(this, lock);
     setAsNotAllocated();