Bug 1529823 - Remove untagged tuple. r=Yoric
authorTooru Fujisawa <arai_a@mac.com>
Sun, 24 Feb 2019 03:34:46 +0000
changeset 518664 6bbc695865c6c9e9e211bddfa99f268902534e43
parent 518663 b5889271779fc3316a4cc5092bbb8ac8b8801519
child 518665 abcf203b0474e1656413771f137cdb6f5dc2161e
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersYoric
bugs1529823
milestone67.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 1529823 - Remove untagged tuple. r=Yoric Untagged tuple is not used in multipart format and entropy format. Differential Revision: https://phabricator.services.mozilla.com/D20776
js/src/frontend/BinASTParser.h
js/src/frontend/BinASTParserPerTokenizer.h
js/src/frontend/BinSource.yaml
js/src/frontend/BinTokenReaderMultipart.cpp
js/src/frontend/BinTokenReaderMultipart.h
--- a/js/src/frontend/BinASTParser.h
+++ b/js/src/frontend/BinASTParser.h
@@ -36,17 +36,16 @@ class BinASTParser : public BinASTParser
  public:
   using Base = BinASTParserPerTokenizer<Tok>;
 
   using Tokenizer = Tok;
 
   using BinFields = typename Tokenizer::BinFields;
   using AutoList = typename Tokenizer::AutoList;
   using AutoTaggedTuple = typename Tokenizer::AutoTaggedTuple;
-  using AutoTuple = typename Tokenizer::AutoTuple;
   using Chars = typename Tokenizer::Chars;
 
  public:
   // Auto-generated types.
   using AssertedDeclaredKind = binast::AssertedDeclaredKind;
   using BinaryOperator = binast::BinaryOperator;
   using CompoundAssignmentOperator = binast::CompoundAssignmentOperator;
   using UnaryOperator = binast::UnaryOperator;
--- a/js/src/frontend/BinASTParserPerTokenizer.h
+++ b/js/src/frontend/BinASTParserPerTokenizer.h
@@ -49,17 +49,16 @@ template <typename Tok>
 class BinASTParserPerTokenizer : public BinASTParserBase,
                                  public ErrorReporter,
                                  public BCEParserHandle {
  public:
   using Tokenizer = Tok;
 
   using AutoList = typename Tokenizer::AutoList;
   using AutoTaggedTuple = typename Tokenizer::AutoTaggedTuple;
-  using AutoTuple = typename Tokenizer::AutoTuple;
   using BinFields = typename Tokenizer::BinFields;
   using Chars = typename Tokenizer::Chars;
 
  public:
   // Auto-generated types.
   using AssertedDeclaredKind = binast::AssertedDeclaredKind;
   using VariableDeclarationKind = binast::VariableDeclarationKind;
 
--- a/js/src/frontend/BinSource.yaml
+++ b/js/src/frontend/BinSource.yaml
@@ -109,17 +109,16 @@ hpp:
        public:
         using Base = BinASTParserPerTokenizer<Tok>;
 
         using Tokenizer = Tok;
 
         using BinFields = typename Tokenizer::BinFields;
         using AutoList = typename Tokenizer::AutoList;
         using AutoTaggedTuple = typename Tokenizer::AutoTaggedTuple;
-        using AutoTuple = typename Tokenizer::AutoTuple;
         using Chars = typename Tokenizer::Chars;
 
        public:
         // Auto-generated types.
         using AssertedDeclaredKind = binast::AssertedDeclaredKind;
         using BinaryOperator = binast::BinaryOperator;
         using CompoundAssignmentOperator = binast::CompoundAssignmentOperator;
         using UnaryOperator = binast::UnaryOperator;
--- a/js/src/frontend/BinTokenReaderMultipart.cpp
+++ b/js/src/frontend/BinTokenReaderMultipart.cpp
@@ -36,17 +36,16 @@ const char SECTION_HEADER_TREE[] = "[TRE
 const char COMPRESSION_IDENTITY[] = "identity;";
 
 // The maximal number of distinct strings that may be declared in a
 // single file.
 const uint32_t MAX_NUMBER_OF_STRINGS = 32768;
 
 using AutoList = BinTokenReaderMultipart::AutoList;
 using AutoTaggedTuple = BinTokenReaderMultipart::AutoTaggedTuple;
-using AutoTuple = BinTokenReaderMultipart::AutoTuple;
 using CharSlice = BinaryASTSupport::CharSlice;
 using Chars = BinTokenReaderMultipart::Chars;
 
 BinTokenReaderMultipart::BinTokenReaderMultipart(JSContext* cx,
                                                  ErrorReporter* er,
                                                  const uint8_t* start,
                                                  const size_t length)
     : BinTokenReaderBase(cx, er, start, length),
@@ -354,23 +353,16 @@ BinTokenReaderMultipart::readSkippableSu
 
   const auto start = offset();
 
   current_ += byteLen;
 
   return BinTokenReaderBase::SkippableSubTree(start, byteLen);
 }
 
-// Untagged tuple:
-// - contents (specified by the higher-level grammar);
-JS::Result<Ok> BinTokenReaderMultipart::enterUntaggedTuple(AutoTuple& guard) {
-  guard.init();
-  return Ok();
-}
-
 // Tagged tuples:
 // - uint32_t index in table [grammar];
 // - content (specified by the higher-level grammar);
 JS::Result<Ok> BinTokenReaderMultipart::enterTaggedTuple(
     BinKind& tag, BinTokenReaderMultipart::BinFields&, AutoTaggedTuple& guard) {
   BINJS_MOZ_TRY_DECL(index, readInternalUint32());
   if (index >= metadata_->numBinKinds()) {
     return raiseError("Invalid index to grammar table");
@@ -478,26 +470,11 @@ JS::Result<Ok> BinTokenReaderMultipart::
   if (reader_.hasRaisedError()) {
     // Already errored, no need to check further.
     return reader_.cx_->alreadyReportedError();
   }
 
   return Ok();
 }
 
-BinTokenReaderMultipart::AutoTuple::AutoTuple(BinTokenReaderMultipart& reader)
-    : AutoBase(reader) {}
-
-JS::Result<Ok> BinTokenReaderMultipart::AutoTuple::done() {
-  MOZ_ASSERT(initialized_);
-  initialized_ = false;
-  if (reader_.hasRaisedError()) {
-    // Already errored, no need to check further.
-    return reader_.cx_->alreadyReportedError();
-  }
-
-  // Check suffix.
-  return Ok();
-}
-
 }  // namespace frontend
 
 }  // namespace js
--- a/js/src/frontend/BinTokenReaderMultipart.h
+++ b/js/src/frontend/BinTokenReaderMultipart.h
@@ -28,17 +28,16 @@ namespace frontend {
  * As other token readers for the BinAST:
  *
  * - the reader does not support error recovery;
  * - the reader does not support lookahead or pushback.
  */
 class MOZ_STACK_CLASS BinTokenReaderMultipart : public BinTokenReaderBase {
  public:
   class AutoList;
-  class AutoTuple;
   class AutoTaggedTuple;
 
   using CharSlice = BinaryASTSupport::CharSlice;
 
   // This implementation of `BinFields` is effectively `void`, as the format
   // does not embed field information.
   class BinFields {
    public:
@@ -170,29 +169,16 @@ class MOZ_STACK_CLASS BinTokenReaderMult
    *
    * @return out If the header of the tuple is invalid.
    */
   MOZ_MUST_USE JS::Result<Ok> enterTaggedTuple(
       BinKind& tag, BinTokenReaderMultipart::BinFields& fields,
       AutoTaggedTuple& guard);
 
   /**
-   * Start reading an untagged tuple.
-   *
-   * @param guard (OUT) A guard, ensuring that we read the tuple correctly.
-   *
-   * The `guard` is dedicated to ensuring that reading the list has consumed
-   * exactly all the bytes from that tuple. The `guard` MUST therefore be
-   * destroyed at the point where the caller has reached the end of the tuple.
-   * If the caller has consumed too few/too many bytes, this will be reported
-   * in the call go `guard.done()`.
-   */
-  MOZ_MUST_USE JS::Result<Ok> enterUntaggedTuple(AutoTuple& guard);
-
-  /**
    * Read a single unsigned long.
    */
   MOZ_MUST_USE JS::Result<uint32_t> readUnsignedLong() {
     return readInternalUint32();
   }
 
  private:
   /**
@@ -270,25 +256,16 @@ class MOZ_STACK_CLASS BinTokenReaderMult
   class MOZ_STACK_CLASS AutoTaggedTuple : public AutoBase {
    public:
     explicit AutoTaggedTuple(BinTokenReaderMultipart& reader);
 
     // Check that we have properly read to the end of the tuple.
     MOZ_MUST_USE JS::Result<Ok> done();
   };
 
-  // Guard class used to ensure that `readTuple` is used properly.
-  class MOZ_STACK_CLASS AutoTuple : public AutoBase {
-   public:
-    explicit AutoTuple(BinTokenReaderMultipart& reader);
-
-    // Check that we have properly read to the end of the tuple.
-    MOZ_MUST_USE JS::Result<Ok> done();
-  };
-
   // Compare a `Chars` and a string literal (ONLY a string literal).
   template <size_t N>
   static bool equals(const Chars& left, const char (&right)[N]) {
     MOZ_ASSERT(N > 0);
     MOZ_ASSERT(right[N - 1] == 0);
     if (left.byteLen_ + 1 /* implicit NUL */ != N) {
       return false;
     }