Bug 1527225 - Use mozilla::Clamp in maybeResizeNursery() r=jandem
☠☠ backed out by c6829642e2d0 ☠ ☠
authorPaul Bone <pbone@mozilla.com>
Wed, 13 Feb 2019 14:48:31 +0000
changeset 459071 43baecd33ce6
parent 459070 76e2c2df0ce0
child 459072 2ae0011bb82c
push id111913
push usershindli@mozilla.com
push dateThu, 14 Feb 2019 05:01:59 +0000
treeherdermozilla-inbound@a0752d7e8073 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1527225
milestone67.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 1527225 - Use mozilla::Clamp in maybeResizeNursery() r=jandem Differential Revision: https://phabricator.services.mozilla.com/D19473
js/src/gc/Nursery.cpp
--- a/js/src/gc/Nursery.cpp
+++ b/js/src/gc/Nursery.cpp
@@ -1169,22 +1169,22 @@ void js::Nursery::maybeResizeNursery(JS:
 
   // If one of these conditions is true then we always shrink or grow the
   // nursery.  This way the thresholds still have an effect even if the goal
   // seeking says the current size is ideal.
   if (promotionRate > GrowThreshold) {
     unsigned lowLimit = maxChunkCount() + 1;
     unsigned highLimit = Min(chunkCountLimit(), maxChunkCount() * 2);
 
-    growAllocableSpace(Min(Max(newChunkCount, lowLimit), highLimit));
+    growAllocableSpace(mozilla::Clamp(newChunkCount, lowLimit, highLimit));
   } else if (maxChunkCount() > 1 && promotionRate < ShrinkThreshold) {
     unsigned lowLimit = Max(1u, maxChunkCount() / 2);
     unsigned highLimit = maxChunkCount() - 1u;
 
-    shrinkAllocableSpace(Max(Min(newChunkCount, highLimit), lowLimit));
+    shrinkAllocableSpace(mozilla::Clamp(newChunkCount, lowLimit, highLimit));
   }
 }
 
 void js::Nursery::growAllocableSpace(unsigned newCount) {
   MOZ_ASSERT(newCount >= currentChunk_);
   maxChunkCount_ = newCount;
 }