mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 09:15:35 +00:00
Bug 1587238 - Remove BinASTTokenReaderContext::variantsTable_ and FlatHuffmanKey. r=Yoric
Differential Revision: https://phabricator.services.mozilla.com/D48653 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
712cf567f2
commit
490add935c
@ -1602,22 +1602,6 @@ HuffmanKey::HuffmanKey(const uint32_t bits, const uint8_t bitLength)
|
|||||||
MOZ_ASSERT_IF(bitLength_ != 32 /* >> 32 is UB */, bits >> bitLength == 0);
|
MOZ_ASSERT_IF(bitLength_ != 32 /* >> 32 is UB */, bits >> bitLength == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
FlatHuffmanKey::FlatHuffmanKey(HuffmanKey key)
|
|
||||||
: representation_((key.bitLength_ << MAX_CODE_BIT_LENGTH) | key.bits_) {
|
|
||||||
static_assert(MAX_CODE_BIT_LENGTH + MAX_BIT_LENGTH_BIT_LENGTH <= 32,
|
|
||||||
"32 bits MUST be sufficient to store bits and bitLength");
|
|
||||||
MOZ_ASSERT(key.bits_ >> MAX_CODE_BIT_LENGTH == 0);
|
|
||||||
MOZ_ASSERT(key.bitLength_ >> MAX_BIT_LENGTH_BIT_LENGTH == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
FlatHuffmanKey::FlatHuffmanKey(const HuffmanKey* key)
|
|
||||||
: representation_((key->bitLength_ << MAX_CODE_BIT_LENGTH) | key->bits_) {
|
|
||||||
static_assert(MAX_CODE_BIT_LENGTH + MAX_BIT_LENGTH_BIT_LENGTH <= 32,
|
|
||||||
"32 bits MUST be sufficient to store bits and bitLength");
|
|
||||||
MOZ_ASSERT(key->bits_ >> MAX_CODE_BIT_LENGTH == 0);
|
|
||||||
MOZ_ASSERT(key->bitLength_ >> MAX_BIT_LENGTH_BIT_LENGTH == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---- Implementation of Huffman Tables
|
// ---- Implementation of Huffman Tables
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -156,33 +156,6 @@ struct HuffmanKey {
|
|||||||
const uint8_t bitLength_;
|
const uint8_t bitLength_;
|
||||||
};
|
};
|
||||||
|
|
||||||
// A Huffman key represented as a single `uint32_t`.
|
|
||||||
struct FlatHuffmanKey {
|
|
||||||
explicit FlatHuffmanKey(HuffmanKey key);
|
|
||||||
explicit FlatHuffmanKey(const HuffmanKey* key);
|
|
||||||
|
|
||||||
// 0b0000000L_LLLLCCCC_CCCCCCCC_CCCCCCCC
|
|
||||||
// Where:
|
|
||||||
// - `LLLLL` store `key.bitLength_`
|
|
||||||
// - `CCCC_CCCCCCCC_CCCCCCCC` store `key.bits_`
|
|
||||||
//
|
|
||||||
// While `key.bits_` is nominally 32 bits, it is in fact
|
|
||||||
// `MAX_CODE_BIT_LENGTH` bits, padded with 0s in the
|
|
||||||
// highest bits.
|
|
||||||
const uint32_t representation_;
|
|
||||||
|
|
||||||
// -- Implementing HashPolicy
|
|
||||||
using Lookup = FlatHuffmanKey;
|
|
||||||
using Key = Lookup;
|
|
||||||
static HashNumber hash(const Lookup& lookup) {
|
|
||||||
return mozilla::DefaultHasher<uint32_t>::hash(lookup.representation_);
|
|
||||||
}
|
|
||||||
static bool match(const Key& key, const Lookup& lookup) {
|
|
||||||
return mozilla::DefaultHasher<uint32_t>::match(key.representation_,
|
|
||||||
lookup.representation_);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// An entry in a Huffman table.
|
// An entry in a Huffman table.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct HuffmanEntry {
|
struct HuffmanEntry {
|
||||||
@ -1229,12 +1202,6 @@ class MOZ_STACK_CLASS BinASTTokenReaderContext : public BinASTTokenReaderBase {
|
|||||||
uint32_t& len);
|
uint32_t& len);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// A mapping string index => BinASTVariant as extracted from the [STRINGS]
|
|
||||||
// section of the file. Populated lazily.
|
|
||||||
js::HashMap<FlatHuffmanKey, BinASTVariant, DefaultHasher<uint32_t>,
|
|
||||||
SystemAllocPolicy>
|
|
||||||
variantsTable_;
|
|
||||||
|
|
||||||
enum class MetadataOwnership { Owned, Unowned };
|
enum class MetadataOwnership { Owned, Unowned };
|
||||||
MetadataOwnership metadataOwned_ = MetadataOwnership::Owned;
|
MetadataOwnership metadataOwned_ = MetadataOwnership::Owned;
|
||||||
BinASTSourceMetadata* metadata_;
|
BinASTSourceMetadata* metadata_;
|
||||||
|
Loading…
Reference in New Issue
Block a user