Backed out changeset 1f9ee99573c0 (bug 1566195) for build bustage at workspace/build/src/js/src/ds/BitArray.h. On a CLOSED TREE

This commit is contained in:
Daniel Varga 2019-07-20 02:03:50 +03:00
Родитель 0ffc13301a
Коммит 5fc99498fc
3 изменённых файлов: 5 добавлений и 44 удалений

Просмотреть файл

@ -7,7 +7,6 @@
#ifndef ds_BitArray_h
#define ds_BitArray_h
#include "mozilla/MathAlgorithms.h"
#include "mozilla/TemplateLib.h"
#include <limits.h>
@ -17,34 +16,15 @@
namespace js {
namespace detail {
template <typename WordT>
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 <size_t nbits>
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);

Просмотреть файл

@ -2883,14 +2883,11 @@ static inline void TraceWholeCell(TenuringTracer& mover,
template <typename T>
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<T*>(uintptr_t(arena) + ArenaCellIndexBytes * bit);
reinterpret_cast<T*>(uintptr_t(arena) + ArenaCellIndexBytes * i);
TraceWholeCell(mover, cell);
bitset &= bitset - 1; // Clear the low bit.
}
}
}

Просмотреть файл

@ -504,8 +504,6 @@ class StoreBuffer {
class ArenaCellSet {
friend class StoreBuffer;
using ArenaCellBits = BitArray<MaxArenaCellIndex>;
// 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<MaxArenaCellIndex> 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