Backed out 2 changesets (bug 1551473, bug 1549954) win 2012 SM bustages on a CLOSED TREE

Backed out changeset aac842bf7f7b (bug 1551473)
Backed out changeset 2a4a5afa1ff2 (bug 1549954)
This commit is contained in:
Andreea Pavel 2019-05-21 19:30:36 +03:00
Родитель 74b6b6997d
Коммит a4546667a5
5 изменённых файлов: 8 добавлений и 147 удалений

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

@ -26,11 +26,6 @@ DIRS += [
'/mozglue',
]
if CONFIG['JS_BUILD_BINAST']:
DIRS += [
'/modules/brotli',
]
if CONFIG['USE_ICU']:
DIRS += [
'/config/external/icu',

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

@ -52,11 +52,6 @@ USE_LIBS += [
'zlib',
]
if CONFIG['JS_BUILD_BINAST']:
USE_LIBS += [
'brotli',
]
if CONFIG['OS_ARCH'] not in ('WINNT', 'HP-UX'):
OS_LIBS += [
'm',

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

@ -8,7 +8,7 @@
#include "mozilla/Result.h" // MOZ_TRY*
#include <string.h> // memcmp, memmove
#include <string.h> // memcmp
#include "frontend/BinAST-macros.h" // BINJS_TRY*, BINJS_MOZ_TRY*
#include "vm/JSScript.h" // ScriptSource
@ -43,72 +43,6 @@ BinASTTokenReaderContext::~BinASTTokenReaderContext() {
if (metadata_ && metadataOwned_ == MetadataOwnership::Owned) {
UniqueBinASTSourceMetadataPtr ptr(metadata_);
}
if (decoder_) {
BrotliDecoderDestroyInstance(decoder_);
}
}
template <>
JS::Result<Ok>
BinASTTokenReaderContext::readBuf<BinASTTokenReaderContext::Compression::No>(
uint8_t* bytes, uint32_t len) {
return Base::readBuf(bytes, len);
}
template <>
JS::Result<Ok>
BinASTTokenReaderContext::readBuf<BinASTTokenReaderContext::Compression::Yes>(
uint8_t* bytes, uint32_t len) {
while (availableDecodedLength() < len) {
if (availableDecodedLength()) {
memmove(bytes, decodedBufferBegin(), availableDecodedLength());
bytes += availableDecodedLength();
len -= availableDecodedLength();
}
if (isEOF()) {
return raiseError("Unexpected end of file");
}
// We have exhausted the in-memory buffer. Start from the beginning.
decodedBegin_ = 0;
size_t inSize = stop_ - current_;
size_t outSize = DECODED_BUFFER_SIZE;
uint8_t* out = decodedBuffer_;
BrotliDecoderResult result;
result = BrotliDecoderDecompressStream(decoder_, &inSize, &current_,
&outSize, &out,
/* total_out = */ nullptr);
if (result == BROTLI_DECODER_RESULT_ERROR) {
return raiseError("Failed to decompress brotli stream");
}
decodedEnd_ = out - decodedBuffer_;
}
memmove(bytes, decodedBufferBegin(), len);
decodedBegin_ += len;
return Ok();
}
bool BinASTTokenReaderContext::isEOF() const {
return BrotliDecoderIsFinished(decoder_);
}
template <>
JS::Result<uint8_t> BinASTTokenReaderContext::readByte<
BinASTTokenReaderContext::Compression::No>() {
return Base::readByte();
}
template <>
JS::Result<uint8_t> BinASTTokenReaderContext::readByte<
BinASTTokenReaderContext::Compression::Yes>() {
uint8_t buf;
MOZ_TRY(readBuf<Compression::Yes>(&buf, 1));
return buf;
}
BinASTSourceMetadata* BinASTTokenReaderContext::takeMetadata() {
@ -131,20 +65,13 @@ JS::Result<Ok> BinASTTokenReaderContext::readHeader() {
// Read global headers.
MOZ_TRY(readConst(CX_MAGIC_HEADER));
BINJS_MOZ_TRY_DECL(version, readVarU32<Compression::No>());
BINJS_MOZ_TRY_DECL(version, readVarU32());
if (version != MAGIC_FORMAT_VERSION) {
return raiseError("Format version not implemented");
}
decoder_ = BrotliDecoderCreateInstance(/* alloc_func = */ nullptr,
/* free_func = */ nullptr,
/* opaque = */ nullptr);
if (!decoder_) {
return raiseError("Failed to create brotli decoder");
}
// TODO: handle strings and models here.
// TODO: handle `LinkToSharedDictionary` and remaining things here.
return raiseError("Not Yet Implemented");
}
@ -242,14 +169,13 @@ JS::Result<Ok> BinASTTokenReaderContext::AutoList::done() {
//
// Encoded as variable length number.
template <BinASTTokenReaderContext::Compression compression>
JS::Result<uint32_t> BinASTTokenReaderContext::readVarU32() {
MOZ_MUST_USE JS::Result<uint32_t> BinASTTokenReaderContext::readVarU32() {
uint32_t result = 0;
uint32_t shift = 0;
while (true) {
MOZ_ASSERT(shift < 32);
uint32_t byte;
MOZ_TRY_VAR(byte, readByte<compression>());
MOZ_TRY_VAR(byte, readByte());
const uint32_t newResult = result | (byte & 0x7f) << shift;
if (newResult < result) {
@ -269,10 +195,6 @@ JS::Result<uint32_t> BinASTTokenReaderContext::readVarU32() {
}
}
JS::Result<uint32_t> BinASTTokenReaderContext::readUnsignedLong(const Context&) {
return readVarU32<Compression::Yes>();
}
BinASTTokenReaderContext::AutoTaggedTuple::AutoTaggedTuple(
BinASTTokenReaderContext& reader)
: AutoBase(reader) {}

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

@ -12,8 +12,6 @@
#include "mozilla/Maybe.h" // mozilla::Maybe
#include <brotli/decode.h> // BrotliDecoderState
#include <stddef.h> // size_t
#include <stdint.h> // uint8_t, uint32_t
@ -50,8 +48,6 @@ class ErrorReporter;
* - the reader does not support lookahead or pushback.
*/
class MOZ_STACK_CLASS BinASTTokenReaderContext : public BinASTTokenReaderBase {
using Base = BinASTTokenReaderBase;
public:
class AutoList;
class AutoTaggedTuple;
@ -86,51 +82,6 @@ class MOZ_STACK_CLASS BinASTTokenReaderContext : public BinASTTokenReaderBase {
~BinASTTokenReaderContext();
private:
// {readByte, readBuf, readVarU32} are implemented both for uncompressed
// stream and brotli-compressed stream.
//
// Uncompressed variant is for reading the magic header, and compressed
// variant is for reading the remaining part.
//
// Once compressed variant is called, the underlying uncompressed stream is
// buffered and uncompressed variant cannot be called.
enum class Compression { No, Yes };
// Buffer that holds already brotli-decoded but not yet used data.
// decodedBuffer[decodedBegin, decodedEnd) holds the data.
static const size_t DECODED_BUFFER_SIZE = 128;
uint8_t decodedBuffer_[DECODED_BUFFER_SIZE];
size_t decodedBegin_ = 0;
size_t decodedEnd_ = 0;
// The number of already decoded bytes.
size_t availableDecodedLength() const { return decodedEnd_ - decodedBegin_; }
// The beginning of decoded buffer.
const uint8_t* decodedBufferBegin() const {
return decodedBuffer_ + decodedBegin_;
}
// Returns true if the brotli stream finished.
bool isEOF() const;
/**
* Read a single byte.
*/
template <Compression compression>
MOZ_MUST_USE JS::Result<uint8_t> readByte();
/**
* Read several bytes.
*
* If there is not enough data, or if the tokenizer has previously been
* poisoned, return an error.
*/
template <Compression compression>
MOZ_MUST_USE JS::Result<Ok> readBuf(uint8_t* bytes, uint32_t len);
public:
/**
* Read the header of the file.
*/
@ -245,13 +196,14 @@ class MOZ_STACK_CLASS BinASTTokenReaderContext : public BinASTTokenReaderBase {
/**
* Read a single unsigned long.
*/
MOZ_MUST_USE JS::Result<uint32_t> readUnsignedLong(const Context&);
MOZ_MUST_USE JS::Result<uint32_t> readUnsignedLong(const Context&) {
return readVarU32();
}
private:
/**
* Read a single uint32_t.
*/
template <Compression compression>
MOZ_MUST_USE JS::Result<uint32_t> readVarU32();
private:
@ -267,8 +219,6 @@ class MOZ_STACK_CLASS BinASTTokenReaderContext : public BinASTTokenReaderBase {
const uint8_t* posBeforeTree_;
BrotliDecoderState* decoder_ = nullptr;
public:
BinASTTokenReaderContext(const BinASTTokenReaderContext&) = delete;
BinASTTokenReaderContext(BinASTTokenReaderContext&&) = delete;

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

@ -100,7 +100,6 @@ case $cmd in
${MKDIR} -p ${tgtpath}/modules
cp -pPR \
${TOPSRCDIR}/modules/brotli \
${TOPSRCDIR}/modules/fdlibm \
${TOPSRCDIR}/modules/zlib \
${tgtpath}/modules/