Bug 1498177 - Use size_t for integer values particularly for comparisons r=sfink
authorPaul Bone <pbone@mozilla.com>
Fri, 12 Oct 2018 20:17:58 +1100
changeset 441329 e1f69bad9ab0d850d7fc9804321fac80a8a4a8ed
parent 441328 510af084fa3132f7a4611e33f0dee6fc6318eb7c
child 441330 414fe669452a2203910fb8da59fcdf211a249ca9
push id108955
push userpbone@mozilla.com
push dateMon, 15 Oct 2018 23:31:52 +0000
treeherdermozilla-inbound@e1f69bad9ab0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1498177
milestone64.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 1498177 - Use size_t for integer values particularly for comparisons r=sfink These values were compared as floats, where there was no sagnificant difference and the assertion failed.
js/src/gc/GC.cpp
js/src/jit-test/tests/gc/bug-1498177.js
--- a/js/src/gc/GC.cpp
+++ b/js/src/gc/GC.cpp
@@ -2088,18 +2088,18 @@ ZoneHeapThreshold::computeZoneHeapGrowth
     // the heap grow to 150%. For high frequency GCs we let the heap grow
     // depending on the heap size:
     //   lastBytes < highFrequencyLowLimit: 300%
     //   lastBytes > highFrequencyHighLimit: 150%
     //   otherwise: linear interpolation between 300% and 150% based on lastBytes
 
     float minRatio = tunables.highFrequencyHeapGrowthMin();
     float maxRatio = tunables.highFrequencyHeapGrowthMax();
-    float lowLimit = tunables.highFrequencyLowLimitBytes();
-    float highLimit = tunables.highFrequencyHighLimitBytes();
+    size_t lowLimit = tunables.highFrequencyLowLimitBytes();
+    size_t highLimit = tunables.highFrequencyHighLimitBytes();
 
     MOZ_ASSERT(minRatio <= maxRatio);
     MOZ_ASSERT(lowLimit < highLimit);
 
     if (lastBytes <= lowLimit) {
         return maxRatio;
     }
 
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/gc/bug-1498177.js
@@ -0,0 +1,17 @@
+
+let a, b;
+for (i=0; i < 300000; i++) {
+    let c = { a: a, b: b };
+    a = b;
+    b = c;
+}
+
+gc();
+
+// GCRuntime::setHighFrequencyHighLimit will change the low value to be one
+// byte lower than the high value (if necessary).  But this blew up later
+// when the values were mistakingly cast to float then compared, rather than
+// kept as size_t.
+gcparam('highFrequencyHighLimit', 99);
+
+