Backed out 6 changesets (bug 1550616) for causing build bustages in MacroAssembler-arm64.h
authorNoemi Erli <nerli@mozilla.com>
Sun, 12 May 2019 05:09:23 +0300
changeset 535424 464bde42a1588d89f7822d175f86db7f93d211ea
parent 535423 f1a3220fc10b57240e57bde4bfeba9745013dffe
child 535425 08eb61c337951a2f136faa08b029e34234aae08b
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1550616
milestone68.0a1
backs outf1a3220fc10b57240e57bde4bfeba9745013dffe
b435e9bb58cc70ce432f6f3fc837fa318d35a637
1b35028d64e470f26dd1fec14b331194b86fec30
5fd47cd91b82fb4c4711dce0963d3175fbe29375
59f2744f50c51af18a58bafc9832550be1cac41f
dc57399bbbe3f1e526863e4f2467effc16ffedc2
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
Backed out 6 changesets (bug 1550616) for causing build bustages in MacroAssembler-arm64.h Backed out changeset f1a3220fc10b (bug 1550616) Backed out changeset b435e9bb58cc (bug 1550616) Backed out changeset 1b35028d64e4 (bug 1550616) Backed out changeset 5fd47cd91b82 (bug 1550616) Backed out changeset 59f2744f50c5 (bug 1550616) Backed out changeset dc57399bbbe3 (bug 1550616)
js/src/builtin/ModuleObject.cpp
js/src/builtin/ModuleObject.h
js/src/builtin/ReflectParse.cpp
js/src/frontend/BytecodeCompilation.h
js/src/frontend/BytecodeCompiler.cpp
js/src/frontend/FullParseHandler.h
js/src/frontend/ModuleSharedContext.h
js/src/frontend/ParseNode.h
js/src/frontend/Parser.cpp
js/src/frontend/Parser.h
js/src/frontend/SharedContext.h
js/src/frontend/SyntaxParseHandler.h
js/src/frontend/Token.h
js/src/frontend/TokenStream.h
js/src/gc/Barrier.cpp
js/src/jit/mips32/MacroAssembler-mips32-inl.h
js/src/jit/mips64/MacroAssembler-mips64-inl.h
js/src/jit/x64/MacroAssembler-x64.h
js/src/jit/x86/MacroAssembler-x86.h
js/src/shell/js.cpp
js/src/vm/ModuleBuilder.h
js/src/vm/SelfHosting.cpp
--- a/js/src/builtin/ModuleObject.cpp
+++ b/js/src/builtin/ModuleObject.cpp
@@ -15,17 +15,16 @@
 #include "frontend/SharedContext.h"
 #include "gc/FreeOp.h"
 #include "gc/Policy.h"
 #include "gc/Tracer.h"
 #include "js/PropertySpec.h"
 #include "vm/AsyncFunction.h"
 #include "vm/AsyncIteration.h"
 #include "vm/EqualityOperations.h"  // js::SameValue
-#include "vm/ModuleBuilder.h"       // js::ModuleBuilder
 #include "vm/SelfHosting.h"
 
 #include "vm/JSObject-inl.h"
 #include "vm/JSScript-inl.h"
 
 using namespace js;
 
 static_assert(MODULE_STATUS_UNINSTANTIATED < MODULE_STATUS_INSTANTIATING &&
--- a/js/src/builtin/ModuleObject.h
+++ b/js/src/builtin/ModuleObject.h
@@ -7,29 +7,36 @@
 #ifndef builtin_ModuleObject_h
 #define builtin_ModuleObject_h
 
 #include "mozilla/Maybe.h"
 
 #include "jsapi.h"
 
 #include "builtin/SelfHostingDefines.h"
+#include "frontend/EitherParser.h"
 #include "gc/Zone.h"
 #include "js/GCVector.h"
 #include "js/Id.h"
 #include "js/UniquePtr.h"
 #include "vm/JSAtom.h"
 #include "vm/NativeObject.h"
 #include "vm/ProxyObject.h"
 
 namespace js {
 
 class ModuleEnvironmentObject;
 class ModuleObject;
 
+namespace frontend {
+class BinaryNode;
+class ListNode;
+class ParseNode;
+} /* namespace frontend */
+
 typedef Rooted<ModuleObject*> RootedModuleObject;
 typedef Handle<ModuleObject*> HandleModuleObject;
 typedef Rooted<ModuleEnvironmentObject*> RootedModuleEnvironmentObject;
 typedef Handle<ModuleEnvironmentObject*> HandleModuleEnvironmentObject;
 
 class ImportEntryObject : public NativeObject {
  public:
   enum {
@@ -319,16 +326,86 @@ class ModuleObject : public NativeObject
 
   static void trace(JSTracer* trc, JSObject* obj);
   static void finalize(js::FreeOp* fop, JSObject* obj);
 
   bool hasImportBindings() const;
   FunctionDeclarationVector* functionDeclarations();
 };
 
+// Process a module's parse tree to collate the import and export data used when
+// creating a ModuleObject.
+class MOZ_STACK_CLASS ModuleBuilder {
+  explicit ModuleBuilder(JSContext* cx, HandleModuleObject module,
+                         const frontend::EitherParser& eitherParser);
+
+ public:
+  template <class Parser>
+  explicit ModuleBuilder(JSContext* cx, HandleModuleObject module,
+                         Parser* parser)
+      : ModuleBuilder(cx, module, frontend::EitherParser(parser)) {}
+
+  bool processImport(frontend::BinaryNode* importNode);
+  bool processExport(frontend::ParseNode* exportNode);
+  bool processExportFrom(frontend::BinaryNode* exportNode);
+
+  bool hasExportedName(JSAtom* name) const;
+
+  using ExportEntryVector = GCVector<ExportEntryObject*>;
+  const ExportEntryVector& localExportEntries() const {
+    return localExportEntries_;
+  }
+
+  bool buildTables();
+  bool initModule();
+
+ private:
+  using RequestedModuleVector = GCVector<RequestedModuleObject*>;
+  using AtomSet = JS::GCHashSet<JSAtom*>;
+  using ImportEntryMap = GCHashMap<JSAtom*, ImportEntryObject*>;
+  using RootedExportEntryVector = JS::Rooted<ExportEntryVector>;
+  using RootedRequestedModuleVector = JS::Rooted<RequestedModuleVector>;
+  using RootedAtomSet = JS::Rooted<AtomSet>;
+  using RootedImportEntryMap = JS::Rooted<ImportEntryMap>;
+
+  JSContext* cx_;
+  RootedModuleObject module_;
+  frontend::EitherParser eitherParser_;
+  RootedAtomSet requestedModuleSpecifiers_;
+  RootedRequestedModuleVector requestedModules_;
+  RootedImportEntryMap importEntries_;
+  RootedExportEntryVector exportEntries_;
+  RootedAtomSet exportNames_;
+  RootedExportEntryVector localExportEntries_;
+  RootedExportEntryVector indirectExportEntries_;
+  RootedExportEntryVector starExportEntries_;
+
+  ImportEntryObject* importEntryFor(JSAtom* localName) const;
+
+  bool processExportBinding(frontend::ParseNode* pn);
+  bool processExportArrayBinding(frontend::ListNode* array);
+  bool processExportObjectBinding(frontend::ListNode* obj);
+
+  bool appendImportEntryObject(HandleImportEntryObject importEntry);
+
+  bool appendExportEntry(HandleAtom exportName, HandleAtom localName,
+                         frontend::ParseNode* node = nullptr);
+  bool appendExportFromEntry(HandleAtom exportName, HandleAtom moduleRequest,
+                             HandleAtom importName, frontend::ParseNode* node);
+  bool appendExportEntryObject(HandleExportEntryObject exportEntry);
+
+  bool maybeAppendRequestedModule(HandleAtom specifier,
+                                  frontend::ParseNode* node);
+
+  template <typename T>
+  ArrayObject* createArray(const JS::Rooted<GCVector<T>>& vector);
+  template <typename K, typename V>
+  ArrayObject* createArray(const JS::Rooted<GCHashMap<K, V>>& map);
+};
+
 JSObject* GetOrCreateModuleMetaObject(JSContext* cx, HandleObject module);
 
 JSObject* CallModuleResolveHook(JSContext* cx, HandleValue referencingPrivate,
                                 HandleString specifier);
 
 JSObject* StartDynamicModuleImport(JSContext* cx, HandleScript script,
                                    HandleValue specifier);
 
--- a/js/src/builtin/ReflectParse.cpp
+++ b/js/src/builtin/ReflectParse.cpp
@@ -19,17 +19,16 @@
 #include "frontend/ModuleSharedContext.h"
 #include "frontend/ParseNode.h"
 #include "frontend/Parser.h"
 #include "js/CharacterEncoding.h"
 #include "js/StableStringChars.h"
 #include "vm/BigIntType.h"
 #include "vm/JSAtom.h"
 #include "vm/JSObject.h"
-#include "vm/ModuleBuilder.h"  // js::ModuleBuilder
 #include "vm/RegExpObject.h"
 
 #include "vm/JSObject-inl.h"
 
 using namespace js;
 using namespace js::frontend;
 
 using JS::AutoStableStringChars;
--- a/js/src/frontend/BytecodeCompilation.h
+++ b/js/src/frontend/BytecodeCompilation.h
@@ -10,34 +10,33 @@
 #include "mozilla/Assertions.h"  // MOZ_ASSERT
 #include "mozilla/Attributes.h"  // MOZ_MUST_USE, MOZ_STACK_CLASS
 #include "mozilla/Maybe.h"       // mozilla::Maybe, mozilla::Nothing
 #include "mozilla/Utf8.h"        // mozilla::Utf8Unit
 
 #include <stddef.h>  // size_t
 #include <stdint.h>  // uint32_t
 
+#include "frontend/EitherParser.h"  // js::frontend::EitherParser
 #include "frontend/ParseContext.h"  // js::frontend::UsedNameTracker
 #include "frontend/SharedContext.h"  // js::frontend::Directives, js::frontend::{,Eval,Global}SharedContext
 #include "js/CompileOptions.h"  // JS::ReadOnlyCompileOptions
 #include "js/RootingAPI.h"      // JS::{,Mutable}Handle, JS::Rooted
 #include "js/SourceText.h"      // JS::SourceText
 #include "vm/JSContext.h"       // js::AutoKeepAtoms
 #include "vm/JSScript.h"  // js::{FunctionAsync,Generator}Kind, js::LazyScript, JSScript, js::ScriptSource, js::ScriptSourceObject
 #include "vm/Scope.h"     // js::ScopeKind
 
 class JSFunction;
 class JSObject;
 
 namespace js {
 
 namespace frontend {
 
-class EitherParser;
-
 template <typename Unit>
 class SourceAwareCompiler;
 template <typename Unit>
 class ScriptCompiler;
 template <typename Unit>
 class ModuleCompiler;
 template <typename Unit>
 class StandaloneFunctionCompiler;
--- a/js/src/frontend/BytecodeCompiler.cpp
+++ b/js/src/frontend/BytecodeCompiler.cpp
@@ -21,17 +21,16 @@
 #include "frontend/ErrorReporter.h"
 #include "frontend/FoldConstants.h"
 #include "frontend/ModuleSharedContext.h"
 #include "frontend/Parser.h"
 #include "js/SourceText.h"
 #include "vm/GlobalObject.h"
 #include "vm/JSContext.h"
 #include "vm/JSScript.h"
-#include "vm/ModuleBuilder.h"  // js::ModuleBuilder
 #include "vm/TraceLogging.h"
 #include "wasm/AsmJS.h"
 
 #include "vm/EnvironmentObject-inl.h"
 #include "vm/GeckoProfiler-inl.h"
 #include "vm/JSContext-inl.h"
 
 using namespace js;
--- a/js/src/frontend/FullParseHandler.h
+++ b/js/src/frontend/FullParseHandler.h
@@ -18,18 +18,16 @@
 #include "vm/JSContext.h"
 
 namespace js {
 
 class RegExpObject;
 
 namespace frontend {
 
-class TokenStreamAnyChars;
-
 enum class SourceKind {
   // We are parsing from a text source (Parser.h)
   Text,
   // We are parsing from a binary source (BinASTParser.h)
   Binary,
 };
 
 // Parse handler used when generating a full parse tree for all code which the
--- a/js/src/frontend/ModuleSharedContext.h
+++ b/js/src/frontend/ModuleSharedContext.h
@@ -5,25 +5,22 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef frontend_ModuleSharedContext_h
 #define frontend_ModuleSharedContext_h
 
 #include "mozilla/Assertions.h"  // MOZ_ASSERT
 #include "mozilla/Attributes.h"  // MOZ_STACK_CLASS
 
-#include "builtin/ModuleObject.h"    // js::ModuleObject
+#include "builtin/ModuleObject.h"    // js::Module{Builder,Object}
 #include "frontend/SharedContext.h"  // js::frontend::SharedContext
 #include "js/RootingAPI.h"           // JS::Handle, JS::Rooted
 #include "vm/Scope.h"                // js::{Module,}Scope
 
 namespace js {
-
-class ModuleBuilder;
-
 namespace frontend {
 
 class MOZ_STACK_CLASS ModuleSharedContext : public SharedContext {
   JS::Rooted<ModuleObject*> module_;
   JS::Rooted<Scope*> enclosingScope_;
 
  public:
   JS::Rooted<ModuleScope::Data*> bindings;
--- a/js/src/frontend/ParseNode.h
+++ b/js/src/frontend/ParseNode.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_ParseNode_h
 #define frontend_ParseNode_h
 
 #include "mozilla/Attributes.h"
 
-#include "frontend/Token.h"
+#include "frontend/TokenStream.h"
 #include "vm/BigIntType.h"
 #include "vm/BytecodeUtil.h"
 #include "vm/Printer.h"
 #include "vm/Scope.h"
 
 /* clang-format off */
 //
 // A few notes on lifetime of ParseNode trees:
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -43,17 +43,16 @@
 #include "frontend/TokenStream.h"
 #include "irregexp/RegExpParser.h"
 #include "js/RegExpFlags.h"  // JS::RegExpFlags
 #include "vm/BytecodeUtil.h"
 #include "vm/JSAtom.h"
 #include "vm/JSContext.h"
 #include "vm/JSFunction.h"
 #include "vm/JSScript.h"
-#include "vm/ModuleBuilder.h"  // js::ModuleBuilder
 #include "vm/RegExpObject.h"
 #include "vm/StringType.h"
 #include "wasm/AsmJS.h"
 
 #include "frontend/ParseContext-inl.h"
 #include "frontend/SharedContext-inl.h"
 #include "vm/EnvironmentObject-inl.h"
 
@@ -2103,27 +2102,16 @@ JSAtom* ParserBase::prefixAccessorName(P
   if (!str) {
     return nullptr;
   }
 
   return AtomizeString(cx_, str);
 }
 
 template <class ParseHandler, typename Unit>
-void GeneralParser<ParseHandler, Unit>::setFunctionStartAtCurrentToken(
-    FunctionBox* funbox) const {
-  uint32_t bufStart = anyChars.currentToken().pos.begin;
-
-  uint32_t startLine, startColumn;
-  tokenStream.computeLineAndColumn(bufStart, &startLine, &startColumn);
-
-  funbox->setStart(bufStart, startLine, startColumn);
-}
-
-template <class ParseHandler, typename Unit>
 bool GeneralParser<ParseHandler, Unit>::functionArguments(
     YieldHandling yieldHandling, FunctionSyntaxKind kind,
     FunctionNodeType funNode) {
   FunctionBox* funbox = pc_->functionBox();
 
   bool parenFreeArrow = false;
   // Modifier for the following tokens.
   // TokenStream::SlashIsDiv for the following cases:
@@ -2177,17 +2165,17 @@ bool GeneralParser<ParseHandler, Unit>::
                                               : JSMSG_PAREN_BEFORE_FORMAL);
       return false;
     }
 
     firstTokenPos = pos();
 
     // Record the start of function source (for FunctionToString). If we
     // are parenFreeArrow, we will set this below, after consuming the NAME.
-    setFunctionStartAtCurrentToken(funbox);
+    tokenStream.setFunctionStart(funbox);
   } else {
     // When delazifying, we may not have a current token and pos() is
     // garbage. In that case, substitute the first token's position.
     if (!tokenStream.peekTokenPos(&firstTokenPos, firstTokenModifier)) {
       return false;
     }
   }
 
@@ -2292,17 +2280,17 @@ bool GeneralParser<ParseHandler, Unit>::
 
         default: {
           if (!TokenKindIsPossibleIdentifier(tt)) {
             error(JSMSG_MISSING_FORMAL);
             return false;
           }
 
           if (parenFreeArrow) {
-            setFunctionStartAtCurrentToken(funbox);
+            tokenStream.setFunctionStart(funbox);
           }
 
           RootedPropertyName name(cx_, bindingIdentifier(yieldHandling));
           if (!name) {
             return false;
           }
 
           if (!notePositionalFormalParameter(funNode, name, pos().begin,
@@ -2908,20 +2896,16 @@ FunctionNode* Parser<FullParseHandler, U
       return null();
     }
   }
   funNode = &node->as<FunctionNode>();
 
   return funNode;
 }
 
-void ParserBase::setFunctionEndFromCurrentToken(FunctionBox* funbox) const {
-  funbox->setEnd(anyChars.currentToken().pos.end);
-}
-
 template <class ParseHandler, typename Unit>
 bool GeneralParser<ParseHandler, Unit>::functionFormalParametersAndBody(
     InHandling inHandling, YieldHandling yieldHandling,
     FunctionNodeType* funNode, FunctionSyntaxKind kind,
     const Maybe<uint32_t>& parameterListEnd /* = Nothing() */,
     bool isStandaloneFunction /* = false */) {
   // Given a properly initialized parse context, try to parse an actual
   // function without concern for conversion to strict mode, use of lazy
@@ -3052,25 +3036,25 @@ bool GeneralParser<ParseHandler, Unit>::
       return false;
     }
     if (actual != TokenKind::RightCurly) {
       reportMissingClosing(JSMSG_CURLY_AFTER_BODY, JSMSG_CURLY_OPENED,
                            openedPos);
       return false;
     }
 
-    setFunctionEndFromCurrentToken(funbox);
+    funbox->setEnd(anyChars);
   } else {
     MOZ_ASSERT(kind == FunctionSyntaxKind::Arrow);
 
     if (anyChars.hadError()) {
       return false;
     }
 
-    setFunctionEndFromCurrentToken(funbox);
+    funbox->setEnd(anyChars);
 
     if (kind == FunctionSyntaxKind::Statement) {
       if (!matchOrInsertSemicolon()) {
         return false;
       }
     }
   }
 
@@ -7161,34 +7145,34 @@ GeneralParser<ParseHandler, Unit>::synth
   FunctionBox* funbox = newFunctionBox(funNode, fun, classNameOffset,
                                        directives, GeneratorKind::NotGenerator,
                                        FunctionAsyncKind::SyncFunction);
   if (!funbox) {
     return null();
   }
   funbox->initWithEnclosingParseContext(pc_, functionSyntaxKind);
   handler_.setFunctionBox(funNode, funbox);
-  setFunctionEndFromCurrentToken(funbox);
+  funbox->setEnd(anyChars);
 
   // Push a SourceParseContext on to the stack.
   SourceParseContext funpc(this, funbox, /* newDirectives = */ nullptr);
   if (!funpc.init()) {
     return null();
   }
 
   TokenPos synthesizedBodyPos = TokenPos(classNameOffset, classNameOffset + 1);
   // Create a ListNode for the parameters + body (there are no parameters).
   ListNodeType argsbody =
       handler_.newList(ParseNodeKind::ParamsBody, synthesizedBodyPos);
   if (!argsbody) {
     return null();
   }
   handler_.setFunctionFormalParametersAndBody(funNode, argsbody);
   funbox->function()->setArgCount(0);
-  setFunctionStartAtCurrentToken(funbox);
+  tokenStream.setFunctionStart(funbox);
 
   pc_->functionScope().useAsVarScope(pc_);
 
   auto stmtList = handler_.newStatementList(synthesizedBodyPos);
   if (!stmtList) {
     return null();
   }
 
@@ -7315,17 +7299,17 @@ GeneralParser<ParseHandler, Unit>::field
                                        directives, GeneratorKind::NotGenerator,
                                        FunctionAsyncKind::SyncFunction);
   if (!funbox) {
     return null();
   }
   funbox->initFieldInitializer(pc_, hasHeritage);
   handler_.setFunctionBox(funNode, funbox);
 
-  // We can't use setFunctionStartAtCurrentToken because that uses pos().begin,
+  // We can't use tokenStream.setFunctionStart, because that uses pos().begin,
   // which is incorrect for fields without initializers (pos() points to the
   // field identifier)
   uint32_t firstTokenLine, firstTokenColumn;
   tokenStream.computeLineAndColumn(firstTokenPos.begin, &firstTokenLine,
                                    &firstTokenColumn);
 
   funbox->setStart(firstTokenPos.begin, firstTokenLine, firstTokenColumn);
 
@@ -7352,17 +7336,17 @@ GeneralParser<ParseHandler, Unit>::field
     if (!initializerExpr) {
       return null();
     }
     wholeInitializerPos = firstTokenPos;
   }
 
   // Update the end position of the parse node.
   handler_.setEndPosition(funNode, wholeInitializerPos.end);
-  setFunctionEndFromCurrentToken(funbox);
+  funbox->setEnd(anyChars);
 
   // Create a ListNode for the parameters + body (there are no parameters).
   ListNodeType argsbody =
       handler_.newList(ParseNodeKind::ParamsBody, wholeInitializerPos);
   if (!argsbody) {
     return null();
   }
   handler_.setFunctionFormalParametersAndBody(funNode, argsbody);
--- a/js/src/frontend/Parser.h
+++ b/js/src/frontend/Parser.h
@@ -452,18 +452,16 @@ class MOZ_STACK_CLASS ParserBase : publi
 
   bool checkAndMarkSuperScope();
 
   bool leaveInnerFunction(ParseContext* outerpc);
 
   JSAtom* prefixAccessorName(PropertyType propType, HandleAtom propAtom);
 
   MOZ_MUST_USE bool setSourceMapInfo();
-
-  void setFunctionEndFromCurrentToken(FunctionBox* funbox) const;
 };
 
 enum FunctionCallBehavior {
   PermitAssignmentToFunctionCalls,
   ForbidAssignmentToFunctionCalls
 };
 
 template <class ParseHandler>
@@ -821,17 +819,16 @@ class MOZ_STACK_CLASS GeneralParser : pu
   using Base::newThisName;
   using Base::nextTokenContinuesLetDeclaration;
   using Base::noSubstitutionTaggedTemplate;
   using Base::noteDestructuredPositionalFormalParameter;
   using Base::noteUsedName;
   using Base::prefixAccessorName;
   using Base::processExport;
   using Base::processExportFrom;
-  using Base::setFunctionEndFromCurrentToken;
 
  private:
   inline FinalParser* asFinalParser();
   inline const FinalParser* asFinalParser() const;
 
   /*
    * A class for temporarily stashing errors while parsing continues.
    *
@@ -1053,18 +1050,16 @@ class MOZ_STACK_CLASS GeneralParser : pu
       FunctionSyntaxKind kind, GeneratorKind generatorKind,
       FunctionAsyncKind asyncKind, bool tryAnnexB,
       Directives inheritedDirectives, Directives* newDirectives);
 
   inline bool skipLazyInnerFunction(FunctionNodeType funNode,
                                     uint32_t toStringStart,
                                     FunctionSyntaxKind kind, bool tryAnnexB);
 
-  void setFunctionStartAtCurrentToken(FunctionBox* funbox) const;
-
  public:
   /* Public entry points for parsing. */
   Node statementListItem(YieldHandling yieldHandling,
                          bool canHaveDirectives = false);
 
   // Parse an inner function given an enclosing ParseContext and a
   // FunctionBox for the inner function.
   MOZ_MUST_USE FunctionNodeType innerFunctionForFunctionBox(
--- a/js/src/frontend/SharedContext.h
+++ b/js/src/frontend/SharedContext.h
@@ -7,16 +7,17 @@
 #ifndef frontend_SharedContext_h
 #define frontend_SharedContext_h
 
 #include "jspubtd.h"
 #include "jstypes.h"
 
 #include "ds/InlineTable.h"
 #include "frontend/ParseNode.h"
+#include "frontend/TokenStream.h"
 #include "vm/BytecodeUtil.h"
 #include "vm/JSFunction.h"
 #include "vm/JSScript.h"
 
 namespace js {
 namespace frontend {
 
 class ParseContext;
@@ -549,26 +550,41 @@ class FunctionBox : public ObjectBox, pu
   bool useAsmOrInsideUseAsm() const { return useAsm; }
 
   void setStart(uint32_t offset, uint32_t line, uint32_t column) {
     bufStart = offset;
     startLine = line;
     startColumn = column;
   }
 
-  void setEnd(uint32_t end) {
+  void setEnd(const TokenStreamAnyChars& anyChars) {
     // For all functions except class constructors, the buffer and
     // toString ending positions are the same. Class constructors override
     // the toString ending position with the end of the class definition.
-    bufEnd = toStringEnd = end;
+    uint32_t offset = anyChars.currentToken().pos.end;
+    bufEnd = offset;
+    toStringEnd = offset;
   }
 
   void trace(JSTracer* trc) override;
 };
 
+template <typename Unit, class AnyCharsAccess>
+inline void GeneralTokenStreamChars<Unit, AnyCharsAccess>::setFunctionStart(
+    FunctionBox* funbox) const {
+  const TokenStreamAnyChars& anyChars = anyCharsAccess();
+
+  uint32_t bufStart = anyChars.currentToken().pos.begin;
+
+  uint32_t startLine, startColumn;
+  computeLineAndColumn(bufStart, &startLine, &startColumn);
+
+  funbox->setStart(bufStart, startLine, startColumn);
+}
+
 inline FunctionBox* SharedContext::asFunctionBox() {
   MOZ_ASSERT(isFunctionBox());
   return static_cast<FunctionBox*>(this);
 }
 
 // In generators, we treat all bindings as closed so that they get stored on
 // the heap.  This way there is less information to copy off the stack when
 // suspending, and back on when resuming.  It also avoids the need to create
--- a/js/src/frontend/SyntaxParseHandler.h
+++ b/js/src/frontend/SyntaxParseHandler.h
@@ -8,17 +8,16 @@
 #define frontend_SyntaxParseHandler_h
 
 #include "mozilla/Assertions.h"
 #include "mozilla/Attributes.h"
 
 #include <string.h>
 
 #include "frontend/ParseNode.h"
-#include "frontend/TokenStream.h"
 #include "js/GCAnnotations.h"
 #include "vm/JSContext.h"
 
 namespace js {
 
 namespace frontend {
 
 // Parse handler used when processing the syntax in a block of code, to generate
deleted file mode 100644
--- a/js/src/frontend/Token.h
+++ /dev/null
@@ -1,240 +0,0 @@
-/* -*- 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/. */
-
-/*
- * Token-affiliated data structures except for TokenKind (defined in its own
- * header).
- */
-
-#ifndef frontend_Token_h
-#define frontend_Token_h
-
-#include "mozilla/Assertions.h"  // MOZ_ASSERT
-
-#include <stdint.h>  // uint32_t
-
-#include "frontend/TokenKind.h"  // js::frontend::TokenKind
-#include "js/RegExpFlags.h"      // JS::RegExpFlags
-#include "vm/StringType.h"       // js::PropertyName
-
-namespace js {
-
-namespace frontend {
-
-struct TokenPos {
-  uint32_t begin = 0;  // Offset of the token's first code unit.
-  uint32_t end = 0;    // Offset of 1 past the token's last code unit.
-
-  TokenPos() = default;
-  TokenPos(uint32_t begin, uint32_t end) : begin(begin), end(end) {}
-
-  // Return a TokenPos that covers left, right, and anything in between.
-  static TokenPos box(const TokenPos& left, const TokenPos& right) {
-    MOZ_ASSERT(left.begin <= left.end);
-    MOZ_ASSERT(left.end <= right.begin);
-    MOZ_ASSERT(right.begin <= right.end);
-    return TokenPos(left.begin, right.end);
-  }
-
-  bool operator==(const TokenPos& bpos) const {
-    return begin == bpos.begin && end == bpos.end;
-  }
-
-  bool operator!=(const TokenPos& bpos) const {
-    return begin != bpos.begin || end != bpos.end;
-  }
-
-  bool operator<(const TokenPos& bpos) const { return begin < bpos.begin; }
-
-  bool operator<=(const TokenPos& bpos) const { return begin <= bpos.begin; }
-
-  bool operator>(const TokenPos& bpos) const { return !(*this <= bpos); }
-
-  bool operator>=(const TokenPos& bpos) const { return !(*this < bpos); }
-
-  bool encloses(const TokenPos& pos) const {
-    return begin <= pos.begin && pos.end <= end;
-  }
-};
-
-enum DecimalPoint { NoDecimal = false, HasDecimal = true };
-
-enum class InvalidEscapeType {
-  // No invalid character escapes.
-  None,
-  // A malformed \x escape.
-  Hexadecimal,
-  // A malformed \u escape.
-  Unicode,
-  // An otherwise well-formed \u escape which represents a
-  // codepoint > 10FFFF.
-  UnicodeOverflow,
-  // An octal escape in a template token.
-  Octal
-};
-
-// The only escapes found in IdentifierName are of the Unicode flavor.
-enum class IdentifierEscapes { None, SawUnicodeEscape };
-
-enum class NameVisibility { Public, Private };
-
-class TokenStreamShared;
-
-struct Token {
- private:
-  // The lexical grammar of JavaScript has a quirk around the '/' character.
-  // As the spec puts it:
-  //
-  // > There are several situations where the identification of lexical input
-  // > elements is sensitive to the syntactic grammar context that is consuming
-  // > the input elements. This requires multiple goal symbols for the lexical
-  // > grammar. [...] The InputElementRegExp goal symbol is used in all
-  // > syntactic grammar contexts where a RegularExpressionLiteral is permitted
-  // > [...]  In all other contexts, InputElementDiv is used as the lexical
-  // > goal symbol.
-  //
-  // https://tc39.github.io/ecma262/#sec-lexical-and-regexp-grammars
-  //
-  // What "sensitive to the syntactic grammar context" means is, the parser has
-  // to tell the TokenStream whether to interpret '/' as division or
-  // RegExp. Because only one or the other (or neither) will be legal at that
-  // point in the program, and only the parser knows which one.
-  //
-  // But there's a problem: the parser often gets a token, puts it back, then
-  // consumes it later; or (equivalently) peeks at a token, leaves it, peeks
-  // again later, then finally consumes it. Of course we don't actually re-scan
-  // the token every time; we cache it in the TokenStream. This leads to the
-  // following rule:
-  //
-  // The parser must not pass SlashIsRegExp when getting/peeking at a token
-  // previously scanned with SlashIsDiv; or vice versa.
-  //
-  // That way, code that asks for a SlashIsRegExp mode will never get a cached
-  // Div token. But this rule is easy to screw up, because tokens are so often
-  // peeked at on Parser.cpp line A and consumed on line B, where |A-B| is
-  // thousands of lines. We therefore enforce it with the frontend's most
-  // annoying assertion (in verifyConsistentModifier), and provide
-  // Modifier::SlashIsInvalid to help avoid tripping it.
-  //
-  // This enum belongs in TokenStream, but C++, so we define it here and
-  // typedef it there.
-  enum Modifier {
-    // Parse `/` and `/=` as the division operators. (That is, use
-    // InputElementDiv as the goal symbol.)
-    SlashIsDiv,
-
-    // Parse `/` as the beginning of a RegExp literal. (That is, use
-    // InputElementRegExp.)
-    SlashIsRegExp,
-
-    // Neither a Div token nor a RegExp token is syntactically valid here. When
-    // the parser calls `getToken(SlashIsInvalid)`, it must be prepared to see
-    // either one (and throw a SyntaxError either way).
-    //
-    // It's OK to use SlashIsInvalid to get a token that was originally scanned
-    // with SlashIsDiv or SlashIsRegExp. The reverse--peeking with
-    // SlashIsInvalid, then getting with another mode--is not OK. If either Div
-    // or RegExp is syntactically valid here, use the appropriate modifier.
-    SlashIsInvalid,
-  };
-  friend class TokenStreamShared;
-
- public:
-  // WARNING: TokenStreamPosition assumes that the only GC things a Token
-  //          includes are atoms.  DON'T ADD NON-ATOM GC THING POINTERS HERE
-  //          UNLESS YOU ADD ADDITIONAL ROOTING TO THAT CLASS.
-
-  /** The type of this token. */
-  TokenKind type;
-
-  /** The token's position in the overall script. */
-  TokenPos pos;
-
-  union {
-   private:
-    friend struct Token;
-
-    /** Non-numeric atom. */
-    PropertyName* name;
-
-    /** Potentially-numeric atom. */
-    JSAtom* atom;
-
-    struct {
-      /** Numeric literal's value. */
-      double value;
-
-      /** Does the numeric literal contain a '.'? */
-      DecimalPoint decimalPoint;
-    } number;
-
-    /** Regular expression flags; use charBuffer to access source chars. */
-    JS::RegExpFlags reflags;
-  } u;
-
-#ifdef DEBUG
-  /** The modifier used to get this token. */
-  Modifier modifier;
-#endif
-
-  // Mutators
-
-  void setName(PropertyName* name) {
-    MOZ_ASSERT(type == TokenKind::Name || type == TokenKind::PrivateName);
-    u.name = name;
-  }
-
-  void setAtom(JSAtom* atom) {
-    MOZ_ASSERT(type == TokenKind::String || type == TokenKind::TemplateHead ||
-               type == TokenKind::NoSubsTemplate);
-    u.atom = atom;
-  }
-
-  void setRegExpFlags(JS::RegExpFlags flags) {
-    MOZ_ASSERT(type == TokenKind::RegExp);
-    u.reflags = flags;
-  }
-
-  void setNumber(double n, DecimalPoint decimalPoint) {
-    MOZ_ASSERT(type == TokenKind::Number);
-    u.number.value = n;
-    u.number.decimalPoint = decimalPoint;
-  }
-
-  // Type-safe accessors
-
-  PropertyName* name() const {
-    MOZ_ASSERT(type == TokenKind::Name || type == TokenKind::PrivateName);
-    return u.name->JSAtom::asPropertyName();  // poor-man's type verification
-  }
-
-  JSAtom* atom() const {
-    MOZ_ASSERT(type == TokenKind::String || type == TokenKind::TemplateHead ||
-               type == TokenKind::NoSubsTemplate);
-    return u.atom;
-  }
-
-  JS::RegExpFlags regExpFlags() const {
-    MOZ_ASSERT(type == TokenKind::RegExp);
-    return u.reflags;
-  }
-
-  double number() const {
-    MOZ_ASSERT(type == TokenKind::Number);
-    return u.number.value;
-  }
-
-  DecimalPoint decimalPoint() const {
-    MOZ_ASSERT(type == TokenKind::Number);
-    return u.number.decimalPoint;
-  }
-};
-
-}  // namespace frontend
-
-}  // namespace js
-
-#endif  // frontend_Token_h
--- a/js/src/frontend/TokenStream.h
+++ b/js/src/frontend/TokenStream.h
@@ -199,20 +199,19 @@
 #include <stdarg.h>
 #include <stddef.h>
 #include <stdint.h>
 #include <stdio.h>
 
 #include "jspubtd.h"
 
 #include "frontend/ErrorReporter.h"
-#include "frontend/Token.h"
 #include "frontend/TokenKind.h"
 #include "js/CompileOptions.h"
-#include "js/RegExpFlags.h"  // JS::RegExpFlags
+#include "js/RegExpFlags.h"  // JS::RegExpFlag, JS::RegExpFlags
 #include "js/UniquePtr.h"
 #include "js/Vector.h"
 #include "util/Text.h"
 #include "util/Unicode.h"
 #include "vm/ErrorReporting.h"
 #include "vm/JSAtom.h"
 #include "vm/StringType.h"
 
@@ -220,16 +219,227 @@ struct JSContext;
 struct KeywordInfo;
 
 namespace js {
 
 class AutoKeepAtoms;
 
 namespace frontend {
 
+class FunctionBox;
+
+struct TokenPos {
+  uint32_t begin;  // Offset of the token's first code unit.
+  uint32_t end;    // Offset of 1 past the token's last code unit.
+
+  TokenPos() : begin(0), end(0) {}
+  TokenPos(uint32_t begin, uint32_t end) : begin(begin), end(end) {}
+
+  // Return a TokenPos that covers left, right, and anything in between.
+  static TokenPos box(const TokenPos& left, const TokenPos& right) {
+    MOZ_ASSERT(left.begin <= left.end);
+    MOZ_ASSERT(left.end <= right.begin);
+    MOZ_ASSERT(right.begin <= right.end);
+    return TokenPos(left.begin, right.end);
+  }
+
+  bool operator==(const TokenPos& bpos) const {
+    return begin == bpos.begin && end == bpos.end;
+  }
+
+  bool operator!=(const TokenPos& bpos) const {
+    return begin != bpos.begin || end != bpos.end;
+  }
+
+  bool operator<(const TokenPos& bpos) const { return begin < bpos.begin; }
+
+  bool operator<=(const TokenPos& bpos) const { return begin <= bpos.begin; }
+
+  bool operator>(const TokenPos& bpos) const { return !(*this <= bpos); }
+
+  bool operator>=(const TokenPos& bpos) const { return !(*this < bpos); }
+
+  bool encloses(const TokenPos& pos) const {
+    return begin <= pos.begin && pos.end <= end;
+  }
+};
+
+enum DecimalPoint { NoDecimal = false, HasDecimal = true };
+
+enum class InvalidEscapeType {
+  // No invalid character escapes.
+  None,
+  // A malformed \x escape.
+  Hexadecimal,
+  // A malformed \u escape.
+  Unicode,
+  // An otherwise well-formed \u escape which represents a
+  // codepoint > 10FFFF.
+  UnicodeOverflow,
+  // An octal escape in a template token.
+  Octal
+};
+
+// The only escapes found in IdentifierName are of the Unicode flavor.
+enum class IdentifierEscapes { None, SawUnicodeEscape };
+
+enum class NameVisibility { Public, Private };
+
+class TokenStreamShared;
+
+struct Token {
+ private:
+  // The lexical grammar of JavaScript has a quirk around the '/' character.
+  // As the spec puts it:
+  //
+  // > There are several situations where the identification of lexical input
+  // > elements is sensitive to the syntactic grammar context that is consuming
+  // > the input elements. This requires multiple goal symbols for the lexical
+  // > grammar. [...] The InputElementRegExp goal symbol is used in all
+  // > syntactic grammar contexts where a RegularExpressionLiteral is permitted
+  // > [...]  In all other contexts, InputElementDiv is used as the lexical
+  // > goal symbol.
+  //
+  // https://tc39.github.io/ecma262/#sec-lexical-and-regexp-grammars
+  //
+  // What "sensitive to the syntactic grammar context" means is, the parser has
+  // to tell the TokenStream whether to interpret '/' as division or
+  // RegExp. Because only one or the other (or neither) will be legal at that
+  // point in the program, and only the parser knows which one.
+  //
+  // But there's a problem: the parser often gets a token, puts it back, then
+  // consumes it later; or (equivalently) peeks at a token, leaves it, peeks
+  // again later, then finally consumes it. Of course we don't actually re-scan
+  // the token every time; we cache it in the TokenStream. This leads to the
+  // following rule:
+  //
+  // The parser must not pass SlashIsRegExp when getting/peeking at a token
+  // previously scanned with SlashIsDiv; or vice versa.
+  //
+  // That way, code that asks for a SlashIsRegExp mode will never get a cached
+  // Div token. But this rule is easy to screw up, because tokens are so often
+  // peeked at on Parser.cpp line A and consumed on line B, where |A-B| is
+  // thousands of lines. We therefore enforce it with the frontend's most
+  // annoying assertion (in verifyConsistentModifier), and provide
+  // Modifier::SlashIsInvalid to help avoid tripping it.
+  //
+  // This enum belongs in TokenStream, but C++, so we define it here and
+  // typedef it there.
+  enum Modifier {
+    // Parse `/` and `/=` as the division operators. (That is, use
+    // InputElementDiv as the goal symbol.)
+    SlashIsDiv,
+
+    // Parse `/` as the beginning of a RegExp literal. (That is, use
+    // InputElementRegExp.)
+    SlashIsRegExp,
+
+    // Neither a Div token nor a RegExp token is syntactically valid here. When
+    // the parser calls `getToken(SlashIsInvalid)`, it must be prepared to see
+    // either one (and throw a SyntaxError either way).
+    //
+    // It's OK to use SlashIsInvalid to get a token that was originally scanned
+    // with SlashIsDiv or SlashIsRegExp. The reverse--peeking with
+    // SlashIsInvalid, then getting with another mode--is not OK. If either Div
+    // or RegExp is syntactically valid here, use the appropriate modifier.
+    SlashIsInvalid,
+  };
+  friend class TokenStreamShared;
+
+ public:
+  // WARNING: TokenStreamPosition assumes that the only GC things a Token
+  //          includes are atoms.  DON'T ADD NON-ATOM GC THING POINTERS HERE
+  //          UNLESS YOU ADD ADDITIONAL ROOTING TO THAT CLASS.
+
+  /** The type of this token. */
+  TokenKind type;
+
+  /** The token's position in the overall script. */
+  TokenPos pos;
+
+  union {
+   private:
+    friend struct Token;
+
+    /** Non-numeric atom. */
+    PropertyName* name;
+
+    /** Potentially-numeric atom. */
+    JSAtom* atom;
+
+    struct {
+      /** Numeric literal's value. */
+      double value;
+
+      /** Does the numeric literal contain a '.'? */
+      DecimalPoint decimalPoint;
+    } number;
+
+    /** Regular expression flags; use charBuffer to access source chars. */
+    JS::RegExpFlags reflags;
+  } u;
+
+#ifdef DEBUG
+  /** The modifier used to get this token. */
+  Modifier modifier;
+#endif
+
+  // Mutators
+
+  void setName(PropertyName* name) {
+    MOZ_ASSERT(type == TokenKind::Name || type == TokenKind::PrivateName);
+    u.name = name;
+  }
+
+  void setAtom(JSAtom* atom) {
+    MOZ_ASSERT(type == TokenKind::String || type == TokenKind::TemplateHead ||
+               type == TokenKind::NoSubsTemplate);
+    u.atom = atom;
+  }
+
+  void setRegExpFlags(JS::RegExpFlags flags) {
+    MOZ_ASSERT(type == TokenKind::RegExp);
+    u.reflags = flags;
+  }
+
+  void setNumber(double n, DecimalPoint decimalPoint) {
+    MOZ_ASSERT(type == TokenKind::Number);
+    u.number.value = n;
+    u.number.decimalPoint = decimalPoint;
+  }
+
+  // Type-safe accessors
+
+  PropertyName* name() const {
+    MOZ_ASSERT(type == TokenKind::Name || type == TokenKind::PrivateName);
+    return u.name->JSAtom::asPropertyName();  // poor-man's type verification
+  }
+
+  JSAtom* atom() const {
+    MOZ_ASSERT(type == TokenKind::String || type == TokenKind::TemplateHead ||
+               type == TokenKind::NoSubsTemplate);
+    return u.atom;
+  }
+
+  JS::RegExpFlags regExpFlags() const {
+    MOZ_ASSERT(type == TokenKind::RegExp);
+    return u.reflags;
+  }
+
+  double number() const {
+    MOZ_ASSERT(type == TokenKind::Number);
+    return u.number.value;
+  }
+
+  DecimalPoint decimalPoint() const {
+    MOZ_ASSERT(type == TokenKind::Number);
+    return u.number.decimalPoint;
+  }
+};
+
 extern TokenKind ReservedWordTokenKind(PropertyName* str);
 
 extern const char* ReservedWordToCharZ(PropertyName* str);
 
 extern const char* ReservedWordToCharZ(TokenKind tt);
 
 struct TokenStreamFlags {
   bool isEOF : 1;           // Hit end of file.
@@ -1879,16 +2089,18 @@ class GeneralTokenStreamChars : public S
     // separators don't need special handling.
     // https://tc39.github.io/ecma262/#sec-static-semantics-tv-and-trv
     if (!fillCharBufferFromSourceNormalizingAsciiLineBreaks(cur, end)) {
       return nullptr;
     }
 
     return drainCharBufferIntoAtom(anyChars.cx);
   }
+
+  inline void setFunctionStart(FunctionBox* funbox) const;
 };
 
 template <typename Unit, class AnyCharsAccess>
 class TokenStreamChars;
 
 template <class AnyCharsAccess>
 class TokenStreamChars<char16_t, AnyCharsAccess>
     : public GeneralTokenStreamChars<char16_t, AnyCharsAccess> {
--- a/js/src/gc/Barrier.cpp
+++ b/js/src/gc/Barrier.cpp
@@ -6,17 +6,16 @@
 
 #include "gc/Barrier.h"
 
 #include "builtin/TypedObject.h"
 #include "gc/Policy.h"
 #include "gc/Zone.h"
 #include "js/HashTable.h"
 #include "js/Value.h"
-#include "vm/BigIntType.h"  // JS::BigInt
 #include "vm/EnvironmentObject.h"
 #include "vm/JSObject.h"
 #include "vm/Realm.h"
 #include "vm/SharedArrayObject.h"
 #include "vm/SymbolType.h"
 #include "wasm/WasmJS.h"
 
 #include "gc/Zone-inl.h"
--- a/js/src/jit/mips32/MacroAssembler-mips32-inl.h
+++ b/js/src/jit/mips32/MacroAssembler-mips32-inl.h
@@ -4,18 +4,16 @@
  * 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 jit_mips32_MacroAssembler_mips32_inl_h
 #define jit_mips32_MacroAssembler_mips32_inl_h
 
 #include "jit/mips32/MacroAssembler-mips32.h"
 
-#include "vm/BigIntType.h"  // JS::BigInt
-
 #include "jit/mips-shared/MacroAssembler-mips-shared-inl.h"
 
 namespace js {
 namespace jit {
 
 //{{{ check_macroassembler_style
 
 void MacroAssembler::move64(Register64 src, Register64 dest) {
--- a/js/src/jit/mips64/MacroAssembler-mips64-inl.h
+++ b/js/src/jit/mips64/MacroAssembler-mips64-inl.h
@@ -4,18 +4,16 @@
  * 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 jit_mips64_MacroAssembler_mips64_inl_h
 #define jit_mips64_MacroAssembler_mips64_inl_h
 
 #include "jit/mips64/MacroAssembler-mips64.h"
 
-#include "vm/BigIntType.h"  // JS::BigInt
-
 #include "jit/mips-shared/MacroAssembler-mips-shared-inl.h"
 
 namespace js {
 namespace jit {
 
 //{{{ check_macroassembler_style
 
 void MacroAssembler::move64(Register64 src, Register64 dest) {
--- a/js/src/jit/x64/MacroAssembler-x64.h
+++ b/js/src/jit/x64/MacroAssembler-x64.h
@@ -6,17 +6,16 @@
 
 #ifndef jit_x64_MacroAssembler_x64_h
 #define jit_x64_MacroAssembler_x64_h
 
 #include "jit/JitFrames.h"
 #include "jit/MoveResolver.h"
 #include "jit/x86-shared/MacroAssembler-x86-shared.h"
 #include "js/HeapAPI.h"
-#include "vm/BigIntType.h"  // JS::BigInt
 
 namespace js {
 namespace jit {
 
 struct ImmShiftedTag : public ImmWord {
   explicit ImmShiftedTag(JSValueShiftedTag shtag) : ImmWord((uintptr_t)shtag) {}
 
   explicit ImmShiftedTag(JSValueType type)
--- a/js/src/jit/x86/MacroAssembler-x86.h
+++ b/js/src/jit/x86/MacroAssembler-x86.h
@@ -6,17 +6,16 @@
 
 #ifndef jit_x86_MacroAssembler_x86_h
 #define jit_x86_MacroAssembler_x86_h
 
 #include "jit/JitFrames.h"
 #include "jit/MoveResolver.h"
 #include "jit/x86-shared/MacroAssembler-x86-shared.h"
 #include "js/HeapAPI.h"
-#include "vm/BigIntType.h"  // JS::BigInt
 #include "vm/Realm.h"
 
 namespace js {
 namespace jit {
 
 // See documentation for ScratchTagScope and ScratchTagScopeRelease in
 // MacroAssembler-x64.h.
 
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -123,17 +123,16 @@
 #include "vm/Compression.h"
 #include "vm/Debugger.h"
 #include "vm/HelperThreads.h"
 #include "vm/JSAtom.h"
 #include "vm/JSContext.h"
 #include "vm/JSFunction.h"
 #include "vm/JSObject.h"
 #include "vm/JSScript.h"
-#include "vm/ModuleBuilder.h"  // js::ModuleBuilder
 #include "vm/Monitor.h"
 #include "vm/MutexIDs.h"
 #include "vm/Printer.h"
 #include "vm/Shape.h"
 #include "vm/SharedArrayObject.h"
 #include "vm/Time.h"
 #include "vm/TypedArrayObject.h"
 #include "vm/WrapperObject.h"
deleted file mode 100644
--- a/js/src/vm/ModuleBuilder.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* -*- 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 vm_ModuleBuilder_h
-#define vm_ModuleBuilder_h
-
-#include "mozilla/Attributes.h"  // MOZ_STACK_CLASS
-
-#include "builtin/ModuleObject.h"  // js::{{Im,Ex}portEntry,Requested{Module,}}Object
-#include "frontend/EitherParser.h"  // js::frontend::EitherParser
-#include "js/GCHashTable.h"         // JS::GCHash{Map,Set}
-#include "js/GCVector.h"            // JS::GCVector
-#include "js/RootingAPI.h"          // JS::{Handle,Rooted}
-#include "vm/AtomsTable.h"          // js::AtomSet
-
-struct JSContext;
-class JSAtom;
-
-namespace js {
-
-namespace frontend {
-
-class BinaryNode;
-class ListNode;
-class ParseNode;
-
-}  // namespace frontend
-
-// Process a module's parse tree to collate the import and export data used when
-// creating a ModuleObject.
-class MOZ_STACK_CLASS ModuleBuilder {
-  explicit ModuleBuilder(JSContext* cx, JS::Handle<ModuleObject*> module,
-                         const frontend::EitherParser& eitherParser);
-
- public:
-  template <class Parser>
-  explicit ModuleBuilder(JSContext* cx, JS::Handle<ModuleObject*> module,
-                         Parser* parser)
-      : ModuleBuilder(cx, module, frontend::EitherParser(parser)) {}
-
-  bool processImport(frontend::BinaryNode* importNode);
-  bool processExport(frontend::ParseNode* exportNode);
-  bool processExportFrom(frontend::BinaryNode* exportNode);
-
-  bool hasExportedName(JSAtom* name) const;
-
-  using ExportEntryVector = GCVector<ExportEntryObject*>;
-  const ExportEntryVector& localExportEntries() const {
-    return localExportEntries_;
-  }
-
-  bool buildTables();
-  bool initModule();
-
- private:
-  using RequestedModuleVector = JS::GCVector<RequestedModuleObject*>;
-  using AtomSet = JS::GCHashSet<JSAtom*>;
-  using ImportEntryMap = JS::GCHashMap<JSAtom*, ImportEntryObject*>;
-  using RootedExportEntryVector = JS::Rooted<ExportEntryVector>;
-  using RootedRequestedModuleVector = JS::Rooted<RequestedModuleVector>;
-  using RootedAtomSet = JS::Rooted<AtomSet>;
-  using RootedImportEntryMap = JS::Rooted<ImportEntryMap>;
-
-  JSContext* cx_;
-  JS::Rooted<ModuleObject*> module_;
-  frontend::EitherParser eitherParser_;
-  RootedAtomSet requestedModuleSpecifiers_;
-  RootedRequestedModuleVector requestedModules_;
-  RootedImportEntryMap importEntries_;
-  RootedExportEntryVector exportEntries_;
-  RootedAtomSet exportNames_;
-  RootedExportEntryVector localExportEntries_;
-  RootedExportEntryVector indirectExportEntries_;
-  RootedExportEntryVector starExportEntries_;
-
-  ImportEntryObject* importEntryFor(JSAtom* localName) const;
-
-  bool processExportBinding(frontend::ParseNode* pn);
-  bool processExportArrayBinding(frontend::ListNode* array);
-  bool processExportObjectBinding(frontend::ListNode* obj);
-
-  bool appendImportEntryObject(JS::Handle<ImportEntryObject*> importEntry);
-
-  bool appendExportEntry(JS::Handle<JSAtom*> exportName,
-                         JS::Handle<JSAtom*> localName,
-                         frontend::ParseNode* node = nullptr);
-
-  bool appendExportFromEntry(JS::Handle<JSAtom*> exportName,
-                             JS::Handle<JSAtom*> moduleRequest,
-                             JS::Handle<JSAtom*> importName,
-                             frontend::ParseNode* node);
-
-  bool appendExportEntryObject(JS::Handle<ExportEntryObject*> exportEntry);
-
-  bool maybeAppendRequestedModule(JS::Handle<JSAtom*> specifier,
-                                  frontend::ParseNode* node);
-
-  template <typename T>
-  ArrayObject* createArray(const JS::Rooted<JS::GCVector<T>>& vector);
-  template <typename K, typename V>
-  ArrayObject* createArray(const JS::Rooted<JS::GCHashMap<K, V>>& map);
-};
-
-}  // namespace js
-
-#endif  // vm_ModuleBuilder_h
--- a/js/src/vm/SelfHosting.cpp
+++ b/js/src/vm/SelfHosting.cpp
@@ -31,17 +31,16 @@
 #include "builtin/ModuleObject.h"
 #include "builtin/Object.h"
 #include "builtin/Promise.h"
 #include "builtin/Reflect.h"
 #include "builtin/RegExp.h"
 #include "builtin/SelfHostingDefines.h"
 #include "builtin/TypedObject.h"
 #include "builtin/WeakMapObject.h"
-#include "frontend/BytecodeCompiler.h"  // js::frontend::CreateScriptSourceObject
 #include "gc/Marking.h"
 #include "gc/Policy.h"
 #include "jit/AtomicOperations.h"
 #include "jit/InlinableNatives.h"
 #include "js/CharacterEncoding.h"
 #include "js/CompilationAndEvaluation.h"
 #include "js/Date.h"
 #include "js/PropertySpec.h"