From 5fc99498fc68f9c00d4c478efcddbfe5bd3fb602 Mon Sep 17 00:00:00 2001 From: Daniel Varga Date: Sat, 20 Jul 2019 02:03:50 +0300 Subject: [PATCH] Backed out changeset 1f9ee99573c0 (bug 1566195) for build bustage at workspace/build/src/js/src/ds/BitArray.h. On a CLOSED TREE --- js/src/ds/BitArray.h | 30 +----------------------------- js/src/gc/Marking.cpp | 9 +++------ js/src/gc/StoreBuffer.h | 10 +--------- 3 files changed, 5 insertions(+), 44 deletions(-) diff --git a/js/src/ds/BitArray.h b/js/src/ds/BitArray.h index 8105ac5f2ab3..e5e8d032ad4b 100644 --- a/js/src/ds/BitArray.h +++ b/js/src/ds/BitArray.h @@ -7,7 +7,6 @@ #ifndef ds_BitArray_h #define ds_BitArray_h -#include "mozilla/MathAlgorithms.h" #include "mozilla/TemplateLib.h" #include @@ -17,34 +16,15 @@ namespace js { -namespace detail { - -template -uint8_fast_t CountTrailingZeroes(WordT word); - -template<> -uint8_fast_t CountTrailingZeroes(uint32_t word) { - return mozilla::CountTrailingZeroes32(word); -} - -template<> -uint8_fast_t CountTrailingZeroes(uint64_t word) { - return mozilla::CountTrailingZeroes64(word); -} - -} // namespace detail - template class BitArray { - public: + private: // Use a 32 bit word to make it easier to access a BitArray from JIT code. using WordT = uint32_t; static const size_t bitsPerElement = sizeof(WordT) * CHAR_BIT; static const size_t numSlots = nbits / bitsPerElement + (nbits % bitsPerElement == 0 ? 0 : 1); - - private: static const size_t paddingBits = (numSlots * bitsPerElement) - nbits; static_assert(paddingBits < bitsPerElement, "More padding bits than expected."); @@ -66,7 +46,6 @@ class BitArray { size_t index; WordT mask; getIndexAndMask(offset, &index, &mask); - MOZ_ASSERT(index < numSlots); return map[index] & mask; } @@ -93,14 +72,7 @@ class BitArray { return true; } - // For iterating over the set bits in the bit array, get a word at a time. - WordT getWord(size_t elementIndex) const { - MOZ_ASSERT(elementIndex < numSlots); - return map[elementIndex]; - } - static void getIndexAndMask(size_t offset, size_t* indexp, WordT* maskp) { - MOZ_ASSERT(offset < numSlots); static_assert(bitsPerElement == 32, "unexpected bitsPerElement value"); *indexp = offset / bitsPerElement; *maskp = WordT(1) << (offset % bitsPerElement); diff --git a/js/src/gc/Marking.cpp b/js/src/gc/Marking.cpp index 51dc9baf309a..c2f2a3182a05 100644 --- a/js/src/gc/Marking.cpp +++ b/js/src/gc/Marking.cpp @@ -2883,14 +2883,11 @@ static inline void TraceWholeCell(TenuringTracer& mover, template static void TraceBufferedCells(TenuringTracer& mover, Arena* arena, ArenaCellSet* cells) { - for (size_t i = 0; i < MaxArenaCellIndex; i += cells->BitsPerWord) { - ArenaCellSet::WordT bitset = cells->getWord(i / cells->BitsPerWord); - while (bitset) { - int bit = i + js::detail::CountTrailingZeroes(bitset); + for (size_t i = 0; i < MaxArenaCellIndex; i++) { + if (cells->hasCell(i)) { auto cell = - reinterpret_cast(uintptr_t(arena) + ArenaCellIndexBytes * bit); + reinterpret_cast(uintptr_t(arena) + ArenaCellIndexBytes * i); TraceWholeCell(mover, cell); - bitset &= bitset - 1; // Clear the low bit. } } } diff --git a/js/src/gc/StoreBuffer.h b/js/src/gc/StoreBuffer.h index 294f1c0b37de..585f119116c7 100644 --- a/js/src/gc/StoreBuffer.h +++ b/js/src/gc/StoreBuffer.h @@ -504,8 +504,6 @@ class StoreBuffer { class ArenaCellSet { friend class StoreBuffer; - using ArenaCellBits = BitArray; - // The arena this relates to. Arena* arena; @@ -513,7 +511,7 @@ class ArenaCellSet { ArenaCellSet* next; // Bit vector for each possible cell start position. - ArenaCellBits bits; + BitArray bits; #ifdef DEBUG // The minor GC number when this was created. This object should not survive @@ -533,10 +531,6 @@ class ArenaCellSet { } public: - using WordT = ArenaCellBits::WordT; - const size_t BitsPerWord = ArenaCellBits::bitsPerElement; - const size_t NumWords = ArenaCellBits::numSlots; - ArenaCellSet(Arena* arena, ArenaCellSet* next); bool hasCell(const TenuredCell* cell) const { @@ -553,8 +547,6 @@ class ArenaCellSet { void check() const; - WordT getWord(size_t wordIndex) const { return bits.getWord(wordIndex); } - // Sentinel object used for all empty sets. // // We use a sentinel because it simplifies the JIT code slightly as we can