Bug 1545540 - Part 0: Add comments for include in some frontend files. r=jorendorff
authorTooru Fujisawa <arai_a@mac.com>
Thu, 30 May 2019 20:23:41 +0000
changeset 476266 9a79b6375011c23bac85cbbb08109be48203e609
parent 476265 57861a1ded5abaf82a1b4e7c95a0bd1bf60f62a0
child 476267 735ff13f705c6198128e242741e7b58c4f917532
push id36090
push usernbeleuzu@mozilla.com
push dateFri, 31 May 2019 03:59:09 +0000
treeherdermozilla-central@63568b2a8178 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1545540
milestone69.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 1545540 - Part 0: Add comments for include in some frontend files. r=jorendorff Differential Revision: https://phabricator.services.mozilla.com/D32399
js/src/frontend/BytecodeControlStructures.cpp
js/src/frontend/BytecodeControlStructures.h
js/src/frontend/BytecodeEmitter.cpp
js/src/frontend/BytecodeEmitter.h
js/src/frontend/BytecodeSection.h
js/src/frontend/CForEmitter.cpp
js/src/frontend/CForEmitter.h
js/src/frontend/ForOfLoopControl.cpp
js/src/frontend/ForOfLoopControl.h
js/src/frontend/JumpList.cpp
js/src/frontend/JumpList.h
js/src/frontend/LabelEmitter.cpp
js/src/frontend/LabelEmitter.h
js/src/frontend/SwitchEmitter.cpp
js/src/frontend/SwitchEmitter.h
js/src/frontend/TryEmitter.cpp
js/src/frontend/TryEmitter.h
--- a/js/src/frontend/BytecodeControlStructures.cpp
+++ b/js/src/frontend/BytecodeControlStructures.cpp
@@ -1,19 +1,20 @@
 /* -*- 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/BytecodeControlStructures.h"
 
-#include "frontend/BytecodeEmitter.h"
-#include "frontend/EmitterScope.h"
-#include "vm/Opcodes.h"
+#include "frontend/BytecodeEmitter.h"  // BytecodeEmitter
+#include "frontend/EmitterScope.h"     // EmitterScope
+#include "frontend/SourceNotes.h"      // SRC_*
+#include "vm/Opcodes.h"                // JSOP_*
 
 using namespace js;
 using namespace js::frontend;
 
 using mozilla::Maybe;
 
 NestableControl::NestableControl(BytecodeEmitter* bce, StatementKind kind)
     : Nestable<NestableControl>(&bce->innermostNestableControl),
--- a/js/src/frontend/BytecodeControlStructures.h
+++ b/js/src/frontend/BytecodeControlStructures.h
@@ -2,28 +2,29 @@
  * 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_BytecodeControlStructures_h
 #define frontend_BytecodeControlStructures_h
 
-#include "mozilla/Attributes.h"
-#include "mozilla/Maybe.h"
+#include "mozilla/Assertions.h"  // MOZ_ASSERT
+#include "mozilla/Attributes.h"  // MOZ_MUST_USE
+#include "mozilla/Maybe.h"       // mozilla::Maybe
 
-#include <stddef.h>
-#include <stdint.h>
+#include <stddef.h>  // ptrdiff_t
+#include <stdint.h>  // int32_t, uint32_t
 
-#include "ds/Nestable.h"
-#include "frontend/JumpList.h"
-#include "frontend/SharedContext.h"
-#include "frontend/TDZCheckCache.h"
-#include "gc/Rooting.h"
-#include "vm/BytecodeUtil.h"
+#include "ds/Nestable.h"        // Nestable
+#include "frontend/JumpList.h"  // JumpList, JumpTarget
+#include "frontend/SharedContext.h"  // StatementKind, StatementKindIsLoop, StatementKindIsUnlabeledBreakTarget
+#include "frontend/TDZCheckCache.h"  // TDZCheckCache
+#include "gc/Rooting.h"              // RootedAtom, HandleAtom
+#include "vm/StringType.h"           // JSAtom
 
 namespace js {
 namespace frontend {
 
 struct BytecodeEmitter;
 class EmitterScope;
 
 class NestableControl : public Nestable<NestableControl> {
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -5,69 +5,71 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * JS bytecode generation.
  */
 
 #include "frontend/BytecodeEmitter.h"
 
-#include "mozilla/ArrayUtils.h"
-#include "mozilla/DebugOnly.h"
-#include "mozilla/FloatingPoint.h"
-#include "mozilla/Maybe.h"
-#include "mozilla/PodOperations.h"
-#include "mozilla/Sprintf.h"
-#include "mozilla/Variant.h"
+#include "mozilla/Casting.h"    // mozilla::AssertedCast
+#include "mozilla/DebugOnly.h"  // mozilla::DebugOnly
+#include "mozilla/FloatingPoint.h"  // mozilla::NumberEqualsInt32, mozilla::NumberIsInt32
+#include "mozilla/Maybe.h"          // mozilla::{Maybe,Nothing,Some}
+#include "mozilla/PodOperations.h"  // mozilla::PodCopy
+#include "mozilla/Sprintf.h"        // SprintfLiteral
+#include "mozilla/Unused.h"         // mozilla::Unused
+#include "mozilla/Variant.h"        // mozilla::AsVariant
 
 #include <string.h>
 
-#include "jsnum.h"
-#include "jstypes.h"
-#include "jsutil.h"
-
-#include "ds/Nestable.h"
-#include "frontend/BytecodeControlStructures.h"
-#include "frontend/CallOrNewEmitter.h"
-#include "frontend/CForEmitter.h"
-#include "frontend/DefaultEmitter.h"  // DefaultEmitter
-#include "frontend/DoWhileEmitter.h"
-#include "frontend/ElemOpEmitter.h"
-#include "frontend/EmitterScope.h"
-#include "frontend/ExpressionStatementEmitter.h"
-#include "frontend/ForInEmitter.h"
-#include "frontend/ForOfEmitter.h"
-#include "frontend/ForOfLoopControl.h"
+#include "jsnum.h"    // NumberToAtom
+#include "jstypes.h"  // JS_BIT
+#include "jsutil.h"   // Min
+
+#include "ds/Nestable.h"                         // Nestable
+#include "frontend/BytecodeControlStructures.h"  // NestableControl, BreakableControl, LabelControl, LoopControl, TryFinallyControl
+#include "frontend/CallOrNewEmitter.h"           // CallOrNewEmitter
+#include "frontend/CForEmitter.h"                // CForEmitter
+#include "frontend/DefaultEmitter.h"             // DefaultEmitter
+#include "frontend/DoWhileEmitter.h"             // DoWhileEmitter
+#include "frontend/ElemOpEmitter.h"              // ElemOpEmitter
+#include "frontend/EmitterScope.h"               // EmitterScope
+#include "frontend/ExpressionStatementEmitter.h"  // ExpressionStatementEmitter
+#include "frontend/ForInEmitter.h"                // ForInEmitter
+#include "frontend/ForOfEmitter.h"                // ForOfEmitter
+#include "frontend/ForOfLoopControl.h"            // ForOfLoopControl
 #include "frontend/FunctionEmitter.h"  // FunctionEmitter, FunctionScriptEmitter, FunctionParamsEmitter
-#include "frontend/IfEmitter.h"
-#include "frontend/LabelEmitter.h"         // LabelEmitter
+#include "frontend/IfEmitter.h"     // IfEmitter, InternalIfEmitter, CondEmitter
+#include "frontend/LabelEmitter.h"  // LabelEmitter
 #include "frontend/LexicalScopeEmitter.h"  // LexicalScopeEmitter
-#include "frontend/ModuleSharedContext.h"
-#include "frontend/NameOpEmitter.h"
+#include "frontend/ModuleSharedContext.h"  // ModuleSharedContext
+#include "frontend/NameFunctions.h"        // NameFunctions
+#include "frontend/NameOpEmitter.h"        // NameOpEmitter
 #include "frontend/ObjectEmitter.h"  // PropertyEmitter, ObjectEmitter, ClassEmitter
-#include "frontend/ParseNode.h"
-#include "frontend/Parser.h"
-#include "frontend/PropOpEmitter.h"
-#include "frontend/SwitchEmitter.h"
-#include "frontend/TDZCheckCache.h"
-#include "frontend/TryEmitter.h"
-#include "frontend/WhileEmitter.h"
-#include "js/CompileOptions.h"
-#include "vm/AsyncFunction.h"
-#include "vm/BytecodeUtil.h"
-#include "vm/Debugger.h"
-#include "vm/GeneratorObject.h"
-#include "vm/JSAtom.h"
-#include "vm/JSContext.h"
-#include "vm/JSFunction.h"
-#include "vm/JSScript.h"
-#include "vm/Stack.h"
-#include "wasm/AsmJS.h"
-
-#include "vm/JSObject-inl.h"
+#include "frontend/ParseNode.h"  // ParseNodeKind, ParseNode and subclasses, ObjectBox
+#include "frontend/Parser.h"         // Parser
+#include "frontend/PropOpEmitter.h"  // PropOpEmitter
+#include "frontend/SwitchEmitter.h"  // SwitchEmitter
+#include "frontend/TDZCheckCache.h"  // TDZCheckCache
+#include "frontend/TryEmitter.h"     // TryEmitter
+#include "frontend/WhileEmitter.h"   // WhileEmitter
+#include "js/CompileOptions.h"       // TransitiveCompileOptions, CompileOptions
+#include "vm/AsyncFunction.h"        // AsyncFunctionResolveKind
+#include "vm/BytecodeUtil.h"  // IsArgOp, IsLocalOp, SET_UINT24, SET_ICINDEX, BytecodeFallsThrough, BytecodeIsJumpTarget
+#include "vm/Debugger.h"      // Debugger
+#include "vm/GeneratorObject.h"  // AbstractGeneratorObject
+#include "vm/JSAtom.h"           // JSAtom, js_*_str
+#include "vm/JSContext.h"        // JSContext
+#include "vm/JSFunction.h"       // FunctionPrefixKind, JSFunction,
+#include "vm/JSScript.h"  // JSScript, ScopeNote, ScriptSourceObject, FieldInitializers, JSScript, LazyScript
+#include "vm/Opcodes.h"   // JSOP_*
+#include "wasm/AsmJS.h"   // IsAsmJSModule
+
+#include "vm/JSObject-inl.h"  // JSObject
 
 using namespace js;
 using namespace js::frontend;
 
 using mozilla::AssertedCast;
 using mozilla::AsVariant;
 using mozilla::DebugOnly;
 using mozilla::Maybe;
--- a/js/src/frontend/BytecodeEmitter.h
+++ b/js/src/frontend/BytecodeEmitter.h
@@ -4,33 +4,52 @@
  * 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/. */
 
 /* JS bytecode generation. */
 
 #ifndef frontend_BytecodeEmitter_h
 #define frontend_BytecodeEmitter_h
 
-#include "mozilla/Attributes.h"
-#include "mozilla/Span.h"
+#include "mozilla/Assertions.h"  // MOZ_ASSERT
+#include "mozilla/Attributes.h"  // MOZ_STACK_CLASS, MOZ_MUST_USE, MOZ_ALWAYS_INLINE, MOZ_NEVER_INLINE, MOZ_RAII
+#include "mozilla/Maybe.h"  // mozilla::Maybe, mozilla::Some
+#include "mozilla/Span.h"   // mozilla::Span
+
+#include <stddef.h>  // ptrdiff_t
+#include <stdint.h>  // uint16_t, uint32_t
+
+#include "jsapi.h"  // CompletionKind
 
-#include "ds/InlineTable.h"
-#include "frontend/BCEParserHandle.h"
-#include "frontend/BytecodeSection.h"  // BytecodeSection, PerScriptData
-#include "frontend/DestructuringFlavor.h"
-#include "frontend/EitherParser.h"
-#include "frontend/JumpList.h"
-#include "frontend/NameFunctions.h"
-#include "frontend/ParseNode.h"
-#include "frontend/SharedContext.h"
-#include "frontend/SourceNotes.h"
-#include "frontend/ValueUsage.h"
-#include "vm/BytecodeUtil.h"
-#include "vm/Interpreter.h"
-#include "vm/Iteration.h"
+#include "frontend/BCEParserHandle.h"            // BCEParserHandle
+#include "frontend/BytecodeControlStructures.h"  // NestableControl
+#include "frontend/BytecodeSection.h"  // BytecodeSection, PerScriptData, CGScopeList
+#include "frontend/DestructuringFlavor.h"  // DestructuringFlavor
+#include "frontend/EitherParser.h"         // EitherParser
+#include "frontend/ErrorReporter.h"        // ErrorReporter
+#include "frontend/FullParseHandler.h"     // FullParseHandler
+#include "frontend/JumpList.h"             // JumpList, JumpTarget
+#include "frontend/NameAnalysisTypes.h"    // NameLocation
+#include "frontend/NameCollections.h"      // AtomIndexMap
+#include "frontend/ParseNode.h"      // ParseNode and subclasses, ObjectBox
+#include "frontend/Parser.h"         // Parser, PropListType
+#include "frontend/SharedContext.h"  // SharedContext
+#include "frontend/SourceNotes.h"    // SrcNoteType
+#include "frontend/TokenStream.h"    // TokenPos
+#include "frontend/ValueUsage.h"     // ValueUsage
+#include "js/RootingAPI.h"           // JS::Rooted, JS::Handle
+#include "js/TypeDecls.h"            // jsbytecode
+#include "vm/BigIntType.h"           // BigInt
+#include "vm/BytecodeUtil.h"         // JSOp
+#include "vm/Interpreter.h"          // CheckIsObjectKind, CheckIsCallableKind
+#include "vm/Iteration.h"            // IteratorKind
+#include "vm/JSFunction.h"           // JSFunction, FunctionPrefixKind
+#include "vm/JSScript.h"  // JSScript, LazyScript, FieldInitializers, JSTryNoteKind
+#include "vm/Runtime.h"     // ReportOutOfMemory
+#include "vm/StringType.h"  // JSAtom
 
 namespace js {
 namespace frontend {
 
 class CallOrNewEmitter;
 class ElemOpEmitter;
 class EmitterScope;
 class NestableControl;
@@ -43,20 +62,20 @@ struct MOZ_STACK_CLASS BytecodeEmitter {
   SharedContext* const sc = nullptr;
 
   JSContext* const cx = nullptr;
 
   // Enclosing function or global context.
   BytecodeEmitter* const parent = nullptr;
 
   // The JSScript we're ultimately producing.
-  Rooted<JSScript*> script;
+  JS::Rooted<JSScript*> script;
 
   // The lazy script if mode is LazyFunction, nullptr otherwise.
-  Rooted<LazyScript*> lazyScript;
+  JS::Rooted<LazyScript*> lazyScript;
 
  private:
   BytecodeSection bytecodeSection_;
 
  public:
   BytecodeSection& bytecodeSection() { return bytecodeSection_; }
   const BytecodeSection& bytecodeSection() const { return bytecodeSection_; }
 
@@ -143,82 +162,85 @@ struct MOZ_STACK_CLASS BytecodeEmitter {
    * Note that BytecodeEmitters are magic: they own the arena "top-of-stack"
    * space above their tempMark points. This means that you cannot alloc from
    * tempLifoAlloc and save the pointer beyond the next BytecodeEmitter
    * destruction.
    */
  private:
   // Internal constructor, for delegation use only.
   BytecodeEmitter(
-      BytecodeEmitter* parent, SharedContext* sc, HandleScript script,
-      Handle<LazyScript*> lazyScript, uint32_t lineNum, EmitterMode emitterMode,
+      BytecodeEmitter* parent, SharedContext* sc, JS::Handle<JSScript*> script,
+      JS::Handle<LazyScript*> lazyScript, uint32_t lineNum,
+      EmitterMode emitterMode,
       FieldInitializers fieldInitializers = FieldInitializers::Invalid());
 
   void initFromBodyPosition(TokenPos bodyPosition);
 
   /*
    * Helper for reporting that we have insufficient args.  pluralizer
    * should be "s" if requiredArgs is anything other than "1" and ""
    * if requiredArgs is "1".
    */
   void reportNeedMoreArgsError(ParseNode* pn, const char* errorName,
                                const char* requiredArgs, const char* pluralizer,
                                const ListNode* argsList);
 
  public:
   BytecodeEmitter(
       BytecodeEmitter* parent, BCEParserHandle* parser, SharedContext* sc,
-      HandleScript script, Handle<LazyScript*> lazyScript, uint32_t lineNum,
-      EmitterMode emitterMode = Normal,
+      JS::Handle<JSScript*> script, JS::Handle<LazyScript*> lazyScript,
+      uint32_t lineNum, EmitterMode emitterMode = Normal,
       FieldInitializers fieldInitializers = FieldInitializers::Invalid());
 
   BytecodeEmitter(
       BytecodeEmitter* parent, const EitherParser& parser, SharedContext* sc,
-      HandleScript script, Handle<LazyScript*> lazyScript, uint32_t lineNum,
-      EmitterMode emitterMode = Normal,
+      JS::Handle<JSScript*> script, JS::Handle<LazyScript*> lazyScript,
+      uint32_t lineNum, EmitterMode emitterMode = Normal,
       FieldInitializers fieldInitializers = FieldInitializers::Invalid());
 
   template <typename Unit>
   BytecodeEmitter(
       BytecodeEmitter* parent, Parser<FullParseHandler, Unit>* parser,
-      SharedContext* sc, HandleScript script, Handle<LazyScript*> lazyScript,
-      uint32_t lineNum, EmitterMode emitterMode = Normal,
+      SharedContext* sc, JS::Handle<JSScript*> script,
+      JS::Handle<LazyScript*> lazyScript, uint32_t lineNum,
+      EmitterMode emitterMode = Normal,
       FieldInitializers fieldInitializers = FieldInitializers::Invalid())
       : BytecodeEmitter(parent, EitherParser(parser), sc, script, lazyScript,
                         lineNum, emitterMode, fieldInitializers) {}
 
   // An alternate constructor that uses a TokenPos for the starting
   // line and that sets functionBodyEndPos as well.
   BytecodeEmitter(
       BytecodeEmitter* parent, BCEParserHandle* parser, SharedContext* sc,
-      HandleScript script, Handle<LazyScript*> lazyScript,
+      JS::Handle<JSScript*> script, JS::Handle<LazyScript*> lazyScript,
       TokenPos bodyPosition, EmitterMode emitterMode = Normal,
       FieldInitializers fieldInitializers = FieldInitializers::Invalid())
       : BytecodeEmitter(parent, parser, sc, script, lazyScript,
                         parser->errorReporter().lineAt(bodyPosition.begin),
                         emitterMode, fieldInitializers) {
     initFromBodyPosition(bodyPosition);
   }
 
   BytecodeEmitter(
       BytecodeEmitter* parent, const EitherParser& parser, SharedContext* sc,
-      HandleScript script, Handle<LazyScript*> lazyScript,
+      JS::Handle<JSScript*> script, JS::Handle<LazyScript*> lazyScript,
       TokenPos bodyPosition, EmitterMode emitterMode = Normal,
       FieldInitializers fieldInitializers = FieldInitializers::Invalid())
       : BytecodeEmitter(parent, parser, sc, script, lazyScript,
                         parser.errorReporter().lineAt(bodyPosition.begin),
                         emitterMode, fieldInitializers) {
     initFromBodyPosition(bodyPosition);
   }
 
   template <typename Unit>
   BytecodeEmitter(
       BytecodeEmitter* parent, Parser<FullParseHandler, Unit>* parser,
-      SharedContext* sc, HandleScript script, Handle<LazyScript*> lazyScript,
-      TokenPos bodyPosition, EmitterMode emitterMode = Normal,
+      SharedContext* sc, JS::Handle<JSScript*> script,
+      JS::Handle<LazyScript*> lazyScript, TokenPos bodyPosition,
+      EmitterMode emitterMode = Normal,
       FieldInitializers fieldInitializers = FieldInitializers::Invalid())
       : BytecodeEmitter(parent, EitherParser(parser), sc, script, lazyScript,
                         bodyPosition, emitterMode, fieldInitializers) {}
 
   MOZ_MUST_USE bool init();
 
   template <typename T>
   T* findInnermostNestableControl() const;
@@ -641,17 +663,17 @@ struct MOZ_STACK_CLASS BytecodeEmitter {
   // Check if the value on top of the stack is "undefined". If so, replace
   // that value on the stack with the value defined by |defaultExpr|.
   // |pattern| is a lhs node of the default expression.  If it's an
   // identifier and |defaultExpr| is an anonymous function, |SetFunctionName|
   // is called at compile time.
   MOZ_MUST_USE bool emitDefault(ParseNode* defaultExpr, ParseNode* pattern);
 
   MOZ_MUST_USE bool emitAnonymousFunctionWithName(ParseNode* node,
-                                                  HandleAtom name);
+                                                  JS::Handle<JSAtom*> name);
 
   MOZ_MUST_USE bool emitAnonymousFunctionWithComputedName(
       ParseNode* node, FunctionPrefixKind prefixKind);
 
   MOZ_MUST_USE bool setFunName(JSFunction* fun, JSAtom* name);
   MOZ_MUST_USE bool emitInitializer(ParseNode* initializer, ParseNode* pattern);
 
   MOZ_MUST_USE bool emitCallSiteObject(CallSiteNode* callSiteObj);
@@ -738,17 +760,17 @@ struct MOZ_STACK_CLASS BytecodeEmitter {
     InferredName,
 
     // The class is anonymous and has a dynamically computed name.
     ComputedName
   };
 
   MOZ_MUST_USE bool emitClass(
       ClassNode* classNode, ClassNameKind nameKind = ClassNameKind::BindingName,
-      HandleAtom nameForAnonymousClass = nullptr);
+      JS::Handle<JSAtom*> nameForAnonymousClass = nullptr);
   MOZ_MUST_USE bool emitSuperElemOperands(
       PropertyByValue* elem, EmitElemOption opts = EmitElemOption::Get);
   MOZ_MUST_USE bool emitSuperGetElem(PropertyByValue* elem,
                                      bool isCall = false);
 
   MOZ_MUST_USE bool emitCalleeAndThis(ParseNode* callee, ParseNode* call,
                                       CallOrNewEmitter& cone);
 
--- a/js/src/frontend/BytecodeSection.h
+++ b/js/src/frontend/BytecodeSection.h
@@ -15,24 +15,22 @@
 
 #include "NamespaceImports.h"          // ValueVector
 #include "frontend/JumpList.h"         // JumpTarget
 #include "frontend/NameCollections.h"  // AtomIndexMap, PooledMapPtr
 #include "frontend/SourceNotes.h"      // jssrcnote
 #include "gc/Barrier.h"                // GCPtrObject, GCPtrScope, GCPtrValue
 #include "gc/Rooting.h"                // JS::Rooted
 #include "js/GCVector.h"               // GCVector
-#include "js/TypeDecls.h"              // jsbytecode
+#include "js/TypeDecls.h"              // jsbytecode, JSContext
 #include "js/Value.h"                  // JS::Vector
 #include "js/Vector.h"                 // Vector
 #include "vm/JSScript.h"               // JSTryNote, JSTryNoteKind, ScopeNote
 #include "vm/Opcodes.h"                // JSOP_*
 
-struct JSContext;
-
 namespace js {
 
 class Scope;
 
 namespace frontend {
 
 class ObjectBox;
 
--- a/js/src/frontend/CForEmitter.cpp
+++ b/js/src/frontend/CForEmitter.cpp
@@ -1,21 +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/. */
 
 #include "frontend/CForEmitter.h"
 
-#include "frontend/BytecodeEmitter.h"
-#include "frontend/EmitterScope.h"
-#include "frontend/SourceNotes.h"
-#include "vm/Opcodes.h"
-#include "vm/Scope.h"
+#include "frontend/BytecodeEmitter.h"  // BytecodeEmitter
+#include "frontend/EmitterScope.h"     // EmitterScope
+#include "frontend/SourceNotes.h"      // SRC_*, SrcNote
+#include "vm/JSScript.h"               // JSTRY_LOOP
+#include "vm/Opcodes.h"                // JSOP_*
+#include "vm/Scope.h"                  // ScopeKind
 
 using namespace js;
 using namespace js::frontend;
 
 using mozilla::Maybe;
 
 CForEmitter::CForEmitter(BytecodeEmitter* bce,
                          const EmitterScope* headLexicalEmitterScopeForLet)
--- a/js/src/frontend/CForEmitter.h
+++ b/js/src/frontend/CForEmitter.h
@@ -2,24 +2,24 @@
  * 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_CForEmitter_h
 #define frontend_CForEmitter_h
 
-#include "mozilla/Attributes.h"
-#include "mozilla/Maybe.h"
+#include "mozilla/Attributes.h"  // MOZ_STACK_CLASS, MOZ_MUST_USE
+#include "mozilla/Maybe.h"       // mozilla::Maybe
 
-#include <stddef.h>
-#include <stdint.h>
+#include <stddef.h>  // ptrdiff_t
+#include <stdint.h>  // uint32_t
 
-#include "frontend/BytecodeControlStructures.h"
-#include "frontend/TDZCheckCache.h"
+#include "frontend/BytecodeControlStructures.h"  // LoopControl
+#include "frontend/TDZCheckCache.h"              // TDZCheckCache
 
 namespace js {
 namespace frontend {
 
 struct BytecodeEmitter;
 class EmitterScope;
 
 // Class for emitting bytecode for c-style for block.
--- a/js/src/frontend/ForOfLoopControl.cpp
+++ b/js/src/frontend/ForOfLoopControl.cpp
@@ -1,19 +1,23 @@
 /* -*- 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/ForOfLoopControl.h"
 
-#include "frontend/BytecodeEmitter.h"
-#include "frontend/EmitterScope.h"
-#include "frontend/IfEmitter.h"
+#include "jsapi.h"  // CompletionKind
+
+#include "frontend/BytecodeEmitter.h"  // BytecodeEmitter
+#include "frontend/EmitterScope.h"     // EmitterScope
+#include "frontend/IfEmitter.h"        // InternalIfEmitter
+#include "vm/JSScript.h"               // JSTRY_FOR_OF_ITERCLOSE
+#include "vm/Opcodes.h"                // JSOP_*
 
 using namespace js;
 using namespace js::frontend;
 
 ForOfLoopControl::ForOfLoopControl(BytecodeEmitter* bce, int32_t iterDepth,
                                    bool allowSelfHosted, IteratorKind iterKind)
     : LoopControl(bce, StatementKind::ForOfLoop),
       iterDepth_(iterDepth),
--- a/js/src/frontend/ForOfLoopControl.h
+++ b/js/src/frontend/ForOfLoopControl.h
@@ -2,24 +2,27 @@
  * 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_ForOfLoopControl_h
 #define frontend_ForOfLoopControl_h
 
-#include "mozilla/Attributes.h"
-#include "mozilla/Maybe.h"
+#include "mozilla/Attributes.h"  // MOZ_MUST_USE
+#include "mozilla/Maybe.h"       // mozilla::Maybe
+
+#include <stddef.h>  // ptrdiff_t
+#include <stdint.h>  // int32_t, uint32_t
 
-#include <stdint.h>
+#include "jsapi.h"  // CompletionKind
 
-#include "frontend/BytecodeControlStructures.h"
-#include "frontend/TryEmitter.h"
-#include "vm/Iteration.h"
+#include "frontend/BytecodeControlStructures.h"  // NestableControl, LoopControl
+#include "frontend/TryEmitter.h"                 // TryEmitter
+#include "vm/Iteration.h"                        // IteratorKind
 
 namespace js {
 namespace frontend {
 
 struct BytecodeEmitter;
 class EmitterScope;
 
 class ForOfLoopControl : public LoopControl {
--- a/js/src/frontend/JumpList.cpp
+++ b/js/src/frontend/JumpList.cpp
@@ -1,17 +1,19 @@
 /* -*- 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/JumpList.h"
 
-#include "vm/BytecodeUtil.h"
+#include "mozilla/Assertions.h"  // MOZ_ASSERT
+
+#include "vm/BytecodeUtil.h"  // SET_JUMP_OFFSET, IsJumpOpcode
 
 using namespace js;
 using namespace js::frontend;
 
 void JumpList::push(jsbytecode* code, ptrdiff_t jumpOffset) {
   SET_JUMP_OFFSET(&code[jumpOffset], offset - jumpOffset);
   offset = jumpOffset;
 }
--- a/js/src/frontend/JumpList.h
+++ b/js/src/frontend/JumpList.h
@@ -2,19 +2,19 @@
  * 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_JumpList_h
 #define frontend_JumpList_h
 
-#include <stddef.h>
+#include <stddef.h>  // ptrdiff_t
 
-#include "js/TypeDecls.h"
+#include "js/TypeDecls.h"  // jsbytecode
 
 namespace js {
 namespace frontend {
 
 // Linked list of jump instructions that need to be patched. The linked list is
 // stored in the bytes of the incomplete bytecode that will be patched, so no
 // extra memory is needed, and patching the instructions destroys the list.
 //
--- a/js/src/frontend/LabelEmitter.cpp
+++ b/js/src/frontend/LabelEmitter.cpp
@@ -4,16 +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/. */
 
 #include "frontend/LabelEmitter.h"
 
 #include "mozilla/Assertions.h"  // MOZ_ASSERT
 
 #include "frontend/BytecodeEmitter.h"  // BytecodeEmitter
+#include "vm/BytecodeUtil.h"           // SET_CODE_OFFSET
 #include "vm/Opcodes.h"                // JSOP_*
 
 using namespace js;
 using namespace js::frontend;
 
 bool LabelEmitter::emitLabel(HandleAtom name) {
   MOZ_ASSERT(state_ == State::Start);
 
--- a/js/src/frontend/LabelEmitter.h
+++ b/js/src/frontend/LabelEmitter.h
@@ -5,20 +5,21 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef frontend_LabelEmitter_h
 #define frontend_LabelEmitter_h
 
 #include "mozilla/Attributes.h"  // MOZ_MUST_USE, MOZ_STACK_CLASS
 #include "mozilla/Maybe.h"       // Maybe
 
+#include <stddef.h>  // ptrdiff_t
+
 #include "frontend/BytecodeControlStructures.h"  // LabelControl
 #include "frontend/JumpList.h"                   // JumpList
-
-class JSAtom;
+#include "js/TypeDecls.h"                        // JSAtom
 
 namespace js {
 namespace frontend {
 
 struct BytecodeEmitter;
 
 // Class for emitting labeled statement.
 //
--- a/js/src/frontend/SwitchEmitter.cpp
+++ b/js/src/frontend/SwitchEmitter.cpp
@@ -1,26 +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/. */
 
 #include "frontend/SwitchEmitter.h"
 
-#include "mozilla/Span.h"
+#include "mozilla/Assertions.h"  // MOZ_ASSERT
+#include "mozilla/Span.h"        // mozilla::Span
 
-#include "jsutil.h"
+#include <algorithm>  // std::min, std::max
+
+#include "jstypes.h"  // JS_BIT
+#include "jsutil.h"  // NumWordsForBitArrayOfLength, IsBitArrayElementSet, SetBitArrayElement
 
-#include "frontend/BytecodeEmitter.h"
-#include "frontend/SharedContext.h"
-#include "frontend/SourceNotes.h"
-#include "vm/BytecodeUtil.h"
-#include "vm/Opcodes.h"
-#include "vm/Runtime.h"
+#include "frontend/BytecodeEmitter.h"  // BytecodeEmitter
+#include "frontend/SharedContext.h"    // StatementKind
+#include "frontend/SourceNotes.h"      // SrcNote, SRC_*
+#include "js/TypeDecls.h"              // jsbytecode
+#include "vm/BytecodeUtil.h"  // SET_JUMP_OFFSET, JUMP_OFFSET_LEN, SET_RESUMEINDEX
+#include "vm/Opcodes.h"       // JSOP_*
+#include "vm/Runtime.h"       // ReportOutOfMemory
 
 using namespace js;
 using namespace js::frontend;
 
 using mozilla::Maybe;
 
 bool SwitchEmitter::TableGenerator::addNumber(int32_t caseValue) {
   if (isInvalid()) {
--- a/js/src/frontend/SwitchEmitter.h
+++ b/js/src/frontend/SwitchEmitter.h
@@ -2,31 +2,32 @@
  * 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_SwitchEmitter_h
 #define frontend_SwitchEmitter_h
 
-#include "mozilla/Attributes.h"
-#include "mozilla/Maybe.h"
+#include "mozilla/Assertions.h"  // MOZ_ASSERT
+#include "mozilla/Attributes.h"  // MOZ_STACK_CLASS, MOZ_MUST_USE
+#include "mozilla/Maybe.h"       // mozilla::Maybe
 
-#include <stddef.h>
-#include <stdint.h>
+#include <stddef.h>  // size_t, ptrdiff_t
+#include <stdint.h>  // int32_t, uint32_t
 
-#include "frontend/BytecodeControlStructures.h"
-#include "frontend/EmitterScope.h"
-#include "frontend/JumpList.h"
-#include "frontend/TDZCheckCache.h"
-#include "gc/Rooting.h"
-#include "js/AllocPolicy.h"
-#include "js/Value.h"
-#include "js/Vector.h"
-#include "vm/Scope.h"
+#include "frontend/BytecodeControlStructures.h"  // BreakableControl
+#include "frontend/EmitterScope.h"               // EmitterScope
+#include "frontend/JumpList.h"                   // JumpList, JumpTarget
+#include "frontend/TDZCheckCache.h"              // TDZCheckCache
+#include "gc/Rooting.h"                          // Handle
+#include "js/AllocPolicy.h"                      // SystemAllocPolicy
+#include "js/Value.h"                            // JSVAL_INT_MAX, JSVAL_INT_MIN
+#include "js/Vector.h"                           // Vector
+#include "vm/Scope.h"                            // LexicalScope
 
 namespace js {
 namespace frontend {
 
 struct BytecodeEmitter;
 
 // Class for emitting bytecode for switch-case-default block.
 //
--- a/js/src/frontend/TryEmitter.cpp
+++ b/js/src/frontend/TryEmitter.cpp
@@ -1,19 +1,23 @@
 /* -*- 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/TryEmitter.h"
 
-#include "frontend/BytecodeEmitter.h"
-#include "frontend/SourceNotes.h"
-#include "vm/Opcodes.h"
+#include "mozilla/Assertions.h"  // MOZ_ASSERT
+
+#include "frontend/BytecodeEmitter.h"  // BytecodeEmitter
+#include "frontend/SharedContext.h"    // StatementKind
+#include "frontend/SourceNotes.h"      // SrcNote, SRC_*
+#include "vm/JSScript.h"               // JSTRY_CATCH, JSTRY_FINALLY
+#include "vm/Opcodes.h"                // JSOP_*
 
 using namespace js;
 using namespace js::frontend;
 
 using mozilla::Maybe;
 
 TryEmitter::TryEmitter(BytecodeEmitter* bce, Kind kind, ControlKind controlKind)
     : bce_(bce),
--- a/js/src/frontend/TryEmitter.h
+++ b/js/src/frontend/TryEmitter.h
@@ -2,25 +2,24 @@
  * 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_TryEmitter_h
 #define frontend_TryEmitter_h
 
-#include "mozilla/Attributes.h"
-#include "mozilla/Maybe.h"
+#include "mozilla/Attributes.h"  // MOZ_STACK_CLASS, MOZ_MUST_USE
+#include "mozilla/Maybe.h"       // mozilla::Maybe, mozilla::Nothing
 
-#include <stddef.h>
-#include <stdint.h>
+#include <stddef.h>  // ptrdiff_t
+#include <stdint.h>  // uint32_t
 
-#include "frontend/BytecodeControlStructures.h"
-#include "frontend/JumpList.h"
-#include "frontend/TDZCheckCache.h"
+#include "frontend/BytecodeControlStructures.h"  // TryFinallyControl
+#include "frontend/JumpList.h"                   // JumpList, JumpTarget
 
 namespace js {
 namespace frontend {
 
 struct BytecodeEmitter;
 
 // Class for emitting bytecode for blocks like try-catch-finally.
 //