Bug 1505343 - Part 2: Rename BinToken* to BinASTToken*. r=Yoric
authorTooru Fujisawa <arai_a@mac.com>
Wed, 13 Mar 2019 04:30:04 +0000
changeset 521654 976e93ae2dbc
parent 521653 123ecc5c9586
child 521655 639ba2db3684
push id10867
push userdvarga@mozilla.com
push dateThu, 14 Mar 2019 15:20:45 +0000
treeherdermozilla-beta@abad13547875 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersYoric
bugs1505343
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 1505343 - Part 2: Rename BinToken* to BinASTToken*. r=Yoric Differential Revision: https://phabricator.services.mozilla.com/D23098
js/src/frontend/BinAST.yaml
js/src/frontend/BinASTParser.cpp
js/src/frontend/BinASTParser.h
js/src/frontend/BinASTParserPerTokenizer.cpp
js/src/frontend/BinASTParserPerTokenizer.h
js/src/frontend/BinASTRuntimeSupport.h
js/src/frontend/BinASTToken.cpp
js/src/frontend/BinASTToken.h
js/src/frontend/BinASTTokenReaderBase.cpp
js/src/frontend/BinASTTokenReaderBase.h
js/src/frontend/BinASTTokenReaderMultipart.cpp
js/src/frontend/BinASTTokenReaderMultipart.h
js/src/frontend/BinToken.cpp
js/src/frontend/BinToken.h
js/src/frontend/BinTokenReaderBase.cpp
js/src/frontend/BinTokenReaderBase.h
js/src/frontend/BinTokenReaderMultipart.cpp
js/src/frontend/BinTokenReaderMultipart.h
js/src/frontend/BytecodeCompiler.cpp
js/src/frontend/binast/README.md
js/src/frontend/binast/build.sh
js/src/frontend/binast/src/main.rs
js/src/frontend/moz.build
js/src/jsapi-tests/testBinASTReader.cpp
js/src/shell/js.cpp
--- a/js/src/frontend/BinAST.yaml
+++ b/js/src/frontend/BinAST.yaml
@@ -34,17 +34,17 @@ cpp:
     #include "mozilla/ArrayUtils.h"
     #include "mozilla/Casting.h"
     #include "mozilla/Maybe.h"
     #include "mozilla/Move.h"
     #include "mozilla/PodOperations.h"
     #include "mozilla/Vector.h"
 
     #include "frontend/BinAST-macros.h"
-    #include "frontend/BinTokenReaderMultipart.h"
+    #include "frontend/BinASTTokenReaderMultipart.h"
     #include "frontend/FullParseHandler.h"
     #include "frontend/ParseNode.h"
     #include "frontend/Parser.h"
     #include "frontend/SharedContext.h"
 
     #include "vm/RegExpObject.h"
 
     #include "frontend/ParseContext-inl.h"
@@ -59,17 +59,17 @@ cpp:
       return Tok::equals(left, right);
     }
 
   footer: |
 
     // Force class instantiation.
     // This ensures that the symbols are built, without having to export all our
     // code (and its baggage of #include and macros) in the header.
-    template class BinASTParser<BinTokenReaderMultipart>;
+    template class BinASTParser<BinASTTokenReaderMultipart>;
 
     } // namespace frontend
     } // namespace js
 
 hpp:
   # Rules for generating BinASTParser.h
   class:
     header: |
@@ -84,18 +84,18 @@ hpp:
 
       #ifndef frontend_BinASTParser_h
       #define frontend_BinASTParser_h
 
       #include "mozilla/Maybe.h"
 
       #include "frontend/BCEParserHandle.h"
       #include "frontend/BinASTParserPerTokenizer.h"
-      #include "frontend/BinToken.h"
-      #include "frontend/BinTokenReaderMultipart.h"
+      #include "frontend/BinASTToken.h"
+      #include "frontend/BinASTTokenReaderMultipart.h"
       #include "frontend/FullParseHandler.h"
       #include "frontend/ParseContext.h"
       #include "frontend/ParseNode.h"
       #include "frontend/SharedContext.h"
 
       #include "js/CompileOptions.h"
       #include "js/GCHashTable.h"
       #include "js/GCVector.h"
@@ -188,17 +188,17 @@ hpp:
         using Base::prependDirectivesToBody;
 
         using Base::forceStrictIfNecessary;
 
        public:
     footer: |
       };
 
-      extern template class BinASTParser<BinTokenReaderMultipart>;
+      extern template class BinASTParser<BinASTTokenReaderMultipart>;
 
       } // namespace frontend
       } // namespace js
 
       #endif // frontend_BinASTParser_h
 
   enums:
     header: |
@@ -219,17 +219,17 @@ hpp:
       namespace binast {
     footer: |
       } // namespace binast
       } // namespace frontend
       } // namespace js
 
       #endif // frontend_BinASTEnum_h
 
-  # Rules for generating BinToken.h
+  # Rules for generating BinASTToken.h
   tokens:
     kind:
       doc: |
         /**
          * The different kinds of Binary AST nodes, as per the specifications of
          * Binary AST.
          *
          * These kinds match roughly with the `ParseNodeKind` used internally.
@@ -284,18 +284,18 @@ hpp:
        * This Source Code Form is subject to the terms of the Mozilla Public
        * License, v. 2.0. If a copy of the MPL was not distributed with this
        * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 
       // To generate this file, see the documentation in
       // js/src/frontend/binast/README.md.
 
-      #ifndef frontend_BinToken_h
-      #define frontend_BinToken_h
+      #ifndef frontend_BinASTToken_h
+      #define frontend_BinASTToken_h
 
       #include <stddef.h>
 
       /**
        * Definition of Binary AST tokens.
        *
        * In the Binary AST world, an AST is composed of nodes, where a node is
        * defined by:
@@ -337,17 +337,17 @@ hpp:
       /**
        * Return a string describing a `BinVariant`.
        */
       const char* describeBinVariant(const BinVariant& kind);
 
       } // namespace frontend
       } // namespace js
 
-      #endif // frontend_BinToken_h
+      #endif // frontend_BinASTToken_h
 
 Arguments:
   init: |
     BINJS_TRY_DECL(result, handler_.newList(ParseNodeKind::Arguments,
                                             tokenizer_->pos(start)));
   append:
     handler_.addList(/* list = */ result, /* kid = */ item);
 
--- a/js/src/frontend/BinASTParser.cpp
+++ b/js/src/frontend/BinASTParser.cpp
@@ -14,17 +14,17 @@
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/Casting.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/Move.h"
 #include "mozilla/PodOperations.h"
 #include "mozilla/Vector.h"
 
 #include "frontend/BinAST-macros.h"
-#include "frontend/BinTokenReaderMultipart.h"
+#include "frontend/BinASTTokenReaderMultipart.h"
 #include "frontend/FullParseHandler.h"
 #include "frontend/ParseNode.h"
 #include "frontend/Parser.h"
 #include "frontend/SharedContext.h"
 
 #include "vm/RegExpObject.h"
 
 #include "frontend/ParseContext-inl.h"
@@ -4959,12 +4959,12 @@ BinASTParser<Tok>::parseOptionalVariable
   MOZ_TRY(guard.done());
 
   return result;
 }
 
 // Force class instantiation.
 // This ensures that the symbols are built, without having to export all our
 // code (and its baggage of #include and macros) in the header.
-template class BinASTParser<BinTokenReaderMultipart>;
+template class BinASTParser<BinASTTokenReaderMultipart>;
 
 }  // namespace frontend
 }  // namespace js
--- a/js/src/frontend/BinASTParser.h
+++ b/js/src/frontend/BinASTParser.h
@@ -11,18 +11,18 @@
 
 #ifndef frontend_BinASTParser_h
 #define frontend_BinASTParser_h
 
 #include "mozilla/Maybe.h"
 
 #include "frontend/BCEParserHandle.h"
 #include "frontend/BinASTParserPerTokenizer.h"
-#include "frontend/BinToken.h"
-#include "frontend/BinTokenReaderMultipart.h"
+#include "frontend/BinASTToken.h"
+#include "frontend/BinASTTokenReaderMultipart.h"
 #include "frontend/FullParseHandler.h"
 #include "frontend/ParseContext.h"
 #include "frontend/ParseNode.h"
 #include "frontend/SharedContext.h"
 
 #include "js/CompileOptions.h"
 #include "js/GCHashTable.h"
 #include "js/GCVector.h"
@@ -482,14 +482,14 @@ class BinASTParser : public BinASTParser
   JS::Result<ParseNode*> parseOptionalBindingIdentifier();
   JS::Result<LexicalScopeNode*> parseOptionalCatchClause();
   JS::Result<ParseNode*> parseOptionalExpression();
   JS::Result<ParseNode*> parseOptionalSpreadElementOrExpression();
   JS::Result<ParseNode*> parseOptionalStatement();
   JS::Result<ParseNode*> parseOptionalVariableDeclarationOrExpression();
 };
 
-extern template class BinASTParser<BinTokenReaderMultipart>;
+extern template class BinASTParser<BinASTTokenReaderMultipart>;
 
 }  // namespace frontend
 }  // namespace js
 
 #endif  // frontend_BinASTParser_h
--- a/js/src/frontend/BinASTParserPerTokenizer.cpp
+++ b/js/src/frontend/BinASTParserPerTokenizer.cpp
@@ -11,17 +11,17 @@
 #include "mozilla/Maybe.h"
 #include "mozilla/Move.h"
 #include "mozilla/PodOperations.h"
 #include "mozilla/ScopeExit.h"
 #include "mozilla/Vector.h"
 
 #include "frontend/BinAST-macros.h"
 #include "frontend/BinASTParser.h"
-#include "frontend/BinTokenReaderMultipart.h"
+#include "frontend/BinASTTokenReaderMultipart.h"
 #include "frontend/FullParseHandler.h"
 #include "frontend/ParseNode.h"
 #include "frontend/Parser.h"
 #include "frontend/SharedContext.h"
 
 #include "js/Result.h"
 #include "vm/RegExpObject.h"
 
@@ -801,12 +801,12 @@ BinASTParserPerTokenizer<Tok>::asFinalPa
       "inheritance relationship required by the static_cast<> below");
 
   return static_cast<const FinalParser*>(this);
 }
 
 // Force class instantiation.
 // This ensures that the symbols are built, without having to export all our
 // code (and its baggage of #include and macros) in the header.
-template class BinASTParserPerTokenizer<BinTokenReaderMultipart>;
+template class BinASTParserPerTokenizer<BinASTTokenReaderMultipart>;
 
 }  // namespace frontend
 }  // namespace js
--- a/js/src/frontend/BinASTParserPerTokenizer.h
+++ b/js/src/frontend/BinASTParserPerTokenizer.h
@@ -14,18 +14,18 @@
  * and trusts its input (in particular, variable declarations).
  */
 
 #include "mozilla/Maybe.h"
 
 #include "frontend/BCEParserHandle.h"
 #include "frontend/BinASTEnum.h"
 #include "frontend/BinASTParserBase.h"
-#include "frontend/BinToken.h"
-#include "frontend/BinTokenReaderMultipart.h"
+#include "frontend/BinASTToken.h"
+#include "frontend/BinASTTokenReaderMultipart.h"
 #include "frontend/FullParseHandler.h"
 #include "frontend/ParseContext.h"
 #include "frontend/ParseNode.h"
 #include "frontend/SharedContext.h"
 
 #include "js/CompileOptions.h"
 #include "js/GCHashTable.h"
 #include "js/GCVector.h"
@@ -320,14 +320,14 @@ class BinASTParseContext : public ParseC
   BinASTParseContext(JSContext* cx, BinASTParserPerTokenizer<Tok>* parser,
                      SharedContext* sc, Directives* newDirectives)
       : ParseContext(cx, parser->pc_, sc, *parser, parser->usedNames_,
                      newDirectives, /* isFull = */ true) {}
 };
 
 void TraceBinASTParser(JSTracer* trc, JS::AutoGCRooter* parser);
 
-extern template class BinASTParserPerTokenizer<BinTokenReaderMultipart>;
+extern template class BinASTParserPerTokenizer<BinASTTokenReaderMultipart>;
 
 }  // namespace frontend
 }  // namespace js
 
 #endif  // frontend_BinASTParserPerTokenizer_h
--- a/js/src/frontend/BinASTRuntimeSupport.h
+++ b/js/src/frontend/BinASTRuntimeSupport.h
@@ -4,17 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef frontend_BinASTSupport_h
 #define frontend_BinASTSupport_h
 
 #include "mozilla/HashFunctions.h"
 
-#include "frontend/BinToken.h"
+#include "frontend/BinASTToken.h"
 #include "gc/DeletePolicy.h"
 
 #include "js/AllocPolicy.h"
 #include "js/HashTable.h"
 #include "js/Result.h"
 #include "js/UniquePtr.h"
 #include "js/Vector.h"
 
rename from js/src/frontend/BinToken.cpp
rename to js/src/frontend/BinASTToken.cpp
--- a/js/src/frontend/BinToken.cpp
+++ b/js/src/frontend/BinASTToken.cpp
@@ -1,15 +1,15 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * vim: set ts=8 sts=2 et sw=2 tw=80:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "frontend/BinToken.h"
+#include "frontend/BinASTToken.h"
 
 #include "mozilla/Maybe.h"
 
 #include <sys/types.h>
 
 #include "frontend/BinASTRuntimeSupport.h"
 #include "frontend/TokenStream.h"
 #include "js/Result.h"
rename from js/src/frontend/BinToken.h
rename to js/src/frontend/BinASTToken.h
--- a/js/src/frontend/BinToken.h
+++ b/js/src/frontend/BinASTToken.h
@@ -4,18 +4,18 @@
  * vim: set ts=8 sts=2 et sw=2 tw=80:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // To generate this file, see the documentation in
 // js/src/frontend/binast/README.md.
 
-#ifndef frontend_BinToken_h
-#define frontend_BinToken_h
+#ifndef frontend_BinASTToken_h
+#define frontend_BinASTToken_h
 
 #include <stddef.h>
 
 /**
  * Definition of Binary AST tokens.
  *
  * In the Binary AST world, an AST is composed of nodes, where a node is
  * defined by:
@@ -376,9 +376,9 @@ const char* describeBinField(const BinFi
 /**
  * Return a string describing a `BinVariant`.
  */
 const char* describeBinVariant(const BinVariant& kind);
 
 }  // namespace frontend
 }  // namespace js
 
-#endif  // frontend_BinToken_h
+#endif  // frontend_BinASTToken_h
rename from js/src/frontend/BinTokenReaderBase.cpp
rename to js/src/frontend/BinASTTokenReaderBase.cpp
--- a/js/src/frontend/BinTokenReaderBase.cpp
+++ b/js/src/frontend/BinASTTokenReaderBase.cpp
@@ -1,108 +1,108 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * vim: set ts=8 sts=2 et sw=2 tw=80:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "frontend/BinTokenReaderBase.h"
+#include "frontend/BinASTTokenReaderBase.h"
 
 #include "frontend/BinAST-macros.h"
 #include "js/Result.h"
 
 namespace js {
 namespace frontend {
 
 template <typename T>
 using ErrorResult = mozilla::GenericErrorResult<T>;
 
 // We use signalling NaN (which doesn't exist in the JS syntax)
 // to represent a `null` number.
 const uint64_t NULL_FLOAT_REPRESENTATION = 0x7FF0000000000001;
 
-void BinTokenReaderBase::updateLatestKnownGood() {
+void BinASTTokenReaderBase::updateLatestKnownGood() {
   MOZ_ASSERT(current_ >= start_);
   const size_t update = current_ - start_;
   MOZ_ASSERT(update >= latestKnownGoodPos_);
   latestKnownGoodPos_ = update;
 }
 
-ErrorResult<JS::Error&> BinTokenReaderBase::raiseError(
+ErrorResult<JS::Error&> BinASTTokenReaderBase::raiseError(
     const char* description) {
   MOZ_ASSERT(!hasRaisedError());
   errorReporter_->errorNoOffset(JSMSG_BINAST, description);
   return cx_->alreadyReportedError();
 }
 
-ErrorResult<JS::Error&> BinTokenReaderBase::raiseOOM() {
+ErrorResult<JS::Error&> BinASTTokenReaderBase::raiseOOM() {
   ReportOutOfMemory(cx_);
   return cx_->alreadyReportedError();
 }
 
-ErrorResult<JS::Error&> BinTokenReaderBase::raiseInvalidNumberOfFields(
+ErrorResult<JS::Error&> BinASTTokenReaderBase::raiseInvalidNumberOfFields(
     const BinKind kind, const uint32_t expected, const uint32_t got) {
   Sprinter out(cx_);
   BINJS_TRY(out.init());
   BINJS_TRY(out.printf("In %s, invalid number of fields: expected %u, got %u",
                        describeBinKind(kind), expected, got));
   return raiseError(out.string());
 }
 
-ErrorResult<JS::Error&> BinTokenReaderBase::raiseInvalidField(
+ErrorResult<JS::Error&> BinASTTokenReaderBase::raiseInvalidField(
     const char* kind, const BinField field) {
   Sprinter out(cx_);
   BINJS_TRY(out.init());
   BINJS_TRY(
       out.printf("In %s, invalid field '%s'", kind, describeBinField(field)));
   return raiseError(out.string());
 }
 
-bool BinTokenReaderBase::hasRaisedError() const {
+bool BinASTTokenReaderBase::hasRaisedError() const {
   if (cx_->helperThread()) {
     // When performing off-main-thread parsing, we don't set a pending
     // exception but instead add a pending compile error.
     return cx_->isCompileErrorPending();
   }
 
   return cx_->isExceptionPending();
 }
 
-size_t BinTokenReaderBase::offset() const { return current_ - start_; }
+size_t BinASTTokenReaderBase::offset() const { return current_ - start_; }
 
-TokenPos BinTokenReaderBase::pos() { return pos(offset()); }
+TokenPos BinASTTokenReaderBase::pos() { return pos(offset()); }
 
-TokenPos BinTokenReaderBase::pos(size_t start) {
+TokenPos BinASTTokenReaderBase::pos(size_t start) {
   TokenPos pos;
   pos.begin = start;
   pos.end = current_ - start_;
   MOZ_ASSERT(pos.end >= pos.begin);
   return pos;
 }
 
-void BinTokenReaderBase::seek(size_t offset) {
+void BinASTTokenReaderBase::seek(size_t offset) {
   MOZ_ASSERT(start_ + offset >= start_ && start_ + offset < stop_);
   current_ = start_ + offset;
 }
 
-JS::Result<Ok> BinTokenReaderBase::readBuf(uint8_t* bytes, uint32_t len) {
+JS::Result<Ok> BinASTTokenReaderBase::readBuf(uint8_t* bytes, uint32_t len) {
   MOZ_ASSERT(!hasRaisedError());
   MOZ_ASSERT(len > 0);
 
   if (stop_ < current_ + len) {
     return raiseError("Buffer exceeds length");
   }
 
   for (uint32_t i = 0; i < len; ++i) {
     *bytes++ = *current_++;
   }
 
   return Ok();
 }
 
-JS::Result<uint8_t> BinTokenReaderBase::readByte() {
+JS::Result<uint8_t> BinASTTokenReaderBase::readByte() {
   uint8_t byte;
   MOZ_TRY(readBuf(&byte, 1));
   return byte;
 }
 
 }  // namespace frontend
 }  // namespace js
rename from js/src/frontend/BinTokenReaderBase.h
rename to js/src/frontend/BinASTTokenReaderBase.h
--- a/js/src/frontend/BinTokenReaderBase.h
+++ b/js/src/frontend/BinASTTokenReaderBase.h
@@ -1,31 +1,31 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * vim: set ts=8 sts=2 et sw=2 tw=80:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef frontend_BinTokenReaderBase_h
-#define frontend_BinTokenReaderBase_h
+#ifndef frontend_BinASTTokenReaderBase_h
+#define frontend_BinASTTokenReaderBase_h
 
-#include "frontend/BinToken.h"
+#include "frontend/BinASTToken.h"
 #include "frontend/ErrorReporter.h"
 #include "frontend/TokenStream.h"
 
 #include "js/Result.h"
 #include "js/TypeDecls.h"
 
 namespace js {
 namespace frontend {
 
 // A constant used by tokenizers to represent a null float.
 extern const uint64_t NULL_FLOAT_REPRESENTATION;
 
-class MOZ_STACK_CLASS BinTokenReaderBase {
+class MOZ_STACK_CLASS BinASTTokenReaderBase {
  public:
   template <typename T>
   using ErrorResult = mozilla::GenericErrorResult<T>;
 
   // The information needed to skip a subtree.
   class SkippableSubTree {
    public:
     SkippableSubTree(const size_t startOffset, const size_t length)
@@ -67,18 +67,18 @@ class MOZ_STACK_CLASS BinTokenReaderBase
   MOZ_MUST_USE ErrorResult<JS::Error&> raiseError(const char* description);
   MOZ_MUST_USE ErrorResult<JS::Error&> raiseOOM();
   MOZ_MUST_USE ErrorResult<JS::Error&> raiseInvalidNumberOfFields(
       const BinKind kind, const uint32_t expected, const uint32_t got);
   MOZ_MUST_USE ErrorResult<JS::Error&> raiseInvalidField(const char* kind,
                                                          const BinField field);
 
  protected:
-  BinTokenReaderBase(JSContext* cx, ErrorReporter* er, const uint8_t* start,
-                     const size_t length)
+  BinASTTokenReaderBase(JSContext* cx, ErrorReporter* er, const uint8_t* start,
+                        const size_t length)
       : cx_(cx),
         errorReporter_(er),
         poisoned_(false),
         start_(start),
         current_(start),
         stop_(start + length),
         latestKnownGoodPos_(0) {
     MOZ_ASSERT(errorReporter_);
@@ -167,17 +167,17 @@ class MOZ_STACK_CLASS BinTokenReaderBase
 
   // The last+1 byte of the buffer.
   const uint8_t* stop_;
 
   // Latest known good position. Used for error reporting.
   size_t latestKnownGoodPos_;
 
  private:
-  BinTokenReaderBase(const BinTokenReaderBase&) = delete;
-  BinTokenReaderBase(BinTokenReaderBase&&) = delete;
-  BinTokenReaderBase& operator=(BinTokenReaderBase&) = delete;
+  BinASTTokenReaderBase(const BinASTTokenReaderBase&) = delete;
+  BinASTTokenReaderBase(BinASTTokenReaderBase&&) = delete;
+  BinASTTokenReaderBase& operator=(BinASTTokenReaderBase&) = delete;
 };
 
 }  // namespace frontend
 }  // namespace js
 
-#endif  // frontend_BinTokenReaderBase_h
+#endif  // frontend_BinASTTokenReaderBase_h
rename from js/src/frontend/BinTokenReaderMultipart.cpp
rename to js/src/frontend/BinASTTokenReaderMultipart.cpp
--- a/js/src/frontend/BinTokenReaderMultipart.cpp
+++ b/js/src/frontend/BinASTTokenReaderMultipart.cpp
@@ -1,15 +1,15 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * vim: set ts=8 sts=2 et sw=2 tw=80:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "frontend/BinTokenReaderMultipart.h"
+#include "frontend/BinASTTokenReaderMultipart.h"
 
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/Casting.h"
 #include "mozilla/EndianUtils.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/ScopeExit.h"
 
 #include <utility>
@@ -35,52 +35,52 @@ const char SECTION_HEADER_TREE[] = "[TRE
 
 // The (only) internal compression mechanism understood by this parser.
 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 AutoList = BinASTTokenReaderMultipart::AutoList;
+using AutoTaggedTuple = BinASTTokenReaderMultipart::AutoTaggedTuple;
 using CharSlice = BinaryASTSupport::CharSlice;
-using Chars = BinTokenReaderMultipart::Chars;
+using Chars = BinASTTokenReaderMultipart::Chars;
 
-BinTokenReaderMultipart::BinTokenReaderMultipart(JSContext* cx,
-                                                 ErrorReporter* er,
-                                                 const uint8_t* start,
-                                                 const size_t length)
-    : BinTokenReaderBase(cx, er, start, length),
+BinASTTokenReaderMultipart::BinASTTokenReaderMultipart(JSContext* cx,
+                                                       ErrorReporter* er,
+                                                       const uint8_t* start,
+                                                       const size_t length)
+    : BinASTTokenReaderBase(cx, er, start, length),
       metadata_(nullptr),
       posBeforeTree_(nullptr) {
   MOZ_ASSERT(er);
 }
 
-BinTokenReaderMultipart::~BinTokenReaderMultipart() {
+BinASTTokenReaderMultipart::~BinASTTokenReaderMultipart() {
   if (metadata_ && metadataOwned_ == MetadataOwnership::Owned) {
     UniqueBinASTSourceMetadataPtr ptr(metadata_);
   }
 }
 
-BinASTSourceMetadata* BinTokenReaderMultipart::takeMetadata() {
+BinASTSourceMetadata* BinASTTokenReaderMultipart::takeMetadata() {
   MOZ_ASSERT(metadataOwned_ == MetadataOwnership::Owned);
   metadataOwned_ = MetadataOwnership::Unowned;
   return metadata_;
 }
 
-JS::Result<Ok> BinTokenReaderMultipart::initFromScriptSource(
+JS::Result<Ok> BinASTTokenReaderMultipart::initFromScriptSource(
     ScriptSource* scriptSource) {
   metadata_ = scriptSource->binASTSourceMetadata();
   metadataOwned_ = MetadataOwnership::Unowned;
 
   return Ok();
 }
 
-JS::Result<Ok> BinTokenReaderMultipart::readHeader() {
+JS::Result<Ok> BinASTTokenReaderMultipart::readHeader() {
   // Check that we don't call this function twice.
   MOZ_ASSERT(!posBeforeTree_);
 
   // Read global headers.
   MOZ_TRY(readConst(MAGIC_HEADER));
   BINJS_MOZ_TRY_DECL(version, readInternalUint32());
 
   // For the moment, MAGIC_FORMAT_VERSION is 0. Once we have a story
@@ -210,23 +210,23 @@ JS::Result<Ok> BinTokenReaderMultipart::
       posBeforeTree_ + treeByteLen < posBeforeTree_) {  // Sanity check.
     return raiseError("Invalid byte length in tree table");
   }
 
   // At this stage, we're ready to start reading the tree.
   return Ok();
 }
 
-void BinTokenReaderMultipart::traceMetadata(JSTracer* trc) {
+void BinASTTokenReaderMultipart::traceMetadata(JSTracer* trc) {
   if (metadata_) {
     metadata_->trace(trc);
   }
 }
 
-JS::Result<bool> BinTokenReaderMultipart::readBool() {
+JS::Result<bool> BinASTTokenReaderMultipart::readBool() {
   updateLatestKnownGood();
   BINJS_MOZ_TRY_DECL(byte, readByte());
 
   switch (byte) {
     case 0:
       return false;
     case 1:
       return true;
@@ -236,17 +236,17 @@ JS::Result<bool> BinTokenReaderMultipart
       return raiseError("Invalid boolean value");
   }
 }
 
 // Nullable doubles (little-endian)
 //
 // NULL_FLOAT_REPRESENTATION (signaling NaN) => null
 // anything other 64 bit sequence => IEEE-764 64-bit floating point number
-JS::Result<double> BinTokenReaderMultipart::readDouble() {
+JS::Result<double> BinASTTokenReaderMultipart::readDouble() {
   updateLatestKnownGood();
 
   uint8_t bytes[8];
   MOZ_ASSERT(sizeof(bytes) == sizeof(double));
   MOZ_TRY(
       readBuf(reinterpret_cast<uint8_t*>(bytes), mozilla::ArrayLength(bytes)));
 
   // Decode little-endian.
@@ -257,75 +257,75 @@ JS::Result<double> BinTokenReaderMultipa
   }
 
   // Canonicalize NaN, just to make sure another form of signalling NaN
   // doesn't slip past us.
   return JS::CanonicalizeNaN(mozilla::BitwiseCast<double>(asInt));
 }
 
 // A single atom is represented as an index into the table of strings.
-JS::Result<JSAtom*> BinTokenReaderMultipart::readMaybeAtom() {
+JS::Result<JSAtom*> BinASTTokenReaderMultipart::readMaybeAtom() {
   updateLatestKnownGood();
   BINJS_MOZ_TRY_DECL(index, readInternalUint32());
 
   if (index >= metadata_->numStrings()) {
     return raiseError("Invalid index to strings table");
   }
   return metadata_->getAtom(index);
 }
 
-JS::Result<JSAtom*> BinTokenReaderMultipart::readAtom() {
+JS::Result<JSAtom*> BinASTTokenReaderMultipart::readAtom() {
   BINJS_MOZ_TRY_DECL(maybe, readMaybeAtom());
 
   if (!maybe) {
     return raiseError("Empty string");
   }
 
   return maybe;
 }
 
-JS::Result<JSAtom*> BinTokenReaderMultipart::readMaybeIdentifierName() {
+JS::Result<JSAtom*> BinASTTokenReaderMultipart::readMaybeIdentifierName() {
   BINJS_MOZ_TRY_DECL(result, readMaybeAtom());
   if (result) {
     if (!IsIdentifier(result)) {
       return raiseError("Invalid identifier");
     }
   }
   return result;
 }
 
-JS::Result<JSAtom*> BinTokenReaderMultipart::readIdentifierName() {
+JS::Result<JSAtom*> BinASTTokenReaderMultipart::readIdentifierName() {
   BINJS_MOZ_TRY_DECL(result, readMaybeAtom());
   if (!IsIdentifier(result)) {
     return raiseError("Invalid identifier");
   }
   return result;
 }
 
-JS::Result<JSAtom*> BinTokenReaderMultipart::readMaybePropertyKey() {
+JS::Result<JSAtom*> BinASTTokenReaderMultipart::readMaybePropertyKey() {
   return readMaybeAtom();
 }
 
-JS::Result<JSAtom*> BinTokenReaderMultipart::readPropertyKey() {
+JS::Result<JSAtom*> BinASTTokenReaderMultipart::readPropertyKey() {
   return readAtom();
 }
 
-JS::Result<Ok> BinTokenReaderMultipart::readChars(Chars& out) {
+JS::Result<Ok> BinASTTokenReaderMultipart::readChars(Chars& out) {
   updateLatestKnownGood();
   BINJS_MOZ_TRY_DECL(index, readInternalUint32());
 
   if (index >= metadata_->numStrings()) {
     return raiseError("Invalid index to strings table for string enum");
   }
 
   out = metadata_->getSlice(index);
   return Ok();
 }
 
-JS::Result<BinVariant> BinTokenReaderMultipart::readVariant() {
+JS::Result<BinVariant> BinASTTokenReaderMultipart::readVariant() {
   updateLatestKnownGood();
   BINJS_MOZ_TRY_DECL(index, readInternalUint32());
 
   if (index >= metadata_->numStrings()) {
     return raiseError("Invalid index to strings table for string enum");
   }
 
   auto variantsPtr = variantsTable_.lookupForAdd(index);
@@ -348,37 +348,38 @@ JS::Result<BinVariant> BinTokenReaderMul
 
   if (!variantsTable_.add(variantsPtr, index, *variant)) {
     return raiseOOM();
   }
 
   return *variant;
 }
 
-JS::Result<BinTokenReaderBase::SkippableSubTree>
-BinTokenReaderMultipart::readSkippableSubTree() {
+JS::Result<BinASTTokenReaderBase::SkippableSubTree>
+BinASTTokenReaderMultipart::readSkippableSubTree() {
   updateLatestKnownGood();
   BINJS_MOZ_TRY_DECL(byteLen, readInternalUint32());
 
   if (current_ + byteLen > stop_ || current_ + byteLen < current_) {
     return raiseError("Invalid byte length in readSkippableSubTree");
   }
 
   const auto start = offset();
 
   current_ += byteLen;
 
-  return BinTokenReaderBase::SkippableSubTree(start, byteLen);
+  return BinASTTokenReaderBase::SkippableSubTree(start, byteLen);
 }
 
 // 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) {
+JS::Result<Ok> BinASTTokenReaderMultipart::enterTaggedTuple(
+    BinKind& tag, BinASTTokenReaderMultipart::BinFields&,
+    AutoTaggedTuple& guard) {
   BINJS_MOZ_TRY_DECL(index, readInternalUint32());
   if (index >= metadata_->numBinKinds()) {
     return raiseError("Invalid index to grammar table");
   }
 
   tag = metadata_->getBinKind(index);
 
   // Enter the body.
@@ -388,69 +389,71 @@ JS::Result<Ok> BinTokenReaderMultipart::
 
 // List:
 //
 // - uint32_t number of items;
 // - contents (specified by higher-level grammar);
 //
 // The total byte length of `number of items` + `contents` must be `byte
 // length`.
-JS::Result<Ok> BinTokenReaderMultipart::enterList(uint32_t& items,
-                                                  AutoList& guard) {
+JS::Result<Ok> BinASTTokenReaderMultipart::enterList(uint32_t& items,
+                                                     AutoList& guard) {
   guard.init();
 
   MOZ_TRY_VAR(items, readInternalUint32());
 
   return Ok();
 }
 
-void BinTokenReaderMultipart::AutoBase::init() { initialized_ = true; }
+void BinASTTokenReaderMultipart::AutoBase::init() { initialized_ = true; }
 
-BinTokenReaderMultipart::AutoBase::AutoBase(BinTokenReaderMultipart& reader)
+BinASTTokenReaderMultipart::AutoBase::AutoBase(
+    BinASTTokenReaderMultipart& reader)
     : initialized_(false), reader_(reader) {}
 
-BinTokenReaderMultipart::AutoBase::~AutoBase() {
+BinASTTokenReaderMultipart::AutoBase::~AutoBase() {
   // By now, the `AutoBase` must have been deinitialized by calling `done()`.
   // The only case in which we can accept not calling `done()` is if we have
   // bailed out because of an error.
   MOZ_ASSERT_IF(initialized_, reader_.hasRaisedError());
 }
 
-JS::Result<Ok> BinTokenReaderMultipart::AutoBase::checkPosition(
+JS::Result<Ok> BinASTTokenReaderMultipart::AutoBase::checkPosition(
     const uint8_t* expectedEnd) {
   if (reader_.current_ != expectedEnd) {
     return reader_.raiseError(
         "Caller did not consume the expected set of bytes");
   }
 
   return Ok();
 }
 
-BinTokenReaderMultipart::AutoList::AutoList(BinTokenReaderMultipart& reader)
+BinASTTokenReaderMultipart::AutoList::AutoList(
+    BinASTTokenReaderMultipart& reader)
     : AutoBase(reader) {}
 
-void BinTokenReaderMultipart::AutoList::init() { AutoBase::init(); }
+void BinASTTokenReaderMultipart::AutoList::init() { AutoBase::init(); }
 
-JS::Result<Ok> BinTokenReaderMultipart::AutoList::done() {
+JS::Result<Ok> BinASTTokenReaderMultipart::AutoList::done() {
   MOZ_ASSERT(initialized_);
   initialized_ = false;
   if (reader_.hasRaisedError()) {
     // Already errored, no need to check further.
     return reader_.cx_->alreadyReportedError();
   }
 
   return Ok();
 }
 
 // Internal uint32_t
 //
 // Encoded as variable length number.
 
 MOZ_MUST_USE JS::Result<uint32_t>
-BinTokenReaderMultipart::readInternalUint32() {
+BinASTTokenReaderMultipart::readInternalUint32() {
   uint32_t result = 0;
   uint32_t shift = 0;
   while (true) {
     MOZ_ASSERT(shift < 32);
     uint32_t byte;
     MOZ_TRY_VAR(byte, readByte());
 
     const uint32_t newResult = result | (byte >> 1) << shift;
@@ -466,21 +469,21 @@ BinTokenReaderMultipart::readInternalUin
     }
 
     if (shift >= 32) {
       return raiseError("Overflow during readInternalUint32");
     }
   }
 }
 
-BinTokenReaderMultipart::AutoTaggedTuple::AutoTaggedTuple(
-    BinTokenReaderMultipart& reader)
+BinASTTokenReaderMultipart::AutoTaggedTuple::AutoTaggedTuple(
+    BinASTTokenReaderMultipart& reader)
     : AutoBase(reader) {}
 
-JS::Result<Ok> BinTokenReaderMultipart::AutoTaggedTuple::done() {
+JS::Result<Ok> BinASTTokenReaderMultipart::AutoTaggedTuple::done() {
   MOZ_ASSERT(initialized_);
   initialized_ = false;
   if (reader_.hasRaisedError()) {
     // Already errored, no need to check further.
     return reader_.cx_->alreadyReportedError();
   }
 
   return Ok();
rename from js/src/frontend/BinTokenReaderMultipart.h
rename to js/src/frontend/BinASTTokenReaderMultipart.h
--- a/js/src/frontend/BinTokenReaderMultipart.h
+++ b/js/src/frontend/BinASTTokenReaderMultipart.h
@@ -1,22 +1,22 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * vim: set ts=8 sts=2 et sw=2 tw=80:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef frontend_BinTokenReaderMultipart_h
-#define frontend_BinTokenReaderMultipart_h
+#ifndef frontend_BinASTTokenReaderMultipart_h
+#define frontend_BinASTTokenReaderMultipart_h
 
 #include "mozilla/Maybe.h"
 
 #include "frontend/BinASTRuntimeSupport.h"
-#include "frontend/BinToken.h"
-#include "frontend/BinTokenReaderBase.h"
+#include "frontend/BinASTToken.h"
+#include "frontend/BinASTTokenReaderBase.h"
 
 #include "js/Result.h"
 
 namespace js {
 namespace frontend {
 
 /**
  * A token reader implementing the "multipart" serialization format for BinAST.
@@ -25,17 +25,18 @@ namespace frontend {
  * implementation of the BinAST compression suite, is designed to be
  * space- and time-efficient.
  *
  * 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 {
+class MOZ_STACK_CLASS BinASTTokenReaderMultipart
+    : public BinASTTokenReaderBase {
  public:
   class AutoList;
   class AutoTaggedTuple;
 
   using CharSlice = BinaryASTSupport::CharSlice;
 
   // This implementation of `BinFields` is effectively `void`, as the format
   // does not embed field information.
@@ -46,28 +47,28 @@ class MOZ_STACK_CLASS BinTokenReaderMult
   using Chars = CharSlice;
 
  public:
   /**
    * Construct a token reader.
    *
    * Does NOT copy the buffer.
    */
-  BinTokenReaderMultipart(JSContext* cx, ErrorReporter* er,
-                          const uint8_t* start, const size_t length);
+  BinASTTokenReaderMultipart(JSContext* cx, ErrorReporter* er,
+                             const uint8_t* start, const size_t length);
 
   /**
    * Construct a token reader.
    *
    * Does NOT copy the buffer.
    */
-  BinTokenReaderMultipart(JSContext* cx, ErrorReporter* er,
-                          const Vector<uint8_t>& chars);
+  BinASTTokenReaderMultipart(JSContext* cx, ErrorReporter* er,
+                             const Vector<uint8_t>& chars);
 
-  ~BinTokenReaderMultipart();
+  ~BinASTTokenReaderMultipart();
 
   /**
    * Read the header of the file.
    */
   MOZ_MUST_USE JS::Result<Ok> readHeader();
 
   // --- Primitive values.
   //
@@ -165,17 +166,17 @@ class MOZ_STACK_CLASS BinTokenReaderMult
    * 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()`.
    *
    * @return out If the header of the tuple is invalid.
    */
   MOZ_MUST_USE JS::Result<Ok> enterTaggedTuple(
-      BinKind& tag, BinTokenReaderMultipart::BinFields& fields,
+      BinKind& tag, BinASTTokenReaderMultipart::BinFields& fields,
       AutoTaggedTuple& guard);
 
   /**
    * Read a single unsigned long.
    */
   MOZ_MUST_USE JS::Result<uint32_t> readUnsignedLong() {
     return readInternalUint32();
   }
@@ -193,19 +194,19 @@ class MOZ_STACK_CLASS BinTokenReaderMult
       variantsTable_;
 
   enum class MetadataOwnership { Owned, Unowned };
   MetadataOwnership metadataOwned_;
   BinASTSourceMetadata* metadata_;
 
   const uint8_t* posBeforeTree_;
 
-  BinTokenReaderMultipart(const BinTokenReaderMultipart&) = delete;
-  BinTokenReaderMultipart(BinTokenReaderMultipart&&) = delete;
-  BinTokenReaderMultipart& operator=(BinTokenReaderMultipart&) = delete;
+  BinASTTokenReaderMultipart(const BinASTTokenReaderMultipart&) = delete;
+  BinASTTokenReaderMultipart(BinASTTokenReaderMultipart&&) = delete;
+  BinASTTokenReaderMultipart& operator=(BinASTTokenReaderMultipart&) = delete;
 
  public:
   void traceMetadata(JSTracer* trc);
   BinASTSourceMetadata* takeMetadata();
   MOZ_MUST_USE JS::Result<Ok> initFromScriptSource(ScriptSource* scriptSource);
 
  public:
   // The following classes are used whenever we encounter a tuple/tagged
@@ -219,48 +220,48 @@ class MOZ_STACK_CLASS BinTokenReaderMult
   //
   // In either case, the caller MUST call method `done()` of the guard once
   // it is done reading the tuple/tagged tuple/list, to report any pending
   // error.
 
   // Base class used by other Auto* classes.
   class MOZ_STACK_CLASS AutoBase {
    protected:
-    explicit AutoBase(BinTokenReaderMultipart& reader);
+    explicit AutoBase(BinASTTokenReaderMultipart& reader);
     ~AutoBase();
 
     // Raise an error if we are not in the expected position.
     MOZ_MUST_USE JS::Result<Ok> checkPosition(const uint8_t* expectedPosition);
 
-    friend BinTokenReaderMultipart;
+    friend BinASTTokenReaderMultipart;
     void init();
 
     // Set to `true` if `init()` has been called. Reset to `false` once
     // all conditions have been checked.
     bool initialized_;
-    BinTokenReaderMultipart& reader_;
+    BinASTTokenReaderMultipart& reader_;
   };
 
   // Guard class used to ensure that `enterList` is used properly.
   class MOZ_STACK_CLASS AutoList : public AutoBase {
    public:
-    explicit AutoList(BinTokenReaderMultipart& reader);
+    explicit AutoList(BinASTTokenReaderMultipart& reader);
 
     // Check that we have properly read to the end of the list.
     MOZ_MUST_USE JS::Result<Ok> done();
 
    protected:
-    friend BinTokenReaderMultipart;
+    friend BinASTTokenReaderMultipart;
     void init();
   };
 
   // Guard class used to ensure that `enterTaggedTuple` is used properly.
   class MOZ_STACK_CLASS AutoTaggedTuple : public AutoBase {
    public:
-    explicit AutoTaggedTuple(BinTokenReaderMultipart& reader);
+    explicit AutoTaggedTuple(BinASTTokenReaderMultipart& 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]) {
@@ -290,9 +291,9 @@ class MOZ_STACK_CLASS BinTokenReaderMult
     // Not implemented in this tokenizer.
     return Ok();
   }
 };
 
 }  // namespace frontend
 }  // namespace js
 
-#endif  // frontend_BinTokenReaderMultipart_h
+#endif  // frontend_BinASTTokenReaderMultipart_h
--- a/js/src/frontend/BytecodeCompiler.cpp
+++ b/js/src/frontend/BytecodeCompiler.cpp
@@ -761,18 +761,18 @@ JSScript* frontend::CompileGlobalBinASTS
   if (!script) {
     return nullptr;
   }
 
   Directives directives(options.strictOption);
   GlobalSharedContext globalsc(cx, ScopeKind::Global, directives,
                                options.extraWarningsOption);
 
-  frontend::BinASTParser<BinTokenReaderMultipart> parser(cx, alloc, usedNames,
-                                                         options, sourceObj);
+  frontend::BinASTParser<BinASTTokenReaderMultipart> parser(
+      cx, alloc, usedNames, options, sourceObj);
 
   // Metadata stores internal pointers, so we must use the same buffer every
   // time, including for lazy parses
   ScriptSource* ss = sourceObj->source();
   BinASTSourceMetadata* metadata = nullptr;
   auto parsed =
       parser.parse(&globalsc, ss->binASTSource(), ss->length(), &metadata);
 
@@ -1052,17 +1052,17 @@ bool frontend::CompileLazyBinASTFunction
   if (!script) {
     return false;
   }
 
   if (lazy->hasBeenCloned()) {
     script->setHasBeenCloned();
   }
 
-  frontend::BinASTParser<BinTokenReaderMultipart> parser(
+  frontend::BinASTParser<BinASTTokenReaderMultipart> parser(
       cx, cx->tempLifoAlloc(), usedNames, options, sourceObj, lazy);
 
   auto parsed =
       parser.parseLazyFunction(lazy->scriptSource(), lazy->sourceStart());
 
   if (parsed.isErr()) {
     return false;
   }
--- a/js/src/frontend/binast/README.md
+++ b/js/src/frontend/binast/README.md
@@ -1,13 +1,13 @@
 A parser generator used to generate the following files:
 
 - js/src/frontend/BinASTParser.h
 - js/src/frontend/BinASTParser.cpp
-- js/src/frontent/BinToken.h
+- js/src/frontent/BinASTToken.h
 
 from the following files:
 
 - js/src/frontend/BinAST.webidl_ (specifications of BinAST)
 - js/src/frontend/BinAST.yaml (parser generator driver)
 
 To use it:
 ```sh
--- a/js/src/frontend/binast/build.sh
+++ b/js/src/frontend/binast/build.sh
@@ -1,25 +1,25 @@
 #!/bin/sh
 
 cargo run -- \
       ../BinAST.webidl_ \
       ../BinAST.yaml \
       --out-class ../BinASTParser-tmp.h    \
       --out-impl ../BinASTParser-tmp.cpp   \
       --out-enum ../BinASTEnum-tmp.h    \
-      --out-token ../BinToken-tmp.h
+      --out-token ../BinASTToken-tmp.h
 
 MACH=../../../../mach
 
 ${MACH} clang-format --path \
         ../BinASTParser-tmp.h \
         ../BinASTParser-tmp.cpp \
         ../BinASTEnum-tmp.h \
-        ../BinToken-tmp.h
+        ../BinASTToken-tmp.h
 
 # Usage: update SRC DST
 #
 # If SRC file and DST file have different content, move SRC file to DST file.
 # If not, remove SRC file.
 update() {
   SRC=$1
   DST=$2
@@ -31,9 +31,9 @@ update() {
       echo "UPDATED: ${DST} was modified"
       mv ${SRC} ${DST}
   fi
 }
 
 update ../BinASTParser-tmp.h ../BinASTParser.h
 update ../BinASTParser-tmp.cpp ../BinASTParser.cpp
 update ../BinASTEnum-tmp.h ../BinASTEnum.h
-update ../BinToken-tmp.h ../BinToken.h
+update ../BinASTToken-tmp.h ../BinASTToken.h
--- a/js/src/frontend/binast/src/main.rs
+++ b/js/src/frontend/binast/src/main.rs
@@ -1750,17 +1750,17 @@ impl CPPExporter {
                         Some(format!("MOZ_TRY_VAR({var_name}, tokenizer_->readBool());", var_name = var_name)))
                     } else {
                         (None,
                         Some(format!("BINJS_MOZ_TRY_DECL({var_name}, tokenizer_->readBool());", var_name = var_name)))
                     }
                 }
                 Some(IsNullable { is_nullable: false, content: Primitive::Offset }) => {
                     if needs_block {
-                        (Some(format!("BinTokenReaderBase::SkippableSubTree {var_name};", var_name = var_name)),
+                        (Some(format!("BinASTTokenReaderBase::SkippableSubTree {var_name};", var_name = var_name)),
                         Some(format!("MOZ_TRY_VAR({var_name}, tokenizer_->readSkippableSubTree());", var_name = var_name)))
                     } else {
                         (None,
                         Some(format!("BINJS_MOZ_TRY_DECL({var_name}, tokenizer_->readSkippableSubTree());", var_name = var_name)))
                     }
                 }
                 Some(IsNullable { content: Primitive::Void, .. }) => {
                     warn!("Internal error: We shouldn't have any `void` types at this stage.");
--- a/js/src/frontend/moz.build
+++ b/js/src/frontend/moz.build
@@ -68,27 +68,27 @@ if CONFIG['JS_BUILD_BINAST']:
     # platforms.
 
     # These parts of BinAST should eventually move to release.
     SOURCES += [
         'BinASTParser.cpp',
         'BinASTParserBase.cpp',
         'BinASTParserPerTokenizer.cpp',
         'BinASTRuntimeSupport.cpp',
-        'BinToken.cpp',
-        'BinTokenReaderBase.cpp',
-        'BinTokenReaderMultipart.cpp',
+        'BinASTToken.cpp',
+        'BinASTTokenReaderBase.cpp',
+        'BinASTTokenReaderMultipart.cpp',
     ]
 
     DIRS += [
         'binast'
     ]
 
     # Instrument BinAST files for fuzzing as we have a fuzzing target for BinAST.
     if CONFIG['FUZZING_INTERFACES'] and CONFIG['LIBFUZZER']:
         include('/tools/fuzzing/libfuzzer-flags.mozbuild')
 
         SOURCES['BinASTParser.cpp'].flags += libfuzzer_flags
         SOURCES['BinASTParserBase.cpp'].flags += libfuzzer_flags
         SOURCES['BinASTParserPerTokenizer.cpp'].flags += libfuzzer_flags
-        SOURCES['BinToken.cpp'].flags += libfuzzer_flags
-        SOURCES['BinTokenReaderBase.cpp'].flags += libfuzzer_flags
-        SOURCES['BinTokenReaderMultipart.cpp'].flags += libfuzzer_flags
+        SOURCES['BinASTToken.cpp'].flags += libfuzzer_flags
+        SOURCES['BinASTTokenReaderBase.cpp'].flags += libfuzzer_flags
+        SOURCES['BinASTTokenReaderMultipart.cpp'].flags += libfuzzer_flags
--- a/js/src/jsapi-tests/testBinASTReader.cpp
+++ b/js/src/jsapi-tests/testBinASTReader.cpp
@@ -454,17 +454,17 @@ void runTestFromPath(JSContext* cx, cons
   if (closedir(dir) != 0) {
     MOZ_CRASH("Could not close dir");
   }
 #endif  // defined(XP_WIN)
 }
 
 BEGIN_TEST(testBinASTReaderMultipartECMAScript2) {
 #if defined(XP_WIN)
-  runTestFromPath<js::frontend::BinTokenReaderMultipart>(
+  runTestFromPath<js::frontend::BinASTTokenReaderMultipart>(
       cx, "jsapi-tests\\binast\\parser\\multipart\\");
 #else
-  runTestFromPath<js::frontend::BinTokenReaderMultipart>(
+  runTestFromPath<js::frontend::BinASTTokenReaderMultipart>(
       cx, "jsapi-tests/binast/parser/multipart/");
 #endif  // defined(XP_XIN)
   return true;
 }
 END_TEST(testBinASTReaderMultipartECMAScript2)
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -80,17 +80,17 @@
 #include "gc/PublicIterators.h"
 #include "jit/arm/Simulator-arm.h"
 #include "jit/InlinableNatives.h"
 #include "jit/Ion.h"
 #include "jit/JitcodeMap.h"
 #include "jit/JitRealm.h"
 #include "jit/shared/CodeGenerator-shared.h"
 #include "js/ArrayBuffer.h"  // JS::{CreateMappedArrayBufferContents,NewMappedArrayBufferWithContents,IsArrayBufferObject,GetArrayBufferLengthAndData}
-#include "js/BuildId.h"  // JS::BuildIdCharVector, JS::SetProcessBuildIdOp
+#include "js/BuildId.h"      // JS::BuildIdCharVector, JS::SetProcessBuildIdOp
 #include "js/CharacterEncoding.h"
 #include "js/CompilationAndEvaluation.h"
 #include "js/CompileOptions.h"
 #include "js/ContextOptions.h"  // JS::ContextOptions{,Ref}
 #include "js/Debug.h"
 #include "js/Equality.h"  // JS::SameValue
 #include "js/GCVector.h"
 #include "js/Initialization.h"
@@ -5104,17 +5104,17 @@ static bool BinParse(JSContext* cx, unsi
       cx, frontend::CreateScriptSourceObject(cx, options, Nothing()));
   if (!sourceObj) {
     return false;
   }
 
   Directives directives(false);
   GlobalSharedContext globalsc(cx, ScopeKind::Global, directives, false);
 
-  auto parseFunc = ParseBinASTData<frontend::BinTokenReaderMultipart>;
+  auto parseFunc = ParseBinASTData<frontend::BinASTTokenReaderMultipart>;
   if (!parseFunc(cx, buf_data, buf_length, &globalsc, usedNames, options,
                  sourceObj)) {
     return false;
   }
 
   args.rval().setUndefined();
   return true;
 }
@@ -10884,17 +10884,18 @@ int main(int argc, char** argv, char** e
           "Choose to enable a subset of the wasm compilers (valid options are "
           "none/baseline/ion/cranelift/baseline+ion/baseline+cranelift)") ||
       !op.addBoolOption('\0', "wasm-verbose",
                         "Enable WebAssembly verbose logging") ||
       !op.addBoolOption('\0', "test-wasm-await-tier2",
                         "Forcibly activate tiering and block "
                         "instantiation on completion of tier2")
 #ifdef ENABLE_WASM_GC
-      || !op.addBoolOption('\0', "wasm-gc", "Enable experimental wasm GC features")
+      ||
+      !op.addBoolOption('\0', "wasm-gc", "Enable experimental wasm GC features")
 #else
       || !op.addBoolOption('\0', "wasm-gc", "No-op")
 #endif
       || !op.addBoolOption('\0', "no-native-regexp",
                            "Disable native regexp compilation") ||
       !op.addBoolOption('\0', "no-unboxed-objects",
                         "Disable creating unboxed plain objects") ||
       !op.addBoolOption('\0', "enable-streams",