Bug 1477626 - Remove use of JS_BIT in js/src/HashTable.h. r=Waldo
MozReview-Commit-ID: DRba0Z0Olo0
--- 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);
}