diff --git a/js/src/frontend/BinASTTokenReaderContext.cpp b/js/src/frontend/BinASTTokenReaderContext.cpp index 6bca93a63391..e2a9dfc8309c 100644 --- a/js/src/frontend/BinASTTokenReaderContext.cpp +++ b/js/src/frontend/BinASTTokenReaderContext.cpp @@ -2186,18 +2186,10 @@ HuffmanPreludeReader::readSingleValueTable( } HuffmanDictionary::HuffmanDictionary(JSContext* cx) - : fields(cx), listLengths(cx) { - // Initialize `fields`. We have reserved space statically, this cannot fail. - for (size_t i = 0; i < BINAST_INTERFACE_AND_FIELD_LIMIT; ++i) { - fields.infallibleEmplaceBack(HuffmanTableUnreachable{}); - } - - // Initialize `listLengths`. We have reserved space statically, this cannot - // fail. - for (size_t i = 0; i < BINAST_NUMBER_OF_LIST_TYPES; ++i) { - listLengths.infallibleEmplaceBack(HuffmanTableUnreachable{}); - } -} + : fields(BINAST_PARAM_NUMBER_OF_INTERFACE_AND_FIELD( + mozilla::AsVariant(HuffmanTableUnreachable()))), + listLengths(BINAST_PARAM_NUMBER_OF_LIST_TYPES( + mozilla::AsVariant(HuffmanTableUnreachable()))) {} HuffmanTable& HuffmanDictionary::tableForField( NormalizedInterfaceAndField index) { diff --git a/js/src/frontend/BinASTTokenReaderContext.h b/js/src/frontend/BinASTTokenReaderContext.h index 341d140795e3..2056432d6089 100644 --- a/js/src/frontend/BinASTTokenReaderContext.h +++ b/js/src/frontend/BinASTTokenReaderContext.h @@ -7,10 +7,11 @@ #ifndef frontend_BinASTTokenReaderContext_h #define frontend_BinASTTokenReaderContext_h +#include "mozilla/Array.h" // mozilla::Array #include "mozilla/Assertions.h" // MOZ_ASSERT #include "mozilla/Attributes.h" // MOZ_MUST_USE, MOZ_STACK_CLASS - -#include "mozilla/Maybe.h" // mozilla::Maybe +#include "mozilla/Maybe.h" // mozilla::Maybe +#include "mozilla/Variant.h" // mozilla::Variant #include // size_t #include // uint8_t, uint32_t @@ -324,7 +325,7 @@ class HuffmanDictionary { // // The mapping from `(Interface, Field) -> index` is extracted statically from // the webidl specs. - Vector fields; + mozilla::Array fields; // Huffman tables for list lengths. Some tables may be // `HuffmanTableUnreacheable` if they represent lists that actually do not @@ -332,7 +333,8 @@ class HuffmanDictionary { // // The mapping from `List -> index` is extracted statically from the webidl // specs. - Vector listLengths; + mozilla::Array + listLengths; }; /**