Bug 1572365 - Removing magic header from Context decoder;r=arai
authorDavid Teller <dteller@mozilla.com>
Fri, 30 Aug 2019 13:32:09 +0000
changeset 551374 ef2853ccdc1162c25b9e36018c73dfd3eb3ea894
parent 551373 f7ff76e196bdb37607020bf9fc5db4ef8818fcf6
child 551375 089d52d6ad36eb3122cdfc6eacd2a6e0e5c42613
push id11865
push userbtara@mozilla.com
push dateMon, 02 Sep 2019 08:54:37 +0000
treeherdermozilla-beta@37f59c4671b3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarai
bugs1572365
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1572365 - Removing magic header from Context decoder;r=arai Differential Revision: https://phabricator.services.mozilla.com/D41169
js/src/frontend/BinASTTokenReaderContext.cpp
--- a/js/src/frontend/BinASTTokenReaderContext.cpp
+++ b/js/src/frontend/BinASTTokenReaderContext.cpp
@@ -19,24 +19,29 @@
 #include "js/Vector.h"               // js::Vector
 #include "util/StringBuffer.h"       // StringBuffer
 #include "vm/JSAtom.h"               // AtomizeWTF8Chars
 #include "vm/JSScript.h"             // ScriptSource
 
 namespace js {
 namespace frontend {
 
+#ifdef BINAST_CX_MAGIC_HEADER  // Context 0.1 doesn't implement the planned
+                               // magic header.
+
 // The magic header, at the start of every binjs file.
 const char CX_MAGIC_HEADER[] =
     "\x89"
     "BJS\r\n\0\n";
 
 // The latest format version understood by this tokenizer.
 const uint32_t MAGIC_FORMAT_VERSION = 2;
 
+#endif  // BINAST_CX_MAGIC_HEADER
+
 // The maximal length of a single Huffman code, in bits.
 //
 // Hardcoded in the format.
 const uint8_t MAX_CODE_BIT_LENGTH = 20;
 
 // The maximal length of a Huffman prefix.
 //
 // This is distinct from MAX_CODE_BIT_LENGTH as we commonly load
@@ -811,23 +816,25 @@ JS::Result<Ok> BinASTTokenReaderContext:
 
   return Ok();
 }
 
 JS::Result<Ok> BinASTTokenReaderContext::readHeader() {
   // Check that we don't call this function twice.
   MOZ_ASSERT(!posBeforeTree_);
 
+#if BINAST_CX_MAGIC_HEADER
   // Read global headers.
   MOZ_TRY(readConst(CX_MAGIC_HEADER));
   BINJS_MOZ_TRY_DECL(version, readVarU32<Compression::No>());
 
   if (version != MAGIC_FORMAT_VERSION) {
     return raiseError("Format version not implemented");
   }
+#endif  // BINAST_CX_MAGIC_HEADER
 
   MOZ_TRY(readStringPrelude());
   MOZ_TRY(readHuffmanPrelude());
 
   return raiseError("Not Yet Implemented");
 }
 
 JS::Result<Ok> BinASTTokenReaderContext::readStringPrelude() {