Bug 1455709 - Don't reset count of allocated bytes when max malloc parameter is changed r=sfink
authorJon Coppeard <jcoppeard@mozilla.com>
Wed, 25 Apr 2018 10:42:47 +0100
changeset 415625 37320f8b708c6aad8914e0d1da0b90affc1b613f
parent 415624 6696fd50114a8c105771f1e87e0b76cbf5761c26
child 415626 e19dc6140f5c4108fddddee62c9a977b97f08054
push id33901
push userapavel@mozilla.com
push dateThu, 26 Apr 2018 06:05:37 +0000
treeherdermozilla-central@b62ad926cf2a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1455709
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 1455709 - Don't reset count of allocated bytes when max malloc parameter is changed r=sfink
js/src/gc/GC.cpp
js/src/gc/Scheduling.h
js/src/jit-test/tests/gc/bug-1455709.js
--- a/js/src/gc/GC.cpp
+++ b/js/src/gc/GC.cpp
@@ -2048,41 +2048,34 @@ MemoryCounter::updateOnGCEnd(const GCSch
     bytes_ -= bytesAtStartOfGC_;
     triggered_ = NoTrigger;
 }
 
 void
 MemoryCounter::setMax(size_t newMax, const AutoLockGC& lock)
 {
     maxBytes_ = newMax;
-    reset();
 }
 
 void
 MemoryCounter::adopt(MemoryCounter& other)
 {
     update(other.bytes());
-    other.reset();
+    other.bytes_ = 0;
+    other.triggered_ = NoTrigger;
 }
 
 void
 MemoryCounter::recordTrigger(TriggerKind trigger)
 {
     MOZ_ASSERT(trigger > triggered_);
     triggered_ = trigger;
 }
 
 void
-MemoryCounter::reset()
-{
-    bytes_ = 0;
-    triggered_ = NoTrigger;
-}
-
-void
 GCMarker::delayMarkingArena(Arena* arena)
 {
     if (arena->hasDelayedMarking) {
         /* Arena already scheduled to be marked later */
         return;
     }
     arena->setNextDelayedMarking(unmarkedArenaStackTop);
     unmarkedArenaStackTop = arena;
--- a/js/src/gc/Scheduling.h
+++ b/js/src/gc/Scheduling.h
@@ -533,19 +533,16 @@ class MemoryCounter
     bool shouldResetIncrementalGC(const GCSchedulingTunables& tunables) const {
         return bytes_ > maxBytes_ * tunables.allocThresholdFactorAvoidInterrupt();
     }
 
     void recordTrigger(TriggerKind trigger);
 
     void updateOnGCStart();
     void updateOnGCEnd(const GCSchedulingTunables& tunables, const AutoLockGC& lock);
-
-  private:
-    void reset();
 };
 
 // This class encapsulates the data that determines when we need to do a zone GC.
 class ZoneHeapThreshold
 {
     // The "growth factor" for computing our next thresholds after a GC.
     GCLockData<double> gcHeapGrowthFactor_;
 
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/gc/bug-1455709.js
@@ -0,0 +1,6 @@
+gcslice(0);
+function testChangeParam(key) {
+    let prev = gcparam(key);
+    gcparam(key, prev);
+}
+testChangeParam("maxMallocBytes");