Bug 1477626 - Remove use of JS_BIT in js/src/HashTable.h. r=Waldo draft
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 26 Jul 2018 20:12:55 +1000
changeset 822909 5ab2174e35a404ce3d1aa183e2bd74491046bba7
parent 822908 400d960660045c27fe87acd14c39534a59de1e7d
child 822910 22c713c4ba2dc77f3a51dd9ace2325922806916c
push id117517
push usernnethercote@mozilla.com
push dateThu, 26 Jul 2018 10:24:07 +0000
reviewersWaldo
bugs1477626
milestone63.0a1
Bug 1477626 - Remove use of JS_BIT in js/src/HashTable.h. r=Waldo MozReview-Commit-ID: DRba0Z0Olo0
js/public/HashTable.h
--- a/js/public/HashTable.h
+++ b/js/public/HashTable.h
@@ -1252,18 +1252,18 @@ class HashTable : private AllocPolicy
 #   define METER(x) x
 #else
 #   define METER(x)
 #endif
 
     // The default initial capacity is 32 (enough to hold 16 elements), but it
     // can be as low as 4.
     static const uint32_t sMinCapacity  = 4;
-    static const uint32_t sMaxInit      = JS_BIT(CAP_BITS - 1);
-    static const uint32_t sMaxCapacity  = JS_BIT(CAP_BITS);
+    static const uint32_t sMaxInit      = 1u << (CAP_BITS - 1);
+    static const uint32_t sMaxCapacity  = 1u << CAP_BITS;
 
     // Hash-table alpha is conceptually a fraction, but to avoid floating-point
     // math we implement it as a ratio of integers.
     static const uint8_t sAlphaDenominator = 4;
     static const uint8_t sMinAlphaNumerator = 1; // min alpha: 1/4
     static const uint8_t sMaxAlphaNumerator = 3; // max alpha: 3/4
 
     static const HashNumber sFreeKey = Entry::sFreeKey;
@@ -1549,17 +1549,17 @@ class HashTable : private AllocPolicy
     enum RebuildStatus { NotOverloaded, Rehashed, RehashFailed };
 
     RebuildStatus changeTableSize(int deltaLog2, FailureBehavior reportFailure = ReportFailure)
     {
         // Look, but don't touch, until we succeed in getting new entry store.
         Entry* oldTable = table;
         uint32_t oldCap = capacity();
         uint32_t newLog2 = js::kHashNumberBits - hashShift + deltaLog2;
-        uint32_t newCapacity = JS_BIT(newLog2);
+        uint32_t newCapacity = 1u << newLog2;
         if (MOZ_UNLIKELY(newCapacity > sMaxCapacity)) {
             if (reportFailure)
                 this->reportAllocOverflow();
             return RehashFailed;
         }
 
         Entry* newTable = createTable(*this, newCapacity, reportFailure);
         if (!newTable)
@@ -1787,17 +1787,17 @@ class HashTable : private AllocPolicy
     {
         MOZ_ASSERT(table);
         return entryCount;
     }
 
     uint32_t capacity() const
     {
         MOZ_ASSERT(table);
-        return JS_BIT(js::kHashNumberBits - hashShift);
+        return 1u << (js::kHashNumberBits - hashShift);
     }
 
     Generation generation() const
     {
         MOZ_ASSERT(table);
         return Generation(gen);
     }