Bug 902917 - Remove some unnecessary #includes in SpiderMonkey. r=till.
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 08 Aug 2013 16:07:22 -0700
changeset 156050 b9b8ad32c72b3fd1327068d9aeb8ca3afa8ab1fc
parent 156049 624083d612b1b8307a949b72a13529111053b220
child 156051 ba45b2a024f90568db4071189ce01aa23b3102db
push id407
push userlsblakk@mozilla.com
push dateTue, 03 Dec 2013 03:32:50 +0000
treeherdermozilla-release@babf8c9ebc52 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstill
bugs902917
milestone26.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 902917 - Remove some unnecessary #includes in SpiderMonkey. r=till.
js/public/GCAPI.h
js/public/PropertyKey.h
js/src/TraceLogging.h
js/src/builtin/BinaryData.cpp
js/src/builtin/BinaryData.h
js/src/builtin/Eval.h
js/src/builtin/Object.cpp
js/src/builtin/ParallelArray.h
js/src/builtin/Profilers.cpp
js/src/builtin/RegExp.h
js/src/builtin/TestingFunctions.cpp
js/src/frontend/BytecodeCompiler.cpp
js/src/frontend/BytecodeEmitter.cpp
js/src/frontend/BytecodeEmitter.h
js/src/frontend/NameFunctions.cpp
js/src/frontend/Parser-inl.h
js/src/frontend/Parser.cpp
js/src/frontend/Parser.h
js/src/frontend/SourceNotes.h
js/src/frontend/TokenStream.cpp
js/src/frontend/TokenStream.h
js/src/gc/Barrier-inl.h
js/src/gc/Iteration.cpp
js/src/gc/Marking.cpp
js/src/gc/Marking.h
js/src/gc/Memory.h
js/src/gc/Statistics.cpp
js/src/gc/Statistics.h
js/src/gc/StoreBuffer.h
js/src/gc/Verifier.cpp
js/src/gc/Zone.h
js/src/jit/AsmJS.cpp
js/src/jit/AsmJSLink.cpp
js/src/jit/AsmJSModule.h
js/src/jit/AsmJSSignalHandlers.cpp
js/src/jit/Bailouts.cpp
js/src/jit/BaselineBailouts.cpp
js/src/jit/BaselineCompiler.cpp
js/src/jit/BaselineCompiler.h
js/src/jit/BaselineFrame-inl.h
js/src/jit/BaselineFrame.cpp
js/src/jit/BaselineFrameInfo.cpp
js/src/jit/BaselineFrameInfo.h
js/src/jit/BaselineIC.cpp
js/src/jit/BaselineIC.h
js/src/jit/BaselineInspector.h
js/src/jit/BaselineJIT.cpp
js/src/jit/BitSet.cpp
js/src/jit/BytecodeAnalysis.h
js/src/jit/C1Spewer.cpp
js/src/jit/C1Spewer.h
js/src/jit/CodeGenerator.cpp
js/src/jit/EdgeCaseAnalysis.cpp
js/src/jit/Ion.cpp
js/src/jit/Ion.h
js/src/jit/IonCaches.h
js/src/jit/IonFrames.cpp
js/src/jit/IonMacroAssembler.cpp
js/src/jit/IonMacroAssembler.h
js/src/jit/JSONSpewer.h
js/src/jit/LIR.cpp
js/src/jit/LIR.h
js/src/jit/LinearScan.cpp
js/src/jit/Lowering.cpp
js/src/jit/MCallOptimize.cpp
js/src/jit/MIR.cpp
js/src/jit/MIR.h
js/src/jit/ParallelFunctions.cpp
js/src/jit/ParallelFunctions.h
js/src/jit/ParallelSafetyAnalysis.cpp
js/src/jit/PerfSpewer.cpp
js/src/jit/PerfSpewer.h
js/src/jit/RangeAnalysis.cpp
js/src/jit/shared/BaselineCompiler-shared.h
js/src/jit/shared/CodeGenerator-shared.cpp
js/src/jit/shared/CodeGenerator-x86-shared.cpp
js/src/jit/x64/Bailouts-x64.cpp
js/src/jit/x64/CodeGenerator-x64.cpp
js/src/jit/x64/MacroAssembler-x64.cpp
js/src/jit/x64/MacroAssembler-x64.h
js/src/jit/x64/Trampoline-x64.cpp
js/src/jsalloc.h
js/src/jsanalyze.cpp
js/src/jsanalyze.h
js/src/jsapi-tests/testArgumentsObject.cpp
js/src/jsapi.cpp
js/src/jsatom.cpp
js/src/jsatom.h
js/src/jsatominlines.h
js/src/jsboolinlines.h
js/src/jsclass.h
js/src/jsclone.h
js/src/jscntxt.cpp
js/src/jscntxt.h
js/src/jscntxtinlines.h
js/src/jscompartment.cpp
js/src/jscompartment.h
js/src/jscompartmentinlines.h
js/src/jscrashformat.h
js/src/jsdate.cpp
js/src/jsdate.h
js/src/jsdbgapi.cpp
js/src/jsdtoa.h
js/src/jsexn.cpp
js/src/jsfriendapi.cpp
js/src/jsfriendapi.h
js/src/jsfun.h
js/src/jsfuninlines.h
js/src/jsgc.cpp
js/src/jsgc.h
js/src/jsgcinlines.h
js/src/jsinfer.cpp
js/src/jsinfer.h
js/src/jsinferinlines.h
js/src/jslock.h
js/src/jsmemorymetrics.cpp
js/src/jsnum.cpp
js/src/jsnum.h
js/src/jsobj.cpp
js/src/jsobj.h
js/src/jsobjinlines.h
js/src/json.cpp
js/src/json.h
js/src/jsonparser.cpp
js/src/jsopcode.cpp
js/src/jsopcode.h
js/src/jsopcodeinlines.h
js/src/jsprf.h
js/src/jspropertytree.h
js/src/jsprototypes.h
js/src/jspubtd.h
js/src/jsreflect.h
js/src/jsscript.cpp
js/src/jsscript.h
js/src/jsscriptinlines.h
js/src/jsstr.cpp
js/src/jsstr.h
js/src/jsstrinlines.h
js/src/jstypes.h
js/src/jsutil.h
js/src/jswatchpoint.cpp
js/src/jswatchpoint.h
js/src/jsweakcache.h
js/src/jsworkers.cpp
js/src/perf/pm_linux.cpp
js/src/prmjtime.cpp
js/src/prmjtime.h
js/src/shell/js.cpp
js/src/vm/ArgumentsObject-inl.h
js/src/vm/Debugger.cpp
js/src/vm/ForkJoin.h
js/src/vm/GlobalObject-inl.h
js/src/vm/GlobalObject.cpp
js/src/vm/Interpreter-inl.h
js/src/vm/Interpreter.cpp
js/src/vm/Monitor.h
js/src/vm/ObjectImpl-inl.h
js/src/vm/RegExpObject-inl.h
js/src/vm/Runtime-inl.h
js/src/vm/Runtime.h
js/src/vm/SPSProfiler.h
js/src/vm/ScopeObject-inl.h
js/src/vm/ScopeObject.cpp
js/src/vm/SelfHosting.cpp
js/src/vm/Shape-inl.h
js/src/vm/Stack-inl.h
js/src/vm/Stack.h
js/src/vm/String.cpp
js/src/vm/String.h
js/src/vm/TypedArrayObject.cpp
js/src/vm/TypedArrayObject.h
js/src/vm/Xdr.cpp
js/src/vm/Xdr.h
js/src/yarr/YarrInterpreter.cpp
js/src/yarr/YarrInterpreter.h
--- a/js/public/GCAPI.h
+++ b/js/public/GCAPI.h
@@ -3,16 +3,17 @@
  * 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 js_GCAPI_h
 #define js_GCAPI_h
 
 #include "js/HeapAPI.h"
+#include "js/RootingAPI.h"
 
 namespace JS {
 
 #define GCREASONS(D)                            \
     /* Reasons internal to the JS engine */     \
     D(API)                                      \
     D(MAYBEGC)                                  \
     D(LAST_CONTEXT)                             \
--- a/js/public/PropertyKey.h
+++ b/js/public/PropertyKey.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/. */
 
 /* JS::PropertyKey implementation. */
 
 #ifndef js_PropertyKey_h
 #define js_PropertyKey_h
 
-#include "mozilla/Attributes.h"
-
 #include "js/Value.h"
 
 struct JSContext;
 
 namespace JS {
 
 class PropertyKey;
 
--- a/js/src/TraceLogging.h
+++ b/js/src/TraceLogging.h
@@ -2,17 +2,20 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 TraceLogging_h
 #define TraceLogging_h
 
-#include "jsscript.h"
+#include <stdio.h>
+#include <stdint.h>
+
+class JSScript;
 
 namespace js {
 
 struct CompileOptions;
 
 class TraceLogging
 {
   public:
--- a/js/src/builtin/BinaryData.cpp
+++ b/js/src/builtin/BinaryData.cpp
@@ -1,18 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 "builtin/BinaryData.h"
 
-#include "mozilla/FloatingPoint.h"
-
 #include "jscompartment.h"
 #include "jsfun.h"
 #include "jsobj.h"
 #include "jsutil.h"
 
 #include "gc/Marking.h"
 #include "js/Vector.h"
 #include "vm/GlobalObject.h"
--- a/js/src/builtin/BinaryData.h
+++ b/js/src/builtin/BinaryData.h
@@ -3,21 +3,18 @@
  * 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 builtin_BinaryData_h
 #define builtin_BinaryData_h
 
 #include "jsapi.h"
-#include "jsfriendapi.h"
 #include "jsobj.h"
 
-#include "gc/Heap.h"
-
 namespace js {
 typedef float float32_t;
 typedef double float64_t;
 
 enum {
     NUMERICTYPE_UINT8 = 0,
     NUMERICTYPE_UINT16,
     NUMERICTYPE_UINT32,
--- a/js/src/builtin/Eval.h
+++ b/js/src/builtin/Eval.h
@@ -2,17 +2,18 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 builtin_Eval_h
 #define builtin_Eval_h
 
-#include "vm/Stack.h"
+#include "jsapi.h"
+#include "jsbytecode.h"
 
 namespace js {
 
 // The C++ native for 'eval' (ES5 15.1.2.1). The function is named "indirect
 // eval" because "direct eval" calls (as defined by the spec) will emit
 // JSOP_EVAL which in turn calls DirectEval. Thus, even though IndirectEval is
 // the callee function object for *all* calls to eval, it is by construction
 // only ever called in the case indirect eval.
--- a/js/src/builtin/Object.cpp
+++ b/js/src/builtin/Object.cpp
@@ -4,17 +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/. */
 
 #include "builtin/Object.h"
 
 #include "mozilla/Util.h"
 
 #include "jscntxt.h"
-#include "jsobj.h"
 
 #include "frontend/BytecodeCompiler.h"
 #include "vm/StringBuffer.h"
 
 #include "jsobjinlines.h"
 
 using namespace js;
 using namespace js::types;
--- a/js/src/builtin/ParallelArray.h
+++ b/js/src/builtin/ParallelArray.h
@@ -3,22 +3,19 @@
  * 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 builtin_ParallelArray_h
 #define builtin_ParallelArray_h
 
 #include "jsapi.h"
-#include "jscntxt.h"
 #include "jsobj.h"
 
 #include "jit/Ion.h"
-#include "vm/ForkJoin.h"
-#include "vm/ThreadPool.h"
 
 namespace js {
 
 class ParallelArrayObject : public JSObject
 {
     static Class protoClass;
     static const JSFunctionSpec methods[];
     static const uint32_t NumFixedSlots = 4;
--- a/js/src/builtin/Profilers.cpp
+++ b/js/src/builtin/Profilers.cpp
@@ -14,16 +14,18 @@
 #include <valgrind/callgrind.h>
 #endif
 
 #ifdef __APPLE__
 #include "devtools/Instruments.h"
 #include "devtools/sharkctl.h"
 #endif
 
+#include "vm/Probes.h"
+
 #include "jscntxtinlines.h"
 
 using namespace js;
 
 using mozilla::ArrayLength;
 
 /* Thread-unsafe error management */
 
--- a/js/src/builtin/RegExp.h
+++ b/js/src/builtin/RegExp.h
@@ -2,17 +2,16 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 builtin_RegExp_h
 #define builtin_RegExp_h
 
-#include "vm/MatchPairs.h"
 #include "vm/RegExpObject.h"
 
 JSObject *
 js_InitRegExpClass(JSContext *cx, js::HandleObject obj);
 
 /*
  * The following builtin natives are extern'd for pointer comparison in
  * other parts of the engine.
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -6,17 +6,19 @@
 
 #include "builtin/TestingFunctions.h"
 
 #include "jsapi.h"
 #include "jscntxt.h"
 #include "jsfriendapi.h"
 #include "jsgc.h"
 #include "jsobj.h"
+#ifndef JS_MORE_DETERMINISTIC
 #include "jsprf.h"
+#endif
 #include "jswrapper.h"
 
 #include "jit/AsmJS.h"
 #include "jit/AsmJSLink.h"
 #include "vm/ForkJoin.h"
 #include "vm/Interpreter.h"
 
 #include "vm/ObjectImpl-inl.h"
--- a/js/src/frontend/BytecodeCompiler.cpp
+++ b/js/src/frontend/BytecodeCompiler.cpp
@@ -1,29 +1,31 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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/BytecodeCompiler.h"
 
+#include "jscntxt.h"
 #include "jsscript.h"
 
 #include "frontend/BytecodeEmitter.h"
 #include "frontend/FoldConstants.h"
 #include "frontend/NameFunctions.h"
 #include "frontend/Parser.h"
 #include "jit/AsmJSLink.h"
 #include "vm/GlobalObject.h"
 
 #include "jsobjinlines.h"
 #include "jsscriptinlines.h"
 
 #include "frontend/ParseMaps-inl.h"
+#include "frontend/Parser-inl.h"
 
 using namespace js;
 using namespace js::frontend;
 using mozilla::Maybe;
 
 static bool
 CheckLength(ExclusiveContext *cx, size_t length)
 {
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -33,16 +33,17 @@
 
 #include "jsatominlines.h"
 #include "jsfuninlines.h"
 #include "jsobjinlines.h"
 #include "jsscriptinlines.h"
 
 #include "frontend/ParseMaps-inl.h"
 #include "frontend/ParseNode-inl.h"
+#include "vm/ScopeObject-inl.h"
 
 using namespace js;
 using namespace js::gc;
 using namespace js::frontend;
 
 using mozilla::DebugOnly;
 using mozilla::DoubleIsInt32;
 using mozilla::PodCopy;
--- a/js/src/frontend/BytecodeEmitter.h
+++ b/js/src/frontend/BytecodeEmitter.h
@@ -6,31 +6,32 @@
 
 #ifndef frontend_BytecodeEmitter_h
 #define frontend_BytecodeEmitter_h
 
 /*
  * JS bytecode generation.
  */
 
-#include "jsatom.h"
+#include "jscntxt.h"
 #include "jsopcode.h"
-#include "jspubtd.h"
 #include "jsscript.h"
 
 #include "frontend/ParseMaps.h"
-#include "frontend/SharedContext.h"
 #include "frontend/SourceNotes.h"
-#include "vm/ScopeObject.h"
 
 namespace js {
 namespace frontend {
 
-template <typename ParseHandler>
-class Parser;
+class FullParseHandler;
+class ObjectBox;
+class ParseNode;
+template <typename ParseHandler> class Parser;
+class SharedContext;
+class TokenStream;
 
 struct CGTryNoteList {
     Vector<JSTryNote> list;
     CGTryNoteList(ExclusiveContext *cx) : list(cx) {}
 
     bool append(JSTryNoteKind kind, unsigned stackDepth, size_t start, size_t end);
     size_t length() const { return list.length(); }
     void finish(TryNoteArray *array);
--- a/js/src/frontend/NameFunctions.cpp
+++ b/js/src/frontend/NameFunctions.cpp
@@ -10,16 +10,17 @@
 #include "jsprf.h"
 
 #include "frontend/BytecodeCompiler.h"
 #include "frontend/ParseNode.h"
 #include "frontend/SharedContext.h"
 #include "vm/StringBuffer.h"
 
 #include "jsfuninlines.h"
+#include "jsscriptinlines.h"
 
 using namespace js;
 using namespace js::frontend;
 
 class NameResolver
 {
     static const size_t MaxParents = 100;
 
new file mode 100644
--- /dev/null
+++ b/js/src/frontend/Parser-inl.h
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ * vim: set ts=8 sts=4 et sw=4 tw=99:
+ * 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_Parser_inl_h
+#define frontend_Parser_inl_h
+
+#include "frontend/Parser.h"
+
+#include "frontend/ParseMaps-inl.h"
+
+namespace js {
+namespace frontend {
+
+template <typename ParseHandler>
+bool
+ParseContext<ParseHandler>::init()
+{
+    if (!frontend::GenerateBlockId(this, this->bodyid))
+        return false;
+
+    return decls_.init() && lexdeps.ensureMap(sc->context);
+}
+
+template <typename ParseHandler>
+ParseContext<ParseHandler>::~ParseContext()
+{
+    // |*parserPC| pointed to this object.  Now that this object is about to
+    // die, make |*parserPC| point to this object's parent.
+    JS_ASSERT(*parserPC == this);
+    *parserPC = this->oldpc;
+    js_delete(funcStmts);
+}
+
+} // namespace frontend
+} // namespace js
+
+#endif /* frontend_Parser_inl_h */
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -12,44 +12,44 @@
  * feedback to disambiguate non-LL(1) structures.  It generates trees of nodes
  * induced by the recursive parsing (not precise syntax trees, see Parser.h).
  * After tree construction, it rewrites trees to fold constants and evaluate
  * compile-time expressions.
  *
  * This parser attempts no error recovery.
  */
 
-#include "frontend/Parser.h"
+#include "frontend/Parser-inl.h"
 
 #include "jsapi.h"
 #include "jsatom.h"
 #include "jscntxt.h"
 #include "jsfun.h"
 #include "jsobj.h"
 #include "jsopcode.h"
 #include "jsscript.h"
 #include "jstypes.h"
 #include "jsversion.h"
 
 #include "frontend/BytecodeCompiler.h"
 #include "frontend/FoldConstants.h"
 #include "frontend/ParseMaps.h"
 #include "frontend/TokenStream.h"
 #include "jit/AsmJS.h"
-#include "vm/NumericConversions.h"
 #include "vm/RegExpStatics.h"
 #include "vm/Shape.h"
 
 #include "jsatominlines.h"
 #include "jsfuninlines.h"
 #include "jsobjinlines.h"
 #include "jsscriptinlines.h"
 
 #include "frontend/ParseMaps-inl.h"
 #include "frontend/ParseNode-inl.h"
+#include "vm/ScopeObject-inl.h"
 
 using namespace js;
 using namespace js::gc;
 using mozilla::Maybe;
 
 namespace js {
 namespace frontend {
 
--- a/js/src/frontend/Parser.h
+++ b/js/src/frontend/Parser.h
@@ -261,31 +261,19 @@ struct ParseContext : public GenericPars
         funcStmts(NULL),
         innerFunctions(prs->context),
         newDirectives(newDirectives),
         inDeclDestructuring(false)
     {
         prs->pc = this;
     }
 
-    ~ParseContext() {
-        // |*parserPC| pointed to this object.  Now that this object is about to
-        // die, make |*parserPC| point to this object's parent.
-        JS_ASSERT(*parserPC == this);
-        *parserPC = this->oldpc;
-        js_delete(funcStmts);
-    }
+    ~ParseContext();
 
-    inline bool init()
-{
-    if (!frontend::GenerateBlockId(this, this->bodyid))
-        return false;
-
-    return decls_.init() && lexdeps.ensureMap(sc->context);
-}
+    bool init();
 
     unsigned blockid() { return topStmt ? topStmt->blockid : bodyid; }
 
     // True if we are at the topmost level of a entire script or function body.
     // For example, while parsing this code we would encounter f1 and f2 at
     // body level, but we would not encounter f3 or f4 at body level:
     //
     //   function f1() { function f2() { } }
--- a/js/src/frontend/SourceNotes.h
+++ b/js/src/frontend/SourceNotes.h
@@ -2,16 +2,20 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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_SourceNotes_h
 #define frontend_SourceNotes_h
 
+#include <stdint.h>
+
+#include "jstypes.h"
+
 typedef uint8_t jssrcnote;
 
 namespace js {
 
 /*
  * Source notes generated along with bytecode for decompiling and debugging.
  * A source note is a uint8_t with 5 bits of type and 3 of offset from the pc
  * of the previous note. If 3 bits of offset aren't enough, extended delta
--- a/js/src/frontend/TokenStream.cpp
+++ b/js/src/frontend/TokenStream.cpp
@@ -5,27 +5,26 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // JS lexical scanner.
 
 #include "frontend/TokenStream.h"
 
 #include "mozilla/PodOperations.h"
 
+#include <ctype.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <string.h>
 
 #include "jsapi.h"
 #include "jsatom.h"
 #include "jscntxt.h"
 #include "jsexn.h"
 #include "jsnum.h"
-#include "jsopcode.h"
-#include "jsscript.h"
 
 #include "frontend/BytecodeCompiler.h"
 #include "js/CharacterEncoding.h"
 #include "vm/Keywords.h"
 #include "vm/StringBuffer.h"
 
 using namespace js;
 using namespace js::frontend;
--- a/js/src/frontend/TokenStream.h
+++ b/js/src/frontend/TokenStream.h
@@ -12,17 +12,16 @@
 #include "mozilla/DebugOnly.h"
 #include "mozilla/PodOperations.h"
 
 #include <stdarg.h>
 #include <stddef.h>
 #include <stdio.h>
 
 #include "jscntxt.h"
-#include "jsopcode.h"
 #include "jspubtd.h"
 #include "jsversion.h"
 
 #include "js/Vector.h"
 #include "vm/RegExpObject.h"
 
 namespace js {
 namespace frontend {
--- a/js/src/gc/Barrier-inl.h
+++ b/js/src/gc/Barrier-inl.h
@@ -4,16 +4,18 @@
  * 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 gc_Barrier_inl_h
 #define gc_Barrier_inl_h
 
 #include "gc/Barrier.h"
 
+#include "jscompartment.h"
+
 #include "gc/Marking.h"
 #include "gc/StoreBuffer.h"
 
 #include "vm/String-inl.h"
 
 namespace js {
 
 JS_ALWAYS_INLINE JS::Zone *
--- a/js/src/gc/Iteration.cpp
+++ b/js/src/gc/Iteration.cpp
@@ -1,15 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 "jsapi.h"
+#include "jscompartment.h"
 #include "jsgc.h"
 
 #include "gc/GCInternals.h"
 #include "js/HashTable.h"
 #include "vm/Runtime.h"
 
 #include "jsgcinlines.h"
 
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.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 "gc/Marking.h"
 
 #include "mozilla/DebugOnly.h"
 
 #include "jit/IonCode.h"
+#include "vm/ArgumentsObject.h"
 #include "vm/Shape.h"
 #include "vm/TypedArrayObject.h"
 
 #include "jscompartmentinlines.h"
 #include "jsinferinlines.h"
 
 #include "gc/Nursery-inl.h"
 #include "vm/Shape-inl.h"
--- a/js/src/gc/Marking.h
+++ b/js/src/gc/Marking.h
@@ -2,21 +2,17 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 gc_Marking_h
 #define gc_Marking_h
 
-#include "jsgc.h"
-#include "jslock.h"
-
 #include "gc/Barrier.h"
-#include "gc/Nursery.h"
 #include "jit/IonCode.h"
 
 extern "C" {
 struct JSContext;
 class JSFunction;
 class JSObject;
 class JSScript;
 }
@@ -25,19 +21,23 @@ class JSAtom;
 class JSLinearString;
 
 namespace js {
 
 class ArgumentsObject;
 class ArrayBufferObject;
 class ArrayBufferViewObject;
 class BaseShape;
+class DebugScopeObject;
+struct GCMarker;
 class GlobalObject;
+class LazyScript;
+class ScopeObject;
+class Shape;
 class UnownedBaseShape;
-class Shape;
 
 template<class, typename> class HeapPtr;
 
 namespace gc {
 
 /*** Object Marking ***/
 
 /*
--- a/js/src/gc/Memory.h
+++ b/js/src/gc/Memory.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 gc_Memory_h
 #define gc_Memory_h
 
 #include <stddef.h>
 
-#include "jsgc.h"
+struct JSRuntime;
 
 namespace js {
 namespace gc {
 
 // Sanity check that our compiled configuration matches the currently running
 // instance and initialize any runtime data needed for allocation.
 void
 InitMemorySubsystem(JSRuntime *rt);
--- a/js/src/gc/Statistics.cpp
+++ b/js/src/gc/Statistics.cpp
@@ -3,16 +3,17 @@
  * 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 "gc/Statistics.h"
 
 #include "mozilla/PodOperations.h"
 
+#include <ctype.h>
 #include <stdarg.h>
 #include <stdio.h>
 
 #include "jscrashreport.h"
 #include "jsprf.h"
 #include "jsutil.h"
 #include "prmjtime.h"
 
--- a/js/src/gc/Statistics.h
+++ b/js/src/gc/Statistics.h
@@ -5,17 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef gc_Statistics_h
 #define gc_Statistics_h
 
 #include "mozilla/DebugOnly.h"
 #include "mozilla/PodOperations.h"
 
-#include "jsfriendapi.h"
+#include "jsapi.h"
 #include "jspubtd.h"
 
 #include "js/GCAPI.h"
 
 struct JSCompartment;
 
 namespace js {
 namespace gcstats {
--- a/js/src/gc/StoreBuffer.h
+++ b/js/src/gc/StoreBuffer.h
@@ -12,18 +12,16 @@
 #ifndef JSGC_USE_EXACT_ROOTING
 # error "Generational GC requires exact rooting."
 #endif
 
 #include "mozilla/DebugOnly.h"
 #include "mozilla/ReentrancyGuard.h"
 
 #include "jsalloc.h"
-#include "jsgc.h"
-#include "jsobj.h"
 
 #include "ds/LifoAlloc.h"
 #include "gc/Nursery.h"
 
 namespace js {
 namespace gc {
 
 class AccumulateEdgesTracer;
--- a/js/src/gc/Verifier.cpp
+++ b/js/src/gc/Verifier.cpp
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifdef MOZ_VALGRIND
 # include <valgrind/memcheck.h>
 #endif
 
 #include "jsapi.h"
 #include "jscntxt.h"
-#include "jscompartment.h"
 #include "jsgc.h"
 #include "jsprf.h"
 
 #include "gc/GCInternals.h"
 #include "gc/Zone.h"
 #include "js/HashTable.h"
 
 #include "jsgcinlines.h"
--- a/js/src/gc/Zone.h
+++ b/js/src/gc/Zone.h
@@ -2,32 +2,24 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 gc_Zone_h
 #define gc_Zone_h
 
-#include "mozilla/Attributes.h"
-#include "mozilla/GuardObjects.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Util.h"
 
 #include "jscntxt.h"
-#include "jsfun.h"
 #include "jsgc.h"
 #include "jsinfer.h"
-#include "jsobj.h"
 
 #include "gc/FindSCCs.h"
-#include "gc/StoreBuffer.h"
-#include "vm/GlobalObject.h"
-#include "vm/RegExpObject.h"
-#include "vm/Shape.h"
 
 namespace js {
 
 /*
  * Encapsulates the data needed to perform allocation.  Typically there is
  * precisely one of these per zone (|cx->zone().allocator|).  However, in
  * parallel execution mode, there will be one per worker thread.
  */
--- a/js/src/jit/AsmJS.cpp
+++ b/js/src/jit/AsmJS.cpp
@@ -9,29 +9,33 @@
 #include "mozilla/Move.h"
 
 #ifdef MOZ_VTUNE
 # include "vtune/VTuneWrapper.h"
 #endif
 
 #include "jsmath.h"
 #include "jsworkers.h"
+#include "jsprf.h"
 #include "prmjtime.h"
 
 #include "frontend/Parser.h"
+#include "jit/AsmJSLink.h"
 #include "jit/AsmJSModule.h"
 #include "jit/CodeGenerator.h"
 #include "jit/MIR.h"
 #include "jit/MIRGraph.h"
 #include "jit/PerfSpewer.h"
-
-#include "jsfuninlines.h"
-
-#include "frontend/ParseMaps-inl.h"
+#include "vm/Interpreter.h"
+
+#include "jsinferinlines.h"
+
 #include "frontend/ParseNode-inl.h"
+#include "frontend/Parser-inl.h"
+#include "gc/Barrier-inl.h"
 
 using namespace js;
 using namespace js::frontend;
 using namespace js::ion;
 
 using mozilla::AddToHash;
 using mozilla::ArrayLength;
 using mozilla::DebugOnly;
--- a/js/src/jit/AsmJSLink.cpp
+++ b/js/src/jit/AsmJSLink.cpp
@@ -17,16 +17,18 @@
 #include "frontend/BytecodeCompiler.h"
 #include "jit/AsmJSModule.h"
 #include "jit/Ion.h"
 #ifdef JS_ION_PERF
 # include "jit/PerfSpewer.h"
 #endif
 
 #include "jsfuninlines.h"
+#include "jsobjinlines.h"
+#include "jsscriptinlines.h"
 
 using namespace js;
 using namespace js::ion;
 
 using mozilla::IsNaN;
 
 static const unsigned MODULE_FUN_SLOT = 0;
 
--- a/js/src/jit/AsmJSModule.h
+++ b/js/src/jit/AsmJSModule.h
@@ -4,19 +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_AsmJSModule_h
 #define jit_AsmJSModule_h
 
 #ifdef JS_ION
 
-#include "mozilla/MathAlgorithms.h"
-
-#include "jsfriendapi.h"
 #include "jsscript.h"
 
 #include "gc/Marking.h"
 #include "jit/AsmJS.h"
 #include "jit/IonMacroAssembler.h"
 #if defined(JS_ION_PERF)
 # include "jit/PerfSpewer.h"
 #endif
--- a/js/src/jit/AsmJSSignalHandlers.cpp
+++ b/js/src/jit/AsmJSSignalHandlers.cpp
@@ -1,18 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 "jit/AsmJSSignalHandlers.h"
 
-#include "jscntxt.h"
-
 #include "assembler/assembler/MacroAssembler.h"
 #include "jit/AsmJSModule.h"
 
 #include "vm/ObjectImpl-inl.h"
 
 using namespace js;
 using namespace js::ion;
 using namespace mozilla;
--- a/js/src/jit/Bailouts.cpp
+++ b/js/src/jit/Bailouts.cpp
@@ -1,27 +1,25 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 "jit/Bailouts.h"
 
-#include "jsanalyze.h"
 #include "jscntxt.h"
-#include "jscompartment.h"
-#include "jsinfer.h"
 
 #include "jit/BaselineJIT.h"
 #include "jit/Ion.h"
 #include "jit/IonCompartment.h"
 #include "jit/IonSpewer.h"
 #include "jit/SnapshotReader.h"
-#include "vm/Interpreter.h"
+
+#include "jsobjinlines.h"
 
 #include "vm/Stack-inl.h"
 
 using namespace js;
 using namespace js::ion;
 
 // These constructor are exactly the same except for the type of the iterator
 // which is given to the SnapshotIterator constructor. Doing so avoid the
--- a/js/src/jit/BaselineBailouts.cpp
+++ b/js/src/jit/BaselineBailouts.cpp
@@ -4,18 +4,20 @@
  * 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 "jit/BaselineCompiler.h"
 #include "jit/BaselineIC.h"
 #include "jit/BaselineJIT.h"
 #include "jit/CompileInfo.h"
 #include "jit/IonSpewer.h"
+#include "vm/ArgumentsObject.h"
 
 #include "jsfuninlines.h"
+#include "jsscriptinlines.h"
 
 #include "jit/IonFrames-inl.h"
 
 using namespace js;
 using namespace js::ion;
 
 // BaselineStackBuilder may reallocate its buffer if the current one is too
 // small. To avoid dangling pointers, BufferPointer represents a pointer into
--- a/js/src/jit/BaselineCompiler.cpp
+++ b/js/src/jit/BaselineCompiler.cpp
@@ -9,16 +9,18 @@
 #include "jit/BaselineHelpers.h"
 #include "jit/BaselineIC.h"
 #include "jit/BaselineJIT.h"
 #include "jit/FixedList.h"
 #include "jit/IonLinker.h"
 #include "jit/IonSpewer.h"
 #include "jit/VMFunctions.h"
 
+#include "jsscriptinlines.h"
+
 #include "vm/Interpreter-inl.h"
 
 using namespace js;
 using namespace js::ion;
 
 BaselineCompiler::BaselineCompiler(JSContext *cx, HandleScript script)
   : BaselineCompilerSpecific(cx, script)
 {
--- a/js/src/jit/BaselineCompiler.h
+++ b/js/src/jit/BaselineCompiler.h
@@ -4,34 +4,29 @@
  * 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_BaselineCompiler_h
 #define jit_BaselineCompiler_h
 
 #ifdef JS_ION
 
-#include "jscntxt.h"
-#include "jscompartment.h"
-#include "jsinfer.h"
-
 #include "jit/BaselineIC.h"
 #include "jit/BaselineJIT.h"
 #include "jit/BytecodeAnalysis.h"
 #include "jit/FixedList.h"
 #include "jit/IonAllocPolicy.h"
 #include "jit/IonCode.h"
 #if defined(JS_CPU_X86)
 # include "jit/x86/BaselineCompiler-x86.h"
 #elif defined(JS_CPU_X64)
 # include "jit/x64/BaselineCompiler-x64.h"
 #else
 # include "jit/arm/BaselineCompiler-arm.h"
 #endif
-#include "vm/Interpreter.h"
 
 namespace js {
 namespace ion {
 
 #define OPCODE_LIST(_)         \
     _(JSOP_NOP)                \
     _(JSOP_LABEL)              \
     _(JSOP_NOTEARG)            \
--- a/js/src/jit/BaselineFrame-inl.h
+++ b/js/src/jit/BaselineFrame-inl.h
@@ -10,18 +10,17 @@
 #ifdef JS_ION
 
 #include "jit/BaselineFrame.h"
 
 #include "jscntxt.h"
 #include "jscompartment.h"
 
 #include "jit/IonFrames.h"
-
-#include "vm/ScopeObject-inl.h"
+#include "vm/ScopeObject.h"
 
 namespace js {
 namespace ion {
 
 inline void
 BaselineFrame::pushOnScopeChain(ScopeObject &scope)
 {
     JS_ASSERT(*scopeChain() == scope.enclosingScope() ||
--- a/js/src/jit/BaselineFrame.cpp
+++ b/js/src/jit/BaselineFrame.cpp
@@ -7,16 +7,18 @@
 #include "jit/BaselineFrame-inl.h"
 
 #include "jit/BaselineIC.h"
 #include "jit/BaselineJIT.h"
 #include "jit/Ion.h"
 #include "vm/Debugger.h"
 #include "vm/ScopeObject.h"
 
+#include "jsobjinlines.h"
+
 #include "jit/IonFrames-inl.h"
 #include "vm/Stack-inl.h"
 
 using namespace js;
 using namespace js::ion;
 
 void
 BaselineFrame::trace(JSTracer *trc)
--- a/js/src/jit/BaselineFrameInfo.cpp
+++ b/js/src/jit/BaselineFrameInfo.cpp
@@ -1,18 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 "jit/BaselineFrameInfo.h"
 
-#include "jsanalyze.h"
-
 #include "jit/IonSpewer.h"
 #include "jit/shared/BaselineCompiler-shared.h"
 
 using namespace js;
 using namespace js::ion;
 
 bool
 FrameInfo::init() {
--- a/js/src/jit/BaselineFrameInfo.h
+++ b/js/src/jit/BaselineFrameInfo.h
@@ -4,19 +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_BaselineFrameInfo_h
 #define jit_BaselineFrameInfo_h
 
 #ifdef JS_ION
 
-#include "jscntxt.h"
-#include "jscompartment.h"
-
 #include "jit/BaselineFrame.h"
 #include "jit/BaselineJIT.h"
 #include "jit/BaselineRegisters.h"
 #include "jit/BytecodeAnalysis.h"
 #include "jit/FixedList.h"
 #include "jit/IonMacroAssembler.h"
 
 namespace js {
--- a/js/src/jit/BaselineIC.cpp
+++ b/js/src/jit/BaselineIC.cpp
@@ -1,27 +1,31 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 "jit/BaselineIC.h"
 
+#include "jslibmath.h"
+
 #include "builtin/Eval.h"
 #include "jit/BaselineCompiler.h"
 #include "jit/BaselineHelpers.h"
 #include "jit/BaselineJIT.h"
 #include "jit/IonLinker.h"
 #include "jit/IonSpewer.h"
 #include "jit/VMFunctions.h"
 
 #include "jsboolinlines.h"
+#include "jsscriptinlines.h"
 
 #include "vm/Interpreter-inl.h"
+#include "vm/ScopeObject-inl.h"
 
 namespace js {
 namespace ion {
 
 #ifdef DEBUG
 void
 FallbackICSpew(JSContext *cx, ICFallbackStub *stub, const char *fmt, ...)
 {
--- a/js/src/jit/BaselineIC.h
+++ b/js/src/jit/BaselineIC.h
@@ -8,19 +8,17 @@
 #define jit_BaselineIC_h
 
 #ifdef JS_ION
 
 #include "jscntxt.h"
 #include "jscompartment.h"
 #include "jsgc.h"
 #include "jsopcode.h"
-#include "jsproxy.h"
-
-#include "gc/Heap.h"
+
 #include "jit/BaselineJIT.h"
 #include "jit/BaselineRegisters.h"
 
 namespace js {
 namespace ion {
 
 //
 // Baseline Inline Caches are polymorphic caches that aggressively
--- a/js/src/jit/BaselineInspector.h
+++ b/js/src/jit/BaselineInspector.h
@@ -4,19 +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_BaselineInspector_h
 #define jit_BaselineInspector_h
 
 #ifdef JS_ION
 
-#include "jscntxt.h"
-#include "jscompartment.h"
-
 #include "jit/BaselineIC.h"
 #include "jit/BaselineJIT.h"
 #include "jit/MIR.h"
 
 namespace js {
 namespace ion {
 
 class BaselineInspector;
--- a/js/src/jit/BaselineJIT.cpp
+++ b/js/src/jit/BaselineJIT.cpp
@@ -7,18 +7,22 @@
 #include "jit/BaselineJIT.h"
 
 #include "mozilla/MemoryReporting.h"
 
 #include "jit/BaselineCompiler.h"
 #include "jit/BaselineIC.h"
 #include "jit/CompileInfo.h"
 #include "jit/IonSpewer.h"
+#include "vm/Interpreter.h"
 
+#include "jsgcinlines.h"
+#include "jsobjinlines.h"
 #include "jsopcodeinlines.h"
+#include "jsscriptinlines.h"
 
 #include "jit/IonFrames-inl.h"
 #include "vm/Stack-inl.h"
 
 using namespace js;
 using namespace js::ion;
 
 /* static */ PCMappingSlotInfo::SlotLocation
--- a/js/src/jit/BitSet.cpp
+++ b/js/src/jit/BitSet.cpp
@@ -1,18 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 "jit/BitSet.h"
 
-#include "jsutil.h"
-
 using namespace js;
 using namespace js::ion;
 
 BitSet *
 BitSet::New(unsigned int max)
 {
     BitSet *result = new BitSet(max);
     if (!result->init())
--- a/js/src/jit/BytecodeAnalysis.h
+++ b/js/src/jit/BytecodeAnalysis.h
@@ -2,18 +2,16 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 jit_BytecodeAnalysis_h
 #define jit_BytecodeAnalysis_h
 
-#include "jscntxt.h"
-
 #include "jit/IonAllocPolicy.h"
 #include "js/Vector.h"
 
 namespace js {
 namespace ion {
 
 // Basic information about bytecodes in the script.  Used to help baseline compilation.
 struct BytecodeInfo
--- a/js/src/jit/C1Spewer.cpp
+++ b/js/src/jit/C1Spewer.cpp
@@ -3,17 +3,16 @@
  * 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/. */
 
 #ifdef DEBUG
 
 #include "jit/C1Spewer.h"
 
-#include <stdarg.h>
 #include <time.h>
 
 #include "jit/Ion.h"
 #include "jit/IonBuilder.h"
 #include "jit/LinearScan.h"
 #include "jit/LIR.h"
 #include "jit/MIRGraph.h"
 
--- a/js/src/jit/C1Spewer.h
+++ b/js/src/jit/C1Spewer.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 jit_C1Spewer_h
 #define jit_C1Spewer_h
 
 #ifdef DEBUG
 
-#include "jsscript.h"
+#include "jsapi.h"
 
 #include "js/RootingAPI.h"
 
 namespace js {
 namespace ion {
 
 class MDefinition;
 class MInstruction;
--- a/js/src/jit/CodeGenerator.cpp
+++ b/js/src/jit/CodeGenerator.cpp
@@ -1,16 +1,18 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 "jit/CodeGenerator.h"
 
+#include "jslibmath.h"
+
 #include "mozilla/Assertions.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/Util.h"
 
 #include "jsmath.h"
 #include "jsnum.h"
 
--- a/js/src/jit/EdgeCaseAnalysis.cpp
+++ b/js/src/jit/EdgeCaseAnalysis.cpp
@@ -1,18 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 "jit/EdgeCaseAnalysis.h"
 
-#include <stdio.h>
-
 #include "jit/Ion.h"
 #include "jit/IonBuilder.h"
 #include "jit/IonSpewer.h"
 #include "jit/MIR.h"
 #include "jit/MIRGraph.h"
 
 using namespace js;
 using namespace js::ion;
--- a/js/src/jit/Ion.cpp
+++ b/js/src/jit/Ion.cpp
@@ -43,23 +43,22 @@
 #if defined(JS_CPU_X86)
 # include "jit/x86/Lowering-x86.h"
 #elif defined(JS_CPU_X64)
 # include "jit/x64/Lowering-x64.h"
 #elif defined(JS_CPU_ARM)
 # include "jit/arm/Lowering-arm.h"
 #endif
 #include "vm/ForkJoin.h"
-#include "vm/ThreadPool.h"
 
 #include "jscompartmentinlines.h"
 #include "jsgcinlines.h"
 #include "jsinferinlines.h"
 
-#include "vm/Stack-inl.h"
+#include "vm/Shape-inl.h"
 
 using namespace js;
 using namespace js::ion;
 
 // Global variables.
 IonOptions ion::js_IonOptions;
 
 // Assert that IonCode is gc::Cell aligned.
--- a/js/src/jit/Ion.h
+++ b/js/src/jit/Ion.h
@@ -8,21 +8,19 @@
 #define jit_Ion_h
 
 #ifdef JS_ION
 
 #include "mozilla/MemoryReporting.h"
 
 #include "jscntxt.h"
 #include "jscompartment.h"
-#include "jsinfer.h"
 
 #include "jit/CompileInfo.h"
 #include "jit/IonCode.h"
-#include "vm/Interpreter.h"
 
 namespace js {
 namespace ion {
 
 class TempAllocator;
 
 // Possible register allocators which may be used.
 enum IonRegisterAllocator {
--- a/js/src/jit/IonCaches.h
+++ b/js/src/jit/IonCaches.h
@@ -8,23 +8,23 @@
 #define jit_IonCaches_h
 
 #ifdef JS_CPU_ARM
 # include "jit/arm/Assembler-arm.h"
 #endif
 #include "jit/IonCode.h"
 #include "jit/Registers.h"
 #include "jit/shared/Assembler-shared.h"
-#include "vm/ForkJoin.h"
 
 class JSFunction;
 class JSScript;
 
 namespace js {
 
+class LockedJSContext;
 class TypedArrayObject;
 
 namespace ion {
 
 #define IONCACHE_KIND_LIST(_)                                   \
     _(GetProperty)                                              \
     _(SetProperty)                                              \
     _(GetElement)                                               \
--- a/js/src/jit/IonFrames.cpp
+++ b/js/src/jit/IonFrames.cpp
@@ -17,18 +17,20 @@
 #include "jit/Ion.h"
 #include "jit/IonCompartment.h"
 #include "jit/IonMacroAssembler.h"
 #include "jit/IonSpewer.h"
 #include "jit/PcScriptCache.h"
 #include "jit/Safepoints.h"
 #include "jit/SnapshotReader.h"
 #include "jit/VMFunctions.h"
+#include "vm/Interpreter.h"
 
 #include "jsfuninlines.h"
+#include "jsscriptinlines.h"
 
 #include "jit/IonFrameIterator-inl.h"
 #include "vm/Probes-inl.h"
 
 namespace js {
 namespace ion {
 
 IonFrameIterator::IonFrameIterator(const ActivationIterator &activations)
--- a/js/src/jit/IonMacroAssembler.cpp
+++ b/js/src/jit/IonMacroAssembler.cpp
@@ -2,24 +2,24 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 "jit/IonMacroAssembler.h"
 
 #include "jsinfer.h"
+#include "jsprf.h"
 
 #include "jit/Bailouts.h"
 #include "jit/BaselineFrame.h"
 #include "jit/BaselineIC.h"
 #include "jit/BaselineJIT.h"
 #include "jit/BaselineRegisters.h"
 #include "jit/MIR.h"
-#include "js/RootingAPI.h"
 #include "vm/ForkJoin.h"
 
 #include "jsgcinlines.h"
 #include "jsinferinlines.h"
 
 #include "vm/Shape-inl.h"
 
 using namespace js;
--- a/js/src/jit/IonMacroAssembler.h
+++ b/js/src/jit/IonMacroAssembler.h
@@ -17,17 +17,16 @@
 # include "jit/x64/MacroAssembler-x64.h"
 #elif defined(JS_CPU_ARM)
 # include "jit/arm/MacroAssembler-arm.h"
 #endif
 #include "jit/IonCompartment.h"
 #include "jit/IonInstrumentation.h"
 #include "jit/ParallelFunctions.h"
 #include "jit/VMFunctions.h"
-#include "vm/ForkJoin.h"
 #include "vm/ProxyObject.h"
 #include "vm/Shape.h"
 #include "vm/TypedArrayObject.h"
 
 namespace js {
 namespace ion {
 
 // The public entrypoint for emitting assembly. Note that a MacroAssembler can
--- a/js/src/jit/JSONSpewer.h
+++ b/js/src/jit/JSONSpewer.h
@@ -4,20 +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_JSONSpewer_h
 #define jit_JSONSpewer_h
 
 #include <stdio.h>
 
-#include "jsscript.h"
-
-#include "js/RootingAPI.h"
-
 class JSScript;
 
 namespace js {
 namespace ion {
 
 class MDefinition;
 class MInstruction;
 class MBasicBlock;
--- a/js/src/jit/LIR.cpp
+++ b/js/src/jit/LIR.cpp
@@ -1,16 +1,18 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 "jit/LIR.h"
 
+#include <ctype.h>
+
 #include "jsprf.h"
 
 #include "jit/IonSpewer.h"
 #include "jit/MIR.h"
 #include "jit/MIRGraph.h"
 #include "jit/shared/CodeGenerator-shared.h"
 
 using namespace js;
--- a/js/src/jit/LIR.h
+++ b/js/src/jit/LIR.h
@@ -7,18 +7,16 @@
 #ifndef jit_LIR_h
 #define jit_LIR_h
 
 // This file declares the core data structures for LIR: storage allocations for
 // inputs and outputs, as well as the interface instructions must conform to.
 
 #include "mozilla/Array.h"
 
-#include "jscntxt.h"
-
 #include "jit/Bailouts.h"
 #include "jit/InlineList.h"
 #include "jit/IonAllocPolicy.h"
 #include "jit/LOpcodes.h"
 #include "jit/MIR.h"
 #include "jit/MIRGraph.h"
 #include "jit/Registers.h"
 #include "jit/Safepoints.h"
--- a/js/src/jit/LinearScan.cpp
+++ b/js/src/jit/LinearScan.cpp
@@ -3,18 +3,16 @@
  * 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 "jit/LinearScan.h"
 
 #include "mozilla/DebugOnly.h"
 
-#include <limits.h>
-
 #include "jit/BitSet.h"
 #include "jit/IonBuilder.h"
 #include "jit/IonSpewer.h"
 
 using namespace js;
 using namespace js::ion;
 
 using mozilla::DebugOnly;
--- a/js/src/jit/Lowering.cpp
+++ b/js/src/jit/Lowering.cpp
@@ -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/. */
 
 #include "jit/Lowering.h"
 
 #include "mozilla/DebugOnly.h"
 
 #include "jsanalyze.h"
-#include "jsbool.h"
-#include "jsnum.h"
 
 #include "jit/IonSpewer.h"
 #include "jit/LIR.h"
 #include "jit/MIR.h"
 #include "jit/MIRGraph.h"
 #include "jit/RangeAnalysis.h"
 
 #include "jsinferinlines.h"
--- a/js/src/jit/MCallOptimize.cpp
+++ b/js/src/jit/MCallOptimize.cpp
@@ -1,15 +1,14 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 "jslibmath.h"
 #include "jsmath.h"
 
 #include "builtin/ParallelArray.h"
 #include "builtin/TestingFunctions.h"
 #include "jit/IonBuilder.h"
 #include "jit/MIR.h"
 #include "jit/MIRGraph.h"
 
--- a/js/src/jit/MIR.cpp
+++ b/js/src/jit/MIR.cpp
@@ -3,17 +3,19 @@
  * 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 "jit/MIR.h"
 
 #include "mozilla/FloatingPoint.h"
 
-#include "jsnum.h"
+#include <ctype.h>
+
+#include "jslibmath.h"
 #include "jsstr.h"
 
 #include "jit/BaselineInspector.h"
 #include "jit/EdgeCaseAnalysis.h"
 #include "jit/IonBuilder.h"
 #include "jit/IonSpewer.h"
 #include "jit/LICM.h" // For LinearSum
 #include "jit/MIRGraph.h"
--- a/js/src/jit/MIR.h
+++ b/js/src/jit/MIR.h
@@ -9,19 +9,17 @@
  * instructions, the instruction interface, and use chains.
  */
 
 #ifndef jit_MIR_h
 #define jit_MIR_h
 
 #include "mozilla/Array.h"
 
-#include "jscntxt.h"
 #include "jsinfer.h"
-#include "jslibmath.h"
 
 #include "jit/Bailouts.h"
 #include "jit/CompilerRoot.h"
 #include "jit/FixedList.h"
 #include "jit/InlineList.h"
 #include "jit/IonAllocPolicy.h"
 #include "jit/IonMacroAssembler.h"
 #include "jit/MOpcodes.h"
--- a/js/src/jit/ParallelFunctions.cpp
+++ b/js/src/jit/ParallelFunctions.cpp
@@ -3,21 +3,21 @@
  * 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 "jit/ParallelFunctions.h"
 
 #include "jit/IonSpewer.h"
 #include "vm/ArrayObject.h"
-#include "vm/Interpreter.h"
 
 #include "jsfuninlines.h"
 #include "jsgcinlines.h"
 #include "jsobjinlines.h"
+#include "jsscriptinlines.h"
 
 using namespace js;
 using namespace ion;
 
 using parallel::Spew;
 using parallel::SpewOps;
 using parallel::SpewBailouts;
 using parallel::SpewBailoutIR;
--- a/js/src/jit/ParallelFunctions.h
+++ b/js/src/jit/ParallelFunctions.h
@@ -4,17 +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_ParallelFunctions_h
 #define jit_ParallelFunctions_h
 
 #include "gc/Heap.h"
 #include "vm/ForkJoin.h"
-#include "vm/ThreadPool.h"
 
 namespace js {
 namespace ion {
 
 ForkJoinSlice *ForkJoinSlicePar();
 JSObject *NewGCThingPar(gc::AllocKind allocKind);
 bool IsThreadLocalObject(ForkJoinSlice *context, JSObject *object);
 bool CheckOverRecursedPar(ForkJoinSlice *slice);
--- a/js/src/jit/ParallelSafetyAnalysis.cpp
+++ b/js/src/jit/ParallelSafetyAnalysis.cpp
@@ -1,25 +1,22 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 "jit/ParallelSafetyAnalysis.h"
 
-#include <stdio.h>
-
 #include "jit/Ion.h"
 #include "jit/IonAnalysis.h"
 #include "jit/IonSpewer.h"
 #include "jit/MIR.h"
 #include "jit/MIRGraph.h"
 #include "jit/UnreachableCodeElimination.h"
-#include "vm/Stack.h"
 
 #include "jsinferinlines.h"
 
 using namespace js;
 using namespace ion;
 
 using parallel::Spew;
 using parallel::SpewMIR;
--- a/js/src/jit/PerfSpewer.cpp
+++ b/js/src/jit/PerfSpewer.cpp
@@ -1,18 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 "jit/PerfSpewer.h"
 
-#include <stdarg.h>
-
 #if defined(__linux__)
 # include <unistd.h>
 #endif
 
 #include "jit/IonSpewer.h"
 #include "jit/LinearScan.h"
 #include "jit/LIR.h"
 #include "jit/MIR.h"
--- a/js/src/jit/PerfSpewer.h
+++ b/js/src/jit/PerfSpewer.h
@@ -4,20 +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 jit_PerfSpewer_h
 #define jit_PerfSpewer_h
 
 #include <stdio.h>
 
-#include "jsscript.h"
-
 #include "jit/IonMacroAssembler.h"
-#include "js/RootingAPI.h"
 
 class JSScript;
 
 namespace js {
 namespace ion {
 
 class MBasicBlock;
 class MacroAssembler;
--- a/js/src/jit/RangeAnalysis.cpp
+++ b/js/src/jit/RangeAnalysis.cpp
@@ -3,19 +3,16 @@
  * 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 "jit/RangeAnalysis.h"
 
 #include "mozilla/MathAlgorithms.h"
 
-#include <math.h>
-#include <stdio.h>
-
 #include "jsanalyze.h"
 
 #include "jit/Ion.h"
 #include "jit/IonAnalysis.h"
 #include "jit/IonSpewer.h"
 #include "jit/MIR.h"
 #include "jit/MIRGraph.h"
 #include "vm/NumericConversions.h"
--- a/js/src/jit/shared/BaselineCompiler-shared.h
+++ b/js/src/jit/shared/BaselineCompiler-shared.h
@@ -2,18 +2,16 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 jit_shared_BaselineCompiler_shared_h
 #define jit_shared_BaselineCompiler_shared_h
 
-#include "jscntxt.h"
-
 #include "jit/BaselineFrameInfo.h"
 #include "jit/BaselineIC.h"
 #include "jit/IonInstrumentation.h"
 #include "jit/IonMacroAssembler.h"
 #include "jit/IonSpewer.h"
 
 namespace js {
 namespace ion {
--- a/js/src/jit/shared/CodeGenerator-shared.cpp
+++ b/js/src/jit/shared/CodeGenerator-shared.cpp
@@ -3,17 +3,16 @@
  * 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 "jit/shared/CodeGenerator-shared-inl.h"
 
 #include "mozilla/DebugOnly.h"
 
-#include "builtin/ParallelArray.h"
 #include "jit/IonMacroAssembler.h"
 #include "jit/IonSpewer.h"
 #include "jit/MIR.h"
 #include "jit/MIRGenerator.h"
 #include "jit/ParallelFunctions.h"
 
 #include "jit/IonFrames-inl.h"
 
--- a/js/src/jit/shared/CodeGenerator-x86-shared.cpp
+++ b/js/src/jit/shared/CodeGenerator-x86-shared.cpp
@@ -4,20 +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/. */
 
 #include "jit/shared/CodeGenerator-x86-shared.h"
 
 #include "mozilla/DebugOnly.h"
 #include "mozilla/MathAlgorithms.h"
 
-#include "jscntxt.h"
-#include "jscompartment.h"
-#include "jsmath.h"
-
 #include "jit/IonCompartment.h"
 #include "jit/IonFrames.h"
 #include "jit/ParallelFunctions.h"
 #include "jit/RangeAnalysis.h"
 
 #include "jit/shared/CodeGenerator-shared-inl.h"
 
 using namespace js;
--- a/js/src/jit/x64/Bailouts-x64.cpp
+++ b/js/src/jit/x64/Bailouts-x64.cpp
@@ -1,17 +1,14 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 "jscntxt.h"
-#include "jscompartment.h"
-
 #include "jit/Bailouts.h"
 #include "jit/IonCompartment.h"
 
 using namespace js;
 using namespace js::ion;
 
 #if defined(_WIN32)
 # pragma pack(push, 1)
--- a/js/src/jit/x64/CodeGenerator-x64.cpp
+++ b/js/src/jit/x64/CodeGenerator-x64.cpp
@@ -1,21 +1,18 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 "jit/x64/CodeGenerator-x64.h"
 
-#include "jsnum.h"
-
 #include "jit/MIR.h"
 #include "jit/MIRGraph.h"
-#include "vm/Shape.h"
 
 #include "jsscriptinlines.h"
 
 #include "jit/shared/CodeGenerator-shared-inl.h"
 
 using namespace js;
 using namespace js::ion;
 
--- a/js/src/jit/x64/MacroAssembler-x64.cpp
+++ b/js/src/jit/x64/MacroAssembler-x64.cpp
@@ -1,18 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 "jit/x64/MacroAssembler-x64.h"
 
-#include "mozilla/Casting.h"
-
 #include "jit/Bailouts.h"
 #include "jit/BaselineFrame.h"
 #include "jit/IonFrames.h"
 #include "jit/MoveEmitter.h"
 
 using namespace js;
 using namespace js::ion;
 
--- a/js/src/jit/x64/MacroAssembler-x64.h
+++ b/js/src/jit/x64/MacroAssembler-x64.h
@@ -2,18 +2,16 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 jit_x64_MacroAssembler_x64_h
 #define jit_x64_MacroAssembler_x64_h
 
-#include "jsnum.h"
-
 #include "jit/IonFrames.h"
 #include "jit/MoveResolver.h"
 #include "jit/shared/MacroAssembler-x86-shared.h"
 
 namespace js {
 namespace ion {
 
 struct ImmShiftedTag : public ImmWord
--- a/js/src/jit/x64/Trampoline-x64.cpp
+++ b/js/src/jit/x64/Trampoline-x64.cpp
@@ -1,16 +1,14 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 "jscompartment.h"
-
 #include "assembler/assembler/MacroAssembler.h"
 #include "jit/Bailouts.h"
 #include "jit/ExecutionModeInlines.h"
 #include "jit/IonCompartment.h"
 #include "jit/IonFrames.h"
 #include "jit/IonLinker.h"
 #include "jit/IonSpewer.h"
 #include "jit/VMFunctions.h"
--- a/js/src/jsalloc.h
+++ b/js/src/jsalloc.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/. */
 
 /* JS allocation policies. */
 
 #ifndef jsalloc_h
 #define jsalloc_h
 
-#include "mozilla/AllocPolicy.h"
-
 #include "js/Utility.h"
 
 struct JSContext;
 
 namespace js {
 
 class ContextFriendFields;
 
--- a/js/src/jsanalyze.cpp
+++ b/js/src/jsanalyze.cpp
@@ -9,17 +9,16 @@
 #include "mozilla/DebugOnly.h"
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/PodOperations.h"
 
 #include "jscntxt.h"
 #include "jscompartment.h"
 
 #include "jsinferinlines.h"
-#include "jsopcodeinlines.h"
 
 using namespace js;
 using namespace js::analyze;
 
 using mozilla::DebugOnly;
 using mozilla::PodCopy;
 using mozilla::PodZero;
 using mozilla::FloorLog2;
--- a/js/src/jsanalyze.h
+++ b/js/src/jsanalyze.h
@@ -4,23 +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/. */
 
 /* Definitions for javascript analysis. */
 
 #ifndef jsanalyze_h
 #define jsanalyze_h
 
-#include "mozilla/PodOperations.h"
-
 #include "jscompartment.h"
-#include "jsinfer.h"
-#include "jsscript.h"
-
-#include "vm/Runtime.h"
 
 class JSScript;
 
 namespace js {
 namespace analyze {
 
 class LoopAnalysis;
 class SlotValue;
--- a/js/src/jsapi-tests/testArgumentsObject.cpp
+++ b/js/src/jsapi-tests/testArgumentsObject.cpp
@@ -2,16 +2,17 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  */
 /* 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 "jsapi-tests/tests.h"
 
+#include "vm/ArgumentsObject-inl.h"
 #include "vm/Stack-inl.h"
 
 using namespace js;
 
 static const char NORMAL_ZERO[] =
     "function f() { return arguments; }";
 static const char NORMAL_ONE[] =
     "function f(a) { return arguments; }";
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -10,17 +10,16 @@
 
 #include "jsapi.h"
 
 #include "mozilla/FloatingPoint.h"
 #include "mozilla/PodOperations.h"
 
 #include <ctype.h>
 #include <stdarg.h>
-#include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
 
 #include "jsarray.h"
 #include "jsatom.h"
 #include "jsbool.h"
 #include "jsclone.h"
 #include "jscntxt.h"
@@ -45,27 +44,25 @@
 #include "jsworkers.h"
 #endif
 #include "jswrapper.h"
 #include "prmjtime.h"
 
 #if ENABLE_YARR_JIT
 #include "assembler/jit/ExecutableAllocator.h"
 #endif
-#include "builtin/BinaryData.h"
 #include "builtin/Eval.h"
 #include "builtin/Intl.h"
 #include "builtin/MapObject.h"
 #include "builtin/ParallelArray.h"
 #include "builtin/RegExp.h"
 #include "frontend/BytecodeCompiler.h"
 #include "frontend/FullParseHandler.h"  // for JS_BufferIsCompileableUnit
 #include "frontend/Parser.h" // for JS_BufferIsCompileableUnit
 #include "gc/Marking.h"
-#include "gc/Memory.h"
 #include "jit/AsmJSLink.h"
 #include "js/CharacterEncoding.h"
 #if ENABLE_INTL_API
 #include "unicode/uclean.h"
 #include "unicode/utypes.h"
 #endif // ENABLE_INTL_API
 #include "vm/DateObject.h"
 #include "vm/Debugger.h"
@@ -78,16 +75,17 @@
 #include "vm/StringBuffer.h"
 #include "vm/TypedArrayObject.h"
 #include "vm/WeakMapObject.h"
 #include "vm/WrapperObject.h"
 #include "vm/Xdr.h"
 #include "yarr/BumpPointerAllocator.h"
 
 #include "jsatominlines.h"
+#include "jsfuninlines.h"
 #include "jsinferinlines.h"
 #include "jsscriptinlines.h"
 
 #include "vm/Interpreter-inl.h"
 #include "vm/ObjectImpl-inl.h"
 #include "vm/RegExpStatics-inl.h"
 #include "vm/Shape-inl.h"
 #include "vm/String-inl.h"
--- a/js/src/jsatom.cpp
+++ b/js/src/jsatom.cpp
@@ -18,16 +18,17 @@
 #include "jsapi.h"
 #include "jscntxt.h"
 #include "jsstr.h"
 #include "jstypes.h"
 
 #include "gc/Marking.h"
 #include "vm/Xdr.h"
 
+#include "jscntxtinlines.h"
 #include "jscompartmentinlines.h"
 
 #include "vm/String-inl.h"
 
 using namespace js;
 using namespace js::gc;
 
 using mozilla::ArrayEnd;
--- a/js/src/jsatom.h
+++ b/js/src/jsatom.h
@@ -4,27 +4,22 @@
  * 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 jsatom_h
 #define jsatom_h
 
 #include "mozilla/HashFunctions.h"
 
-#include <stddef.h>
-
-#include "jsalloc.h"
-#include "jsapi.h"
-#include "jspubtd.h"
-
 #include "gc/Barrier.h"
 #include "gc/Rooting.h"
-#include "js/HashTable.h"
 #include "vm/CommonPropertyNames.h"
 
+class JSAtom;
+
 struct JSIdArray {
     int length;
     js::HeapId vector[1];    /* actually, length jsid words */
 };
 
 namespace js {
 
 JS_STATIC_ASSERT(sizeof(HashNumber) == 4);
--- a/js/src/jsatominlines.h
+++ b/js/src/jsatominlines.h
@@ -9,20 +9,17 @@
 
 #include "jsatom.h"
 
 #include "mozilla/PodOperations.h"
 #include "mozilla/RangedPtr.h"
 
 #include "jscntxt.h"
 #include "jsnum.h"
-#include "jsobj.h"
-#include "jsstr.h"
 
-#include "gc/Barrier.h"
 #include "vm/String.h"
 
 inline JSAtom *
 js::AtomStateEntry::asPtr() const
 {
     JS_ASSERT(bits != 0);
     JSAtom *atom = reinterpret_cast<JSAtom *>(bits & NO_TAG_MASK);
     JSString::readBarrier(atom);
--- a/js/src/jsboolinlines.h
+++ b/js/src/jsboolinlines.h
@@ -4,26 +4,19 @@
  * 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 jsboolinlines_h
 #define jsboolinlines_h
 
 #include "jsbool.h"
 
-#include "mozilla/Assertions.h"
-#include "mozilla/Likely.h"
-
-#include "jswrapper.h"
-
-#include "js/RootingAPI.h"
+#include "vm/BooleanObject.h"
 #include "vm/WrapperObject.h"
 
-#include "vm/BooleanObject-inl.h"
-
 namespace js {
 
 bool
 BooleanGetPrimitiveValueSlow(HandleObject, JSContext *);
 
 inline bool
 BooleanGetPrimitiveValue(HandleObject obj, JSContext *cx)
 {
--- a/js/src/jsclass.h
+++ b/js/src/jsclass.h
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 jsclass_h
 #define jsclass_h
+
 /*
  * A JSClass acts as a vtable for JS objects that allows JSAPI clients to
  * control various aspects of the behavior of an object like property lookup.
  * js::Class is an engine-private extension that allows more control over
  * object behavior and, e.g., allows custom slow layout.
  */
 
 #include "jsapi.h"
--- a/js/src/jsclone.h
+++ b/js/src/jsclone.h
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef jsclone_h
 #define jsclone_h
 
 #include "jsapi.h"
 #include "jscntxt.h"
 
-#include "js/HashTable.h"
 #include "js/Vector.h"
 
 namespace js {
 
 bool
 WriteStructuredClone(JSContext *cx, HandleValue v, uint64_t **bufp, size_t *nbytesp,
                      const JSStructuredCloneCallbacks *cb, void *cbClosure,
                      jsval transferable);
--- a/js/src/jscntxt.cpp
+++ b/js/src/jscntxt.cpp
@@ -9,52 +9,51 @@
  */
 
 #include "jscntxtinlines.h"
 
 #include "mozilla/DebugOnly.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Util.h"
 
-#include <locale.h>
+#include <ctype.h>
 #include <stdarg.h>
 #include <string.h>
 #ifdef ANDROID
 # include <android/log.h>
 # include <fstream>
 # include <string>
 #endif  // ANDROID
 
 #include "jsatom.h"
 #include "jscompartment.h"
 #include "jsdbgapi.h"
 #include "jsexn.h"
 #include "jsfun.h"
 #include "jsgc.h"
 #include "jsiter.h"
-#include "jsmath.h"
 #include "jsobj.h"
 #include "jsopcode.h"
 #include "jsprf.h"
 #include "jspubtd.h"
 #include "jsscript.h"
 #include "jsstr.h"
 #include "jstypes.h"
 #include "jsworkers.h"
 
 #include "gc/Marking.h"
 #ifdef JS_ION
 #include "jit/Ion.h"
 #endif
 #include "js/CharacterEncoding.h"
-#include "js/MemoryMetrics.h"
 #include "vm/Shape.h"
 #include "yarr/BumpPointerAllocator.h"
 
 #include "jsobjinlines.h"
+#include "jsscriptinlines.h"
 
 #include "vm/Stack-inl.h"
 
 using namespace js;
 using namespace js::gc;
 
 using mozilla::DebugOnly;
 using mozilla::PodArrayZero;
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -4,28 +4,20 @@
  * 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 execution context. */
 
 #ifndef jscntxt_h
 #define jscntxt_h
 
-#include "mozilla/LinkedList.h"
 #include "mozilla/MemoryReporting.h"
 
-#include <string.h>
-
-#include "jsapi.h"
-#include "jsfriendapi.h"
-
-#include "js/HashTable.h"
 #include "js/Vector.h"
 #include "vm/Runtime.h"
-#include "vm/Stack.h"
 
 #ifdef _MSC_VER
 #pragma warning(push)
 #pragma warning(disable:4100) /* Silence unreferenced formal parameter warnings */
 #pragma warning(push)
 #pragma warning(disable:4355) /* Silence warning about "this" used in base member initializer list */
 #endif
 
--- a/js/src/jscntxtinlines.h
+++ b/js/src/jscntxtinlines.h
@@ -4,30 +4,23 @@
  * 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 jscntxtinlines_h
 #define jscntxtinlines_h
 
 #include "jscntxt.h"
 
-#include "jscompartment.h"
-#include "jsfriendapi.h"
-#include "jsgc.h"
 #include "jsiter.h"
-#include "jsworkers.h"
 
-#include "builtin/Object.h" // For js::obj_construct
-#include "frontend/ParseMaps.h"
-#include "jit/IonFrames.h" // For GetPcScript
+#include "builtin/Object.h"
+#include "jit/IonFrames.h"
+#include "vm/ForkJoin.h"
 #include "vm/Interpreter.h"
-#include "vm/Probes.h"
-#include "vm/RegExpObject.h"
-
-#include "jsgcinlines.h"
+#include "vm/ProxyObject.h"
 
 #include "vm/ObjectImpl-inl.h"
 
 namespace js {
 
 #ifdef JS_CRASH_DIAGNOSTICS
 class CompartmentChecker
 {
--- a/js/src/jscompartment.cpp
+++ b/js/src/jscompartment.cpp
@@ -21,17 +21,18 @@
 #include "jit/IonCompartment.h"
 #endif
 #include "js/RootingAPI.h"
 #include "vm/StopIterationObject.h"
 #include "vm/WrapperObject.h"
 
 #include "jsfuninlines.h"
 #include "jsgcinlines.h"
-#include "jsobjinlines.h"
+#include "jsinferinlines.h"
+#include "jsscriptinlines.h"
 
 #include "gc/Barrier-inl.h"
 
 using namespace js;
 using namespace js::gc;
 
 using mozilla::DebugOnly;
 
--- a/js/src/jscompartment.h
+++ b/js/src/jscompartment.h
@@ -3,26 +3,19 @@
  * 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 jscompartment_h
 #define jscompartment_h
 
 #include "mozilla/MemoryReporting.h"
-#include "mozilla/Util.h"
-
-#include "jscntxt.h"
-#include "jsgc.h"
-#include "jsobj.h"
 
 #include "gc/Zone.h"
 #include "vm/GlobalObject.h"
-#include "vm/RegExpObject.h"
-#include "vm/Shape.h"
 
 namespace js {
 
 namespace ion {
 class IonCompartment;
 }
 
 struct NativeIterator;
--- a/js/src/jscompartmentinlines.h
+++ b/js/src/jscompartmentinlines.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 jscompartmentinlines_h
 #define jscompartmentinlines_h
 
 #include "jscompartment.h"
 
-#include "jscntxtinlines.h"
-
 inline void
 JSCompartment::initGlobal(js::GlobalObject &global)
 {
     JS_ASSERT(global.compartment() == this);
     JS_ASSERT(!global_);
     global_ = &global;
 }
 
--- a/js/src/jscrashformat.h
+++ b/js/src/jscrashformat.h
@@ -2,18 +2,16 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 jscrashformat_h
 #define jscrashformat_h
 
-#include <string.h>
-
 namespace js {
 namespace crash {
 
 const static int crash_cookie_len = 16;
 const static char crash_cookie[crash_cookie_len] = "*J*S*CRASHDATA*";
 
 /* These values are used for CrashHeader::id. */
 enum {
--- a/js/src/jsdate.cpp
+++ b/js/src/jsdate.cpp
@@ -5,16 +5,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * JS date methods.
  */
 
 #include "jsdate.h"
 
+#include "js/Date.h"
+
 #include "mozilla/FloatingPoint.h"
 #include "mozilla/Util.h"
 
 /*
  * "For example, OS/360 devotes 26 bytes of the permanently
  *  resident date-turnover routine to the proper handling of
  *  December 31 on leap years (when it is Day 366).  That
  *  might have been left to the operator."
--- a/js/src/jsdate.h
+++ b/js/src/jsdate.h
@@ -6,28 +6,31 @@
 
 /*
  * JS Date class interface.
  */
 
 #ifndef jsdate_h
 #define jsdate_h
 
-#include "jsapi.h"
 #include "jstypes.h"
 
-#include "js/Date.h"
+#include "js/RootingAPI.h"
 
 extern "C" {
 class JSObject;
 struct JSContext;
 }
 
+namespace JS {
+class Value;
+}
+
 extern JSObject *
-js_InitDateClass(JSContext *cx, js::HandleObject obj);
+js_InitDateClass(JSContext *cx, JS::HandleObject obj);
 
 /*
  * These functions provide a C interface to the date/time object
  */
 
 /*
  * Construct a new Date Object from a time value given in milliseconds UTC
  * since the epoch.
@@ -61,11 +64,11 @@ js_DateGetHours(JSContext *cx, JSObject 
 extern JS_FRIEND_API(int)
 js_DateGetMinutes(JSContext *cx, JSObject *obj);
 
 extern JS_FRIEND_API(int)
 js_DateGetSeconds(JSObject *obj);
 
 /* Date constructor native. Exposed only so the JIT can know its address. */
 bool
-js_Date(JSContext *cx, unsigned argc, js::Value *vp);
+js_Date(JSContext *cx, unsigned argc, JS::Value *vp);
 
 #endif /* jsdate_h */
--- a/js/src/jsdbgapi.cpp
+++ b/js/src/jsdbgapi.cpp
@@ -13,16 +13,17 @@
 #include <string.h>
 
 #include "jsapi.h"
 #include "jscntxt.h"
 #include "jsfun.h"
 #include "jsgc.h"
 #include "jsobj.h"
 #include "jsopcode.h"
+#include "jsprf.h"
 #include "jsscript.h"
 #include "jsstr.h"
 #include "jstypes.h"
 #include "jswatchpoint.h"
 
 #include "frontend/SourceNotes.h"
 #include "jit/AsmJSModule.h"
 #include "vm/Debugger.h"
--- a/js/src/jsdtoa.h
+++ b/js/src/jsdtoa.h
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 jsdtoa_h
 #define jsdtoa_h
+
 /*
  * Public interface to portable double-precision floating point to string
  * and back conversion package.
  */
 
 #include <stddef.h>
 
 struct DtoaState;
--- a/js/src/jsexn.cpp
+++ b/js/src/jsexn.cpp
@@ -27,16 +27,17 @@
 
 #include "gc/Marking.h"
 #include "vm/ErrorObject.h"
 #include "vm/GlobalObject.h"
 #include "vm/StringBuffer.h"
 
 #include "jsfuninlines.h"
 #include "jsobjinlines.h"
+#include "jsscriptinlines.h"
 
 using namespace js;
 using namespace js::gc;
 using namespace js::types;
 
 using mozilla::ArrayLength;
 using mozilla::PodArrayZero;
 using mozilla::PodZero;
--- a/js/src/jsfriendapi.cpp
+++ b/js/src/jsfriendapi.cpp
@@ -19,16 +19,17 @@
 #include "jswrapper.h"
 #include "prmjtime.h"
 
 #include "builtin/TestingFunctions.h"
 #include "vm/WrapperObject.h"
 
 #include "jsfuninlines.h"
 #include "jsobjinlines.h"
+#include "jsscriptinlines.h"
 
 using namespace js;
 using namespace JS;
 
 using mozilla::PodArrayZero;
 
 // Required by PerThreadDataFriendFields::getMainThread()
 JS_STATIC_ASSERT(offsetof(JSRuntime, mainThread) ==
--- a/js/src/jsfriendapi.h
+++ b/js/src/jsfriendapi.h
@@ -2,17 +2,19 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 jsfriendapi_h
 #define jsfriendapi_h
 
+#ifdef JS_HAS_CTYPES
 #include "mozilla/MemoryReporting.h"
+#endif
 
 #include "jsclass.h"
 #include "jsbytecode.h"
 #include "jspubtd.h"
 
 #include "js/CallArgs.h"
 
 /*
--- a/js/src/jsfun.h
+++ b/js/src/jsfun.h
@@ -1,25 +1,24 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 jsfun_h
 #define jsfun_h
+
 /*
  * JS function definitions.
  */
 
 #include "jsobj.h"
 #include "jsscript.h"
 
-#include "gc/Barrier.h"
-
 namespace js {
 class FunctionExtended;
 
 typedef JSNative           Native;
 typedef JSParallelNative   ParallelNative;
 typedef JSThreadSafeNative ThreadSafeNative;
 }
 
--- a/js/src/jsfuninlines.h
+++ b/js/src/jsfuninlines.h
@@ -4,24 +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 jsfuninlines_h
 #define jsfuninlines_h
 
 #include "jsfun.h"
 
-#include "jsscript.h"
-
-#include "vm/GlobalObject.h"
-
-#include "jsobjinlines.h"
-
-#include "vm/ScopeObject-inl.h"
-#include "vm/String-inl.h"
+#include "vm/ScopeObject.h"
 
 inline void
 JSFunction::initAtom(JSAtom *atom)
 {
     atom_.init(atom);
 }
 
 inline void
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -8,16 +8,18 @@
 
 #include "jsgcinlines.h"
 
 #include "mozilla/DebugOnly.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Move.h"
 #include "mozilla/Util.h"
 
+#include "jsscriptinlines.h"
+
 using mozilla::Swap;
 
 /*
  * This code implements a mark-and-sweep garbage collector. The mark phase is
  * incremental. Most sweeping is done on a background thread. A GC is divided
  * into slices as follows:
  *
  * Slice 1: Roots pushed onto the mark stack. The mark stack is processed by
@@ -49,17 +51,16 @@ using mozilla::Swap;
 # include <unistd.h>
 #endif
 
 #include "jsapi.h"
 #include "jsatom.h"
 #include "jscntxt.h"
 #include "jscompartment.h"
 #include "jsobj.h"
-#include "jsproxy.h"
 #include "jsscript.h"
 #include "jstypes.h"
 #include "jsutil.h"
 #include "jswatchpoint.h"
 #include "jsweakmap.h"
 #ifdef XP_WIN
 # include "jswin.h"
 #endif
--- a/js/src/jsgc.h
+++ b/js/src/jsgc.h
@@ -6,28 +6,22 @@
 
 /* JS Garbage Collector. */
 
 #ifndef jsgc_h
 #define jsgc_h
 
 #include "mozilla/DebugOnly.h"
 #include "mozilla/MemoryReporting.h"
-#include "mozilla/Util.h"
 
-#include "jsalloc.h"
-#include "jsclass.h"
+#include "jsapi.h"
+#include "jsobj.h"
 #include "jslock.h"
-#include "jspubtd.h"
-#include "jsscript.h"
-#include "jstypes.h"
 
-#include "gc/Heap.h"
 #include "js/GCAPI.h"
-#include "js/HashTable.h"
 #include "js/Vector.h"
 
 class JSAtom;
 struct JSCompartment;
 class JSFunction;
 class JSFlatString;
 class JSLinearString;
 
@@ -35,23 +29,26 @@ namespace js {
 
 class ArgumentsObject;
 class ArrayBufferObject;
 class ArrayBufferViewObject;
 class BaseShape;
 class DebugScopeObject;
 class GCHelperThread;
 class GlobalObject;
+class LazyScript;
 class Nursery;
 class PropertyName;
 class ScopeObject;
 class Shape;
 class UnownedBaseShape;
 struct SliceBudget;
 
+unsigned GetCPUCount();
+
 enum HeapState {
     Idle,             // doing nothing with the GC heap
     Tracing,          // tracing the GC heap without collecting, e.g. IterateCompartments()
     MajorCollecting,  // doing a GC of the major heap
     MinorCollecting   // doing a GC of the minor heap (nursery)
 };
 
 namespace ion {
@@ -673,16 +670,18 @@ AddScriptRoot(JSContext *cx, JSScript **
 extern bool
 js_InitGC(JSRuntime *rt, uint32_t maxbytes);
 
 extern void
 js_FinishGC(JSRuntime *rt);
 
 namespace js {
 
+class StackFrame;
+
 extern void
 MarkCompartmentActive(js::StackFrame *fp);
 
 extern void
 TraceRuntime(JSTracer *trc);
 
 /* Must be called with GC lock taken. */
 extern void
--- a/js/src/jsgcinlines.h
+++ b/js/src/jsgcinlines.h
@@ -4,23 +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 jsgcinlines_h
 #define jsgcinlines_h
 
 #include "jsgc.h"
 
-#include "jscntxt.h"
-#include "jscompartment.h"
-#include "jslock.h"
-
-#include "js/RootingAPI.h"
-#include "vm/ForkJoin.h"
-#include "vm/Shape.h"
+#include "gc/Zone.h"
 
 namespace js {
 
 class Shape;
 
 /*
  * This auto class should be used around any code that might cause a mark bit to
  * be set on an object in a dead zone. See AutoMaybeTouchDeadZones
--- a/js/src/jsinfer.cpp
+++ b/js/src/jsinfer.cpp
@@ -11,19 +11,19 @@
 #include "mozilla/PodOperations.h"
 
 #ifdef __SUNPRO_CC
 #include <alloca.h>
 #endif
 
 #include "jsapi.h"
 #include "jscntxt.h"
-#include "jsfriendapi.h"
 #include "jsgc.h"
 #include "jsobj.h"
+#include "jsprf.h"
 #include "jsscript.h"
 #include "jsstr.h"
 #include "jsworkers.h"
 #include "prmjtime.h"
 
 #include "gc/Marking.h"
 #ifdef JS_ION
 #include "jit/BaselineJIT.h"
--- a/js/src/jsinfer.h
+++ b/js/src/jsinfer.h
@@ -6,25 +6,22 @@
 
 /* Definitions related to javascript type inference. */
 
 #ifndef jsinfer_h
 #define jsinfer_h
 
 #include "mozilla/MemoryReporting.h"
 
-#include "jsalloc.h"
 #include "jsfriendapi.h"
 
 #include "ds/LifoAlloc.h"
 #include "ds/IdValuePair.h"
 #include "gc/Barrier.h"
-#include "gc/Heap.h"
-#include "js/HashTable.h"
-#include "js/Vector.h"
+#include "js/Utility.h"
 
 class JSScript;
 
 namespace js {
 
 class TaggedProto
 {
   public:
--- a/js/src/jsinferinlines.h
+++ b/js/src/jsinferinlines.h
@@ -6,40 +6,30 @@
 
 /* Inline members for javascript type inference. */
 
 #ifndef jsinferinlines_h
 #define jsinferinlines_h
 
 #include "jsinfer.h"
 
-#include "mozilla/MathAlgorithms.h"
 #include "mozilla/PodOperations.h"
 
 #include "jsanalyze.h"
-#include "jsarray.h"
-#include "jscompartment.h"
-#include "jsprf.h"
-#include "jsproxy.h"
 
 #include "builtin/ParallelArray.h"
-#include "jit/IonFrames.h"
-#include "js/RootingAPI.h"
 #include "vm/ArrayObject.h"
 #include "vm/BooleanObject.h"
-#include "vm/GlobalObject.h"
 #include "vm/NumberObject.h"
 #include "vm/StringObject.h"
 #include "vm/TypedArrayObject.h"
 
 #include "jsanalyzeinlines.h"
 #include "jscntxtinlines.h"
 
-#include "gc/Barrier-inl.h"
-
 inline bool
 js::TaggedProto::isObject() const
 {
     /* Skip NULL and Proxy::LazyProto. */
     return uintptr_t(proto) > uintptr_t(Proxy::LazyProto);
 }
 
 inline bool
--- a/js/src/jslock.h
+++ b/js/src/jslock.h
@@ -4,33 +4,27 @@
  * 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 jslock_h
 #define jslock_h
 
 #ifdef JS_THREADSAFE
 
-# include "jsapi.h"
 # include "pratom.h"
 # include "prcvar.h"
 # include "prinit.h"
 # include "prlock.h"
 # include "prthread.h"
 
 # define JS_ATOMIC_INCREMENT(p)      PR_ATOMIC_INCREMENT((int32_t *)(p))
 # define JS_ATOMIC_DECREMENT(p)      PR_ATOMIC_DECREMENT((int32_t *)(p))
 # define JS_ATOMIC_ADD(p,v)          PR_ATOMIC_ADD((int32_t *)(p), (int32_t)(v))
 # define JS_ATOMIC_SET(p,v)          PR_ATOMIC_SET((int32_t *)(p), (int32_t)(v))
 
-namespace js {
-    // Defined in jsgc.cpp.
-    unsigned GetCPUCount();
-}
-
 #else  /* JS_THREADSAFE */
 
 typedef struct PRThread PRThread;
 typedef struct PRCondVar PRCondVar;
 typedef struct PRLock PRLock;
 
 # define JS_ATOMIC_INCREMENT(p)      (++*(p))
 # define JS_ATOMIC_DECREMENT(p)      (--*(p))
--- a/js/src/jsmemorymetrics.cpp
+++ b/js/src/jsmemorymetrics.cpp
@@ -11,22 +11,23 @@
 #include "jsapi.h"
 #include "jscompartment.h"
 #include "jsgc.h"
 #include "jsobj.h"
 #include "jsscript.h"
 
 #include "jit/BaselineJIT.h"
 #include "jit/Ion.h"
+#include "vm/ArrayObject.h"
 #include "vm/Runtime.h"
 #include "vm/Shape.h"
 #include "vm/WrapperObject.h"
 #include "vm/String.h"
 
-#include "jsobjinlines.h"
+#include "vm/ObjectImpl-inl.h"
 
 using mozilla::DebugOnly;
 using mozilla::Move;
 using mozilla::MoveRef;
 using mozilla::PodEqual;
 
 using namespace js;
 
--- a/js/src/jsnum.cpp
+++ b/js/src/jsnum.cpp
@@ -15,17 +15,19 @@
 #include "mozilla/RangedPtr.h"
 
 #ifdef XP_OS2
 #define _PC_53  PC_53
 #define _MCW_EM MCW_EM
 #define _MCW_PC MCW_PC
 #endif
 
+#ifdef HAVE_LOCALECONV
 #include <locale.h>
+#endif
 #include <math.h>
 #include <string.h>
 
 #include "double-conversion.h"
 #include "jsapi.h"
 #include "jsatom.h"
 #include "jscntxt.h"
 #include "jsdtoa.h"
--- a/js/src/jsnum.h
+++ b/js/src/jsnum.h
@@ -4,25 +4,27 @@
  * 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 jsnum_h
 #define jsnum_h
 
 #include "mozilla/FloatingPoint.h"
 
-#include "jscntxt.h"
+#include "jsapi.h"
 
 #include "vm/NumericConversions.h"
 
 extern double js_PositiveInfinity;
 extern double js_NegativeInfinity;
 
 namespace js {
 
+class StringBuffer;
+
 extern bool
 InitRuntimeNumberState(JSRuntime *rt);
 
 #if !ENABLE_INTL_API
 extern void
 FinishRuntimeNumberState(JSRuntime *rt);
 #endif
 
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -35,18 +35,18 @@
 #include "jsutil.h"
 #include "jswatchpoint.h"
 #include "jswrapper.h"
 
 #include "frontend/BytecodeCompiler.h"
 #include "gc/Marking.h"
 #include "jit/BaselineJIT.h"
 #include "js/MemoryMetrics.h"
+#include "vm/ArgumentsObject.h"
 #include "vm/Interpreter.h"
-#include "vm/RegExpStatics.h"
 #include "vm/RegExpStaticsObject.h"
 #include "vm/Shape.h"
 
 #include "jsatominlines.h"
 #include "jsboolinlines.h"
 #include "jscntxtinlines.h"
 #include "jscompartmentinlines.h"
 
--- a/js/src/jsobj.h
+++ b/js/src/jsobj.h
@@ -13,26 +13,18 @@
  * A JS object consists of a possibly-shared object descriptor containing
  * ordered property names, called the map; and a dense vector of property
  * values, called slots.  The map/slot pointer pair is GC'ed, while the map
  * is reference counted and the slot vector is malloc'ed.
  */
 
 #include "mozilla/MemoryReporting.h"
 
-#include "jsapi.h"
-#include "jsatom.h"
-#include "jsclass.h"
-#include "jsfriendapi.h"
-
-#include "gc/Barrier.h"
-#include "gc/Heap.h"
 #include "vm/ObjectImpl.h"
 #include "vm/Shape.h"
-#include "vm/String.h"
 
 namespace JS {
 struct ObjectsExtraSizes;
 }
 
 namespace js {
 
 class AutoPropDescArrayRooter;
--- a/js/src/jsobjinlines.h
+++ b/js/src/jsobjinlines.h
@@ -15,17 +15,16 @@
 #include "vm/Probes.h"
 #include "vm/ScopeObject.h"
 #include "vm/StringObject.h"
 
 #include "jsatominlines.h"
 #include "jscompartmentinlines.h"
 #include "jsinferinlines.h"
 
-#include "vm/ObjectImpl-inl.h"
 #include "vm/Shape-inl.h"
 
 /* static */ inline bool
 JSObject::setGenericAttributes(JSContext *cx, js::HandleObject obj,
                                js::HandleId id, unsigned *attrsp)
 {
     js::types::MarkTypePropertyConfigured(cx, obj, id);
     js::GenericAttributesOp op = obj->getOps()->setGenericAttributes;
--- a/js/src/json.cpp
+++ b/js/src/json.cpp
@@ -3,34 +3,33 @@
  * 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 "json.h"
 
 #include "mozilla/FloatingPoint.h"
 
-#include <string.h>
-
 #include "jsapi.h"
 #include "jsarray.h"
 #include "jsatom.h"
 #include "jscntxt.h"
 #include "jsnum.h"
 #include "jsobj.h"
 #include "jsonparser.h"
 #include "jsstr.h"
 #include "jstypes.h"
 #include "jsutil.h"
 
 #include "vm/Interpreter.h"
 #include "vm/StringBuffer.h"
 
 #include "jsatominlines.h"
 #include "jsboolinlines.h"
+#include "jsobjinlines.h"
 
 using namespace js;
 using namespace js::gc;
 using namespace js::types;
 
 using mozilla::IsFinite;
 using mozilla::Maybe;
 
--- a/js/src/json.h
+++ b/js/src/json.h
@@ -2,21 +2,23 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 json_h
 #define json_h
 
-#include "js/CharacterEncoding.h"
+#include "jsapi.h"
+
 #include "js/RootingAPI.h"
-#include "js/Value.h"
-#include "js/Vector.h"
-#include "vm/StringBuffer.h"
+
+namespace js {
+class StringBuffer;
+}
 
 extern JSObject *
 js_InitJSONClass(JSContext *cx, js::HandleObject obj);
 
 extern bool
 js_Stringify(JSContext *cx, js::MutableHandleValue vp, JSObject *replacer,
              js::Value space, js::StringBuffer &sb);
 
--- a/js/src/jsonparser.cpp
+++ b/js/src/jsonparser.cpp
@@ -3,16 +3,18 @@
  * 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 "jsonparser.h"
 
 #include "mozilla/RangedPtr.h"
 
+#include <ctype.h>
+
 #include "jsarray.h"
 #include "jscompartment.h"
 #include "jsnum.h"
 
 #include "vm/StringBuffer.h"
 
 #include "jsobjinlines.h"
 
--- a/js/src/jsopcode.cpp
+++ b/js/src/jsopcode.cpp
@@ -7,16 +7,17 @@
 /*
  * JS bytecode descriptors, disassemblers, and (expression) decompilers.
  */
 
 #include "jsopcodeinlines.h"
 
 #include "mozilla/Util.h"
 
+#include <ctype.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <string.h>
 
 #include "jsanalyze.h"
 #include "jsapi.h"
 #include "jsatom.h"
 #include "jsautooplen.h"
--- a/js/src/jsopcode.h
+++ b/js/src/jsopcode.h
@@ -6,22 +6,18 @@
 
 #ifndef jsopcode_h
 #define jsopcode_h
 
 /*
  * JS bytecode definitions.
  */
 
-#include <stddef.h>
-
 #include "jsapi.h"
 #include "jsbytecode.h"
-#include "jspubtd.h"
-#include "jsutil.h"
 
 #include "frontend/SourceNotes.h"
 
 /*
  * JS operation bytecodes.
  */
 typedef enum JSOp {
 #define OPDEF(op,val,name,token,length,nuses,ndefs,format) \
--- a/js/src/jsopcodeinlines.h
+++ b/js/src/jsopcodeinlines.h
@@ -4,17 +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 jsopcodeinlines_h
 #define jsopcodeinlines_h
 
 #include "jsopcode.h"
 
-#include "jsautooplen.h"
 #include "jsscript.h"
 
 namespace js {
 
 static inline unsigned
 GetDefCount(JSScript *script, unsigned offset)
 {
     JS_ASSERT(offset < script->length);
--- a/js/src/jsprf.h
+++ b/js/src/jsprf.h
@@ -21,17 +21,16 @@
 **      %hs - ucs2 string
 **      %c - character
 **      %p - pointer (deals with machine dependent pointer size)
 **      %f - float
 **      %g - float
 */
 
 #include <stdarg.h>
-#include <stdio.h>
 
 #include "jstypes.h"
 
 /*
 ** sprintf into a fixed size buffer. Guarantees that a NUL is at the end
 ** of the buffer. Returns the length of the written output, NOT including
 ** the NUL, or (uint32_t)-1 if an error occurs.
 */
--- a/js/src/jspropertytree.h
+++ b/js/src/jspropertytree.h
@@ -3,19 +3,19 @@
  * 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 jspropertytree_h
 #define jspropertytree_h
 
 #include "jsalloc.h"
+#include "jspubtd.h"
 
 #include "js/HashTable.h"
-#include "js/RootingAPI.h"
 
 namespace js {
 
 class Shape;
 struct StackShape;
 
 struct ShapeHasher {
     typedef Shape *Key;
--- a/js/src/jsprototypes.h
+++ b/js/src/jsprototypes.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/. */
 
 /* A higher-order macro for enumerating all JSProtoKey values. */
 
 #ifndef jsprototypes_h
 #define jsprototypes_h
 
-#include "jsversion.h"
-
 /*
  * Enumerator codes in the second column must not change -- they are part of
  * the JS XDR API.  Also note the symbols in the third column are extern "C";
  * clients should use extern "C" {} as appropriate when using this macro.
  */
 
 #define JS_FOR_EACH_PROTOTYPE(macro) \
     macro(Null,                   0,     js_InitNullClass) \
--- a/js/src/jspubtd.h
+++ b/js/src/jspubtd.h
@@ -10,16 +10,17 @@
 /*
  * JS public API typedefs.
  */
 
 #include "mozilla/PodOperations.h"
 
 #include "jsprototypes.h"
 #include "jstypes.h"
+#include "jsversion.h"  // #include here so it's seen everywhere
 
 #if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING) || defined(DEBUG)
 # define JSGC_TRACK_EXACT_ROOTS
 #endif
 
 namespace JS {
 
 /*
--- a/js/src/jsreflect.h
+++ b/js/src/jsreflect.h
@@ -5,20 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * JS reflection package.
  */
 #ifndef jsreflect_h
 #define jsreflect_h
 
-#include <stdlib.h>
-
-#include "jspubtd.h"
-
 namespace js {
 
 enum ASTType {
     AST_ERROR = -1,
 #define ASTDEF(ast, str, method) ast,
 #include "jsast.tbl"
 #undef ASTDEF
     AST_LIMIT
--- a/js/src/jsscript.cpp
+++ b/js/src/jsscript.cpp
@@ -21,19 +21,21 @@
 #include "jsdbgapi.h"
 #include "jsfun.h"
 #include "jsgc.h"
 #include "jsopcode.h"
 #include "jstypes.h"
 #include "jsutil.h"
 
 #include "frontend/BytecodeEmitter.h"
+#include "frontend/SharedContext.h"
 #include "gc/Marking.h"
 #include "jit/BaselineJIT.h"
 #include "jit/IonCode.h"
+#include "vm/ArgumentsObject.h"
 #include "vm/Debugger.h"
 #include "vm/Interpreter.h"
 #include "vm/Shape.h"
 #include "vm/Xdr.h"
 
 #include "jsfuninlines.h"
 #include "jsinferinlines.h"
 
--- a/js/src/jsscript.h
+++ b/js/src/jsscript.h
@@ -7,23 +7,24 @@
 /* JS script descriptor. */
 
 #ifndef jsscript_h
 #define jsscript_h
 
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/PodOperations.h"
 
-#include "jsdbgapi.h"
-#include "jsinfer.h"
+#include "jsatom.h"
+#ifdef JS_THREADSAFE
+#include "jslock.h"
+#endif
 #include "jsobj.h"
 #include "jsopcode.h"
 
 #include "gc/Barrier.h"
-#include "js/RootingAPI.h"
 #include "vm/Shape.h"
 
 namespace js {
 
 namespace ion {
     struct IonScript;
     struct BaselineScript;
     struct IonScriptCounts;
--- a/js/src/jsscriptinlines.h
+++ b/js/src/jsscriptinlines.h
@@ -4,25 +4,18 @@
  * 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 jsscriptinlines_h
 #define jsscriptinlines_h
 
 #include "jsscript.h"
 
-#include "jsautooplen.h"
-#include "jscntxt.h"
-#include "jsfun.h"
-#include "jsopcode.h"
-
 #include "jit/AsmJSLink.h"
-#include "vm/GlobalObject.h"
-#include "vm/RegExpObject.h"
-#include "vm/Shape.h"
+#include "vm/ScopeObject.h"
 
 #include "jscompartmentinlines.h"
 
 #include "vm/Shape-inl.h"
 
 namespace js {
 
 inline
--- a/js/src/jsstr.cpp
+++ b/js/src/jsstr.cpp
@@ -10,49 +10,47 @@
  * In order to avoid unnecessary js_LockGCThing/js_UnlockGCThing calls, these
  * native methods store strings (possibly newborn) converted from their 'this'
  * parameter and arguments on the stack: 'this' conversions at argv[-1], arg
  * conversions at their index (argv[0], argv[1]).  This is a legitimate method
  * of rooting things that might lose their newborn root due to subsequent GC
  * allocations in the same native method.
  */
 
-#include "jsstrinlines.h"
+#include "jsstr.h"
 
 #include "mozilla/Attributes.h"
 #include "mozilla/CheckedInt.h"
 #include "mozilla/FloatingPoint.h"
 #include "mozilla/PodOperations.h"
 
-#include <stdlib.h>
+#include <ctype.h>
 #include <string.h>
 
 #include "jsapi.h"
 #include "jsarray.h"
 #include "jsatom.h"
 #include "jsautooplen.h"
 #include "jsbool.h"
 #include "jscntxt.h"
 #include "jsgc.h"
 #include "jsnum.h"
 #include "jsobj.h"
 #include "jsopcode.h"
-#include "jsprf.h"
 #include "jstypes.h"
 #include "jsutil.h"
 #include "jsversion.h"
 
 #include "builtin/RegExp.h"
 #include "vm/GlobalObject.h"
 #include "vm/Interpreter.h"
 #include "vm/NumericConversions.h"
 #include "vm/RegExpObject.h"
 #include "vm/RegExpStatics.h"
 #include "vm/ScopeObject.h"
-#include "vm/Shape.h"
 #include "vm/StringBuffer.h"
 
 #include "jsinferinlines.h"
 
 #include "vm/Interpreter-inl.h"
 #include "vm/String-inl.h"
 #include "vm/StringObject-inl.h"
 
@@ -1086,16 +1084,66 @@ static const size_t sRopeMatchThresholdR
 
 bool
 js::StringHasPattern(const jschar *text, uint32_t textlen,
                      const jschar *pat, uint32_t patlen)
 {
     return StringMatch(text, textlen, pat, patlen) != -1;
 }
 
+// When an algorithm does not need a string represented as a single linear
+// array of characters, this range utility may be used to traverse the string a
+// sequence of linear arrays of characters. This avoids flattening ropes.
+class StringSegmentRange
+{
+    // If malloc() shows up in any profiles from this vector, we can add a new
+    // StackAllocPolicy which stashes a reusable freed-at-gc buffer in the cx.
+    AutoStringVector stack;
+    Rooted<JSLinearString*> cur;
+
+    bool settle(JSString *str) {
+        while (str->isRope()) {
+            JSRope &rope = str->asRope();
+            if (!stack.append(rope.rightChild()))
+                return false;
+            str = rope.leftChild();
+        }
+        cur = &str->asLinear();
+        return true;
+    }
+
+  public:
+    StringSegmentRange(JSContext *cx)
+      : stack(cx), cur(cx)
+    {}
+
+    JS_WARN_UNUSED_RESULT bool init(JSString *str) {
+        JS_ASSERT(stack.empty());
+        return settle(str);
+    }
+
+    bool empty() const {
+        return cur == NULL;
+    }
+
+    JSLinearString *front() const {
+        JS_ASSERT(!cur->isRope());
+        return cur;
+    }
+
+    JS_WARN_UNUSED_RESULT bool popFront() {
+        JS_ASSERT(!empty());
+        if (stack.empty()) {
+            cur = NULL;
+            return true;
+        }
+        return settle(stack.popCopy());
+    }
+};
+
 /*
  * RopeMatch takes the text to search and the pattern to search for in the text.
  * RopeMatch returns false on OOM and otherwise returns the match index through
  * the 'match' outparam (-1 for not found).
  */
 static bool
 RopeMatch(JSContext *cx, JSString *textstr, const jschar *pat, uint32_t patlen, int *match)
 {
@@ -1929,16 +1977,39 @@ js::str_search(JSContext *cx, unsigned a
     if (status == RegExpRunStatus_Success)
         res->updateLazily(cx, linearStr, &g.regExp(), 0);
 
     JS_ASSERT_IF(status == RegExpRunStatus_Success_NotFound, match.start == -1);
     args.rval().setInt32(match.start);
     return true;
 }
 
+// Utility for building a rope (lazy concatenation) of strings.
+class RopeBuilder {
+    JSContext *cx;
+    RootedString res;
+
+    RopeBuilder(const RopeBuilder &other) MOZ_DELETE;
+    void operator=(const RopeBuilder &other) MOZ_DELETE;
+
+  public:
+    RopeBuilder(JSContext *cx)
+      : cx(cx), res(cx, cx->runtime()->emptyString)
+    {}
+
+    inline bool append(HandleString str) {
+        res = ConcatStrings<CanGC>(cx, res, str);
+        return !!res;
+    }
+
+    inline JSString *result() {
+        return res;
+    }
+};
+
 struct ReplaceData
 {
     ReplaceData(JSContext *cx)
       : str(cx), g(cx), lambda(cx), elembase(cx), repstr(cx),
         dollarRoot(cx, &dollar), dollarEndRoot(cx, &dollarEnd),
         fig(cx, NullValue()), sb(cx)
     {}
 
--- a/js/src/jsstr.h
+++ b/js/src/jsstr.h
@@ -2,51 +2,35 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 jsstr_h
 #define jsstr_h
 
+#include "mozilla/HashFunctions.h"
 #include "mozilla/PodOperations.h"
 
-#include <ctype.h>
-
 #include "jsapi.h"
-#include "jsatom.h"
-#include "jslock.h"
 #include "jsutil.h"
 
-#include "js/HashTable.h"
+#include "js/RootingAPI.h"
 #include "vm/Unicode.h"
 
 class JSFlatString;
 class JSLinearString;
 class JSStableString;
 
 namespace js {
 
 class StringBuffer;
 
-/*
- * When an algorithm does not need a string represented as a single linear
- * array of characters, this range utility may be used to traverse the string a
- * sequence of linear arrays of characters. This avoids flattening ropes.
- *
- * Implemented in jsstrinlines.h.
- */
-class StringSegmentRange;
 class MutatingRopeSegmentRange;
 
-/*
- * Utility for building a rope (lazy concatenation) of strings.
- */
-class RopeBuilder;
-
 template <AllowGC allowGC>
 extern JSString *
 ConcatStrings(ThreadSafeContext *cx,
               typename MaybeRooted<JSString*, allowGC>::HandleType left,
               typename MaybeRooted<JSString*, allowGC>::HandleType right);
 
 // Return s advanced past any Unicode white space characters.
 static inline const jschar *
deleted file mode 100644
--- a/js/src/jsstrinlines.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * vim: set ts=8 sts=4 et sw=4 tw=99:
- * 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 jsstrinlines_h
-#define jsstrinlines_h
-
-#include "jsstr.h"
-
-#include "mozilla/Attributes.h"
-
-#include "jsatom.h"
-
-#include "jscntxtinlines.h"
-#include "jsgcinlines.h"
-
-#include "vm/String-inl.h"
-
-namespace js {
-
-class RopeBuilder {
-    JSContext *cx;
-    RootedString res;
-
-    RopeBuilder(const RopeBuilder &other) MOZ_DELETE;
-    void operator=(const RopeBuilder &other) MOZ_DELETE;
-
-  public:
-    RopeBuilder(JSContext *cx)
-      : cx(cx), res(cx, cx->runtime()->emptyString)
-    {}
-
-    inline bool append(HandleString str) {
-        res = ConcatStrings<CanGC>(cx, res, str);
-        return !!res;
-    }
-
-    inline JSString *result() {
-        return res;
-    }
-};
-
-class StringSegmentRange
-{
-    /*
-     * If malloc() shows up in any profiles from this vector, we can add a new
-     * StackAllocPolicy which stashes a reusable freed-at-gc buffer in the cx.
-     */
-    AutoStringVector stack;
-    Rooted<JSLinearString*> cur;
-
-    bool settle(JSString *str) {
-        while (str->isRope()) {
-            JSRope &rope = str->asRope();
-            if (!stack.append(rope.rightChild()))
-                return false;
-            str = rope.leftChild();
-        }
-        cur = &str->asLinear();
-        return true;
-    }
-
-  public:
-    StringSegmentRange(JSContext *cx)
-      : stack(cx), cur(cx)
-    {}
-
-    JS_WARN_UNUSED_RESULT bool init(JSString *str) {
-        JS_ASSERT(stack.empty());
-        return settle(str);
-    }
-
-    bool empty() const {
-        return cur == NULL;
-    }
-
-    JSLinearString *front() const {
-        JS_ASSERT(!cur->isRope());
-        return cur;
-    }
-
-    JS_WARN_UNUSED_RESULT bool popFront() {
-        JS_ASSERT(!empty());
-        if (stack.empty()) {
-            cur = NULL;
-            return true;
-        }
-        return settle(stack.popCopy());
-    }
-};
-
-}  /* namespace js */
-
-#endif /* jsstrinlines_h */
--- a/js/src/jstypes.h
+++ b/js/src/jstypes.h
@@ -17,17 +17,17 @@
 ** and take the following steps only in those C files, we take steps once here
 ** for all C files.
 **/
 
 #ifndef jstypes_h
 #define jstypes_h
 
 #include "mozilla/Attributes.h"
-#include "mozilla/Util.h"
+#include "mozilla/Types.h"
 
 #include "js-config.h"
 
 /***********************************************************************
 ** MACROS:      JS_EXTERN_API
 **              JS_EXPORT_API
 ** DESCRIPTION:
 **      These are only for externally visible routines and globals.  For
--- a/js/src/jsutil.h
+++ b/js/src/jsutil.h
@@ -6,17 +6,16 @@
 
 /*
  * PR assertion checker.
  */
 
 #ifndef jsutil_h
 #define jsutil_h
 
-#include "mozilla/Attributes.h"
 #include "mozilla/Compiler.h"
 #include "mozilla/GuardObjects.h"
 
 #ifdef USE_ZLIB
 #include <zlib.h>
 #endif
 
 #include "js/Utility.h"
--- a/js/src/jswatchpoint.cpp
+++ b/js/src/jswatchpoint.cpp
@@ -3,16 +3,17 @@
  * 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 "jswatchpoint.h"
 
 #include "jsatom.h"
 #include "jscompartment.h"
+#include "jsfriendapi.h"
 
 #include "gc/Marking.h"
 
 #include "jsgcinlines.h"
 
 #include "gc/Barrier-inl.h"
 #include "vm/ObjectImpl-inl.h"
 
--- a/js/src/jswatchpoint.h
+++ b/js/src/jswatchpoint.h
@@ -3,25 +3,26 @@
  * 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 jswatchpoint_h
 #define jswatchpoint_h
 
 #include "jsalloc.h"
+#include "jsdbgapi.h"
 #include "jsapi.h"
-#include "jsdbgapi.h"
-#include "jsfriendapi.h"
 
 #include "gc/Barrier.h"
 #include "js/HashTable.h"
 
 namespace js {
 
+struct WeakMapTracer;
+
 struct WatchKey {
     WatchKey() {}
     WatchKey(JSObject *obj, jsid id) : object(obj), id(id) {}
     WatchKey(const WatchKey &key) : object(key.object.get()), id(key.id.get()) {}
     EncapsulatedPtrObject object;
     EncapsulatedId id;
 
     bool operator!=(const WatchKey &other) const {
--- a/js/src/jsweakcache.h
+++ b/js/src/jsweakcache.h
@@ -2,21 +2,19 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 jsweakcache_h
 #define jsweakcache_h
 
-#include "jsapi.h"
-#include "jscntxt.h"
-#include "jsobj.h"
+#include "gc/Marking.h"
 
-#include "gc/Marking.h"
+#include "js/HashTable.h"
 
 namespace js {
 
 // A WeakCache is used to map a key to a value similar to an HashMap except
 // that its entries are garbage collected.  An entry is kept as long as
 // both the key and value are marked.
 //
 // No mark function is provided with this weak container.  However, this weak
--- a/js/src/jsworkers.cpp
+++ b/js/src/jsworkers.cpp
@@ -1,38 +1,32 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 "jsworkers.h"
 
+#ifdef JS_WORKER_THREADS
 #include "mozilla/DebugOnly.h"
 
 #include "prmjtime.h"
 
 #include "frontend/BytecodeCompiler.h"
-
-#ifdef JS_WORKER_THREADS
-# include "jit/ExecutionModeInlines.h"
-# include "jit/IonBuilder.h"
-#endif
+#include "jit/ExecutionModeInlines.h"
+#include "jit/IonBuilder.h"
 
 #include "jscntxtinlines.h"
 #include "jscompartmentinlines.h"
 
-#include "vm/ObjectImpl-inl.h"
-
 using namespace js;
 
 using mozilla::DebugOnly;
 
-#ifdef JS_WORKER_THREADS
-
 bool
 js::EnsureWorkerThreadsInitialized(JSRuntime *rt)
 {
     if (rt->workerThreadState)
         return true;
 
     rt->workerThreadState = rt->new_<WorkerThreadState>();
     if (!rt->workerThreadState)
@@ -669,16 +663,18 @@ WorkerThread::pause()
     while (state.shouldPause)
         state.wait(WorkerThreadState::WORKER);
 
     state.numPaused--;
 }
 
 #else /* JS_WORKER_THREADS */
 
+using namespace js;
+
 bool
 js::StartOffThreadAsmJSCompile(JSContext *cx, AsmJSParallelTask *asmData)
 {
     MOZ_ASSUME_UNREACHABLE("Off thread compilation not available in non-THREADSAFE builds");
 }
 
 bool
 js::StartOffThreadIonCompile(JSContext *cx, ion::IonBuilder *builder)
--- a/js/src/perf/pm_linux.cpp
+++ b/js/src/perf/pm_linux.cpp
@@ -10,18 +10,16 @@
 
 #include <errno.h>
 #include <linux/perf_event.h>
 #include <string.h>
 #include <sys/ioctl.h>
 #include <sys/syscall.h>
 #include <unistd.h>
 
-#include "jsutil.h"
-
 #include "perf/jsperf.h"
 
 using namespace js;
 
 // As of July 2010, this system call has not been added to the
 // C library, so we have to provide our own wrapper function.
 // If this code runs on a kernel that does not implement the
 // system call (2.6.30 or older) nothing unpredictable will
--- a/js/src/prmjtime.cpp
+++ b/js/src/prmjtime.cpp
@@ -11,18 +11,16 @@
 #include "mozilla/MathAlgorithms.h"
 
 #ifdef SOLARIS
 #define _REENTRANT 1
 #endif
 #include <string.h>
 #include <time.h>
 
-#include "jslock.h"
-#include "jsprf.h"
 #include "jstypes.h"
 #include "jsutil.h"
 
 #define PRMJ_DO_MILLISECONDS 1
 
 #ifdef XP_OS2
 #include <sys/timeb.h>
 #endif
--- a/js/src/prmjtime.h
+++ b/js/src/prmjtime.h
@@ -2,18 +2,18 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 prmjtime_h
 #define prmjtime_h
 
+#include <stddef.h>
 #include <stdint.h>
-#include <time.h>
 
 /*
  * Broken down form of 64 bit time value.
  */
 struct PRMJTime {
     int32_t tm_usec;            /* microseconds of second (0-999999) */
     int8_t tm_sec;              /* seconds of minute (0-59) */
     int8_t tm_min;              /* minutes of hour (0-59) */
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -32,17 +32,19 @@
 #include "jsarray.h"
 #include "jsatom.h"
 #include "jscntxt.h"
 #include "jsdate.h"
 #include "jsdbgapi.h"
 #include "jsfun.h"
 #include "jsgc.h"
 #include "jsiter.h"
+#ifdef JS_THREADSAFE
 #include "jslock.h"
+#endif
 #include "jsnum.h"
 #include "jsobj.h"
 #include "json.h"
 #include "jsprf.h"
 #include "jsreflect.h"
 #include "jsscript.h"
 #include "jstypes.h"
 #include "jsutil.h"
@@ -62,16 +64,17 @@
 #include "jit/Ion.h"
 #include "perf/jsperf.h"
 #include "shell/jsheaptools.h"
 #include "shell/jsoptparse.h"
 #include "vm/Shape.h"
 #include "vm/TypedArrayObject.h"
 #include "vm/WrapperObject.h"
 
+#include "jsfuninlines.h"
 #include "jsinferinlines.h"
 #include "jsscriptinlines.h"
 
 #include "vm/Interpreter-inl.h"
 
 #ifdef XP_WIN
 # define PATH_MAX (MAX_PATH > _MAX_DIR ? MAX_PATH : _MAX_DIR)
 #else
--- a/js/src/vm/ArgumentsObject-inl.h
+++ b/js/src/vm/ArgumentsObject-inl.h
@@ -4,19 +4,19 @@
  * 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_ArgumentsObject_inl_h
 #define vm_ArgumentsObject_inl_h
 
 #include "vm/ArgumentsObject.h"
 
-#include "mozilla/MemoryReporting.h"
+#include "vm/ScopeObject.h"
 
-#include "vm/ScopeObject.h"
+#include "jsscriptinlines.h"
 
 #include "vm/ScopeObject-inl.h"
 
 namespace js {
 
 inline const Value &
 ArgumentsObject::element(uint32_t i) const
 {
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -12,21 +12,24 @@
 #include "jsnum.h"
 #include "jsobj.h"
 #include "jswrapper.h"
 
 #include "frontend/BytecodeCompiler.h"
 #include "gc/Marking.h"
 #include "jit/BaselineJIT.h"
 #include "js/Vector.h"
+#include "vm/ArgumentsObject.h"
 #include "vm/WrapperObject.h"
 
 #include "jsfuninlines.h"
 #include "jsgcinlines.h"
+#include "jsobjinlines.h"
 #include "jsopcodeinlines.h"
+#include "jsscriptinlines.h"
 
 #include "vm/Stack-inl.h"
 
 using namespace js;
 
 using js::frontend::IsIdentifier;
 using mozilla::ArrayLength;
 using mozilla::Maybe;
--- a/js/src/vm/ForkJoin.h
+++ b/js/src/vm/ForkJoin.h
@@ -3,20 +3,18 @@
  * 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_ForkJoin_h
 #define vm_ForkJoin_h
 
 #include "jscntxt.h"
-#include "jsgc.h"
 
 #include "jit/Ion.h"
-#include "vm/ThreadPool.h"
 
 ///////////////////////////////////////////////////////////////////////////
 // Read Me First
 //
 // The ForkJoin abstraction:
 // -------------------------
 //
 // This is the building block for executing multi-threaded JavaScript with
--- a/js/src/vm/GlobalObject-inl.h
+++ b/js/src/vm/GlobalObject-inl.h
@@ -4,17 +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 vm_GlobalObject_inl_h
 #define vm_GlobalObject_inl_h
 
 #include "vm/GlobalObject.h"
 
-#include "gc/Barrier-inl.h"
 #include "vm/ObjectImpl-inl.h"
 
 namespace js {
 
 inline void
 GlobalObject::setDetailsForKey(JSProtoKey key, JSObject *ctor, JSObject *proto)
 {
     JS_ASSERT(getSlotRef(key).isUndefined());
--- a/js/src/vm/GlobalObject.cpp
+++ b/js/src/vm/GlobalObject.cpp
@@ -19,16 +19,17 @@
 #include "builtin/MapObject.h"
 #include "builtin/Object.h"
 #include "builtin/RegExp.h"
 #include "vm/RegExpStatics.h"
 
 #include "jscompartmentinlines.h"
 #include "jsfuninlines.h"
 #include "jsobjinlines.h"
+#include "jsscriptinlines.h"
 
 using namespace js;
 
 JSObject *
 js_InitObjectClass(JSContext *cx, HandleObject obj)
 {
     JS_ASSERT(obj->isNative());
 
--- a/js/src/vm/Interpreter-inl.h
+++ b/js/src/vm/Interpreter-inl.h
@@ -5,31 +5,29 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef vm_Interpreter_inl_h
 #define vm_Interpreter_inl_h
 
 #include "vm/Interpreter.h"
 
 #include "jsapi.h"
-#include "jsbool.h"
 #include "jscompartment.h"
 #include "jsinfer.h"
-#include "jslibmath.h"
 #include "jsnum.h"
 #include "jsstr.h"
 
 #include "jit/Ion.h"
 #include "jit/IonCompartment.h"
+#include "vm/ArgumentsObject.h"
 #include "vm/ForkJoin.h"
 
 #include "jsatominlines.h"
-#include "jsfuninlines.h"
+#include "jsobjinlines.h"
 #include "jsinferinlines.h"
-#include "jsopcodeinlines.h"
 
 #include "vm/GlobalObject-inl.h"
 #include "vm/Stack-inl.h"
 
 namespace js {
 
 inline bool
 ComputeThis(JSContext *cx, AbstractFramePtr frame)
--- a/js/src/vm/Interpreter.cpp
+++ b/js/src/vm/Interpreter.cpp
@@ -20,16 +20,17 @@
 #include "jsarray.h"
 #include "jsatom.h"
 #include "jsautooplen.h"
 #include "jscntxt.h"
 #include "jsdbgapi.h"
 #include "jsfun.h"
 #include "jsgc.h"
 #include "jsiter.h"
+#include "jslibmath.h"
 #include "jsnum.h"
 #include "jsobj.h"
 #include "jsopcode.h"
 #include "jsprf.h"
 #include "jsscript.h"
 #include "jsstr.h"
 #if JS_TRACE_LOGGING
 #include "TraceLogging.h"
@@ -38,21 +39,23 @@
 #include "builtin/Eval.h"
 #include "jit/BaselineJIT.h"
 #include "jit/Ion.h"
 #include "vm/Debugger.h"
 #include "vm/Shape.h"
 
 #include "jsatominlines.h"
 #include "jsboolinlines.h"
+#include "jsfuninlines.h"
 #include "jsinferinlines.h"
 #include "jsscriptinlines.h"
 
 #include "jit/IonFrames-inl.h"
 #include "vm/Probes-inl.h"
+#include "vm/ScopeObject-inl.h"
 #include "vm/Stack-inl.h"
 
 using namespace js;
 using namespace js::gc;
 using namespace js::types;
 
 using mozilla::DebugOnly;
 using mozilla::PodCopy;
--- a/js/src/vm/Monitor.h
+++ b/js/src/vm/Monitor.h
@@ -2,20 +2,26 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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_Monitor_h
 #define vm_Monitor_h
 
+#ifdef JS_THREADSAFE
+#include "mozilla/DebugOnly.h"
+#endif
+
 #include <stddef.h>
 
 #include "jslock.h"
 
+#include "js/Utility.h"
+
 namespace js {
 
 // A base class used for types intended to be used in a parallel
 // fashion, such as the workers in the |ThreadPool| class.  Combines a
 // lock and a condition variable.  You can acquire the lock or signal
 // the condition variable using the |AutoLockMonitor| type.
 
 class Monitor
--- a/js/src/vm/ObjectImpl-inl.h
+++ b/js/src/vm/ObjectImpl-inl.h
@@ -6,23 +6,20 @@
 
 #ifndef vm_ObjectImpl_inl_h
 #define vm_ObjectImpl_inl_h
 
 #include "vm/ObjectImpl.h"
 
 #include "mozilla/Assertions.h"
 
-#include "jscompartment.h"
 #include "jsgc.h"
 #include "jsproxy.h"
 
-#include "gc/Heap.h"
 #include "gc/Marking.h"
-#include "vm/Interpreter.h"
 #include "vm/ProxyObject.h"
 
 #include "gc/Barrier-inl.h"
 
 inline JSCompartment *
 js::ObjectImpl::compartment() const
 {
     return lastProperty()->base()->compartment();
--- a/js/src/vm/RegExpObject-inl.h
+++ b/js/src/vm/RegExpObject-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 vm_RegExpObject_inl_h
 #define vm_RegExpObject_inl_h
 
 #include "vm/RegExpObject.h"
 
-#include "mozilla/Util.h"
-
 namespace js {
 
 inline void
 RegExpObject::setShared(ExclusiveContext *cx, RegExpShared &shared)
 {
     shared.prepareForUse(cx);
     JSObject::setPrivate(&shared);
 }
--- a/js/src/vm/Runtime-inl.h
+++ b/js/src/vm/Runtime-inl.h
@@ -5,32 +5,23 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef vm_Runtime_inl_h
 #define vm_Runtime_inl_h
 
 #include "vm/Runtime.h"
 
 #include "jscompartment.h"
-#include "jsfriendapi.h"
-#include "jsgc.h"
-#include "jsiter.h"
 #include "jsworkers.h"
 
-#include "builtin/Object.h" // For js::obj_construct
-#include "frontend/ParseMaps.h"
-#include "jit/IonFrames.h" // For GetPcScript
-#include "vm/Interpreter.h"
+#include "jit/IonFrames.h"
 #include "vm/Probes.h"
-#include "vm/RegExpObject.h"
 
 #include "jsgcinlines.h"
 
-#include "vm/ObjectImpl-inl.h"
-
 namespace js {
 
 inline bool
 NewObjectCache::lookupProto(Class *clasp, JSObject *proto, gc::AllocKind kind, EntryIndex *pentry)
 {
     JS_ASSERT(!proto->is<GlobalObject>());
     return lookup(clasp, proto, kind, pentry);
 }
--- a/js/src/vm/Runtime.h
+++ b/js/src/vm/Runtime.h
@@ -6,52 +6,54 @@
 
 #ifndef vm_Runtime_h
 #define vm_Runtime_h
 
 #include "mozilla/Atomics.h"
 #include "mozilla/LinkedList.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/PodOperations.h"
-#include "mozilla/TemplateLib.h"
 #include "mozilla/ThreadLocal.h"
 
 #include <setjmp.h>
-#include <string.h>
 
-#include "jsapi.h"
 #include "jsatom.h"
 #include "jsclist.h"
-#include "jsfriendapi.h"
 #include "jsgc.h"
 #include "jsproxy.h"
+#include "jsscript.h"
 
 #include "ds/FixedSizeHash.h"
-#include "ds/LifoAlloc.h"
 #include "frontend/ParseMaps.h"
 #include "gc/Nursery.h"
 #include "gc/Statistics.h"
 #include "gc/StoreBuffer.h"
+#ifdef XP_MACOSX
 #include "jit/AsmJSSignalHandlers.h"
+#endif
 #include "js/HashTable.h"
 #include "js/Vector.h"
+#include "vm/CommonPropertyNames.h"
 #include "vm/DateTime.h"
 #include "vm/SPSProfiler.h"
 #include "vm/Stack.h"
 #include "vm/ThreadPool.h"
 
 #ifdef _MSC_VER
 #pragma warning(push)
 #pragma warning(disable:4100) /* Silence unreferenced formal parameter warnings */
 #pragma warning(push)
 #pragma warning(disable:4355) /* Silence warning about "this" used in base member initializer list */
 #endif
 
 namespace js {
 
+class PerThreadData;
+class ThreadSafeContext;
+
 /* Thread Local Storage slot for storing the runtime for a thread. */
 extern mozilla::ThreadLocal<PerThreadData*> TlsPerThreadData;
 
 } // namespace js
 
 struct DtoaState;
 
 extern void
@@ -66,23 +68,26 @@ js_ReportOverRecursed(js::ThreadSafeCont
 namespace JSC { class ExecutableAllocator; }
 
 namespace WTF { class BumpPointerAllocator; }
 
 namespace js {
 
 typedef Rooted<JSLinearString*> RootedLinearString;
 
+class Activation;
+class ActivationIterator;
 class AsmJSActivation;
 class InterpreterFrames;
 class MathCache;
 class WorkerThreadState;
 
 namespace ion {
 class IonRuntime;
+class JitActivation;
 struct PcScriptCache;
 }
 
 /*
  * GetSrcNote cache to avoid O(n^2) growth in finding a source note for a
  * given pc in a script. We use the script->code pointer to tag the cache,
  * instead of the script address itself, so that source notes are always found
  * by offset from the bytecode with which they were generated.
--- a/js/src/vm/SPSProfiler.h
+++ b/js/src/vm/SPSProfiler.h
@@ -4,24 +4,21 @@
  * 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_SPSProfiler_h
 #define vm_SPSProfiler_h
 
 #include "mozilla/DebugOnly.h"
 #include "mozilla/GuardObjects.h"
-#include "mozilla/HashFunctions.h"
 
 #include <stddef.h>
 
 #include "jsscript.h"
 
-#include "js/Utility.h"
-
 /*
  * SPS Profiler integration with the JS Engine
  * https://developer.mozilla.org/en/Performance/Profiling_with_the_Built-in_Profiler
  *
  * The SPS profiler (found in tools/profiler) is an implementation of a profiler
  * which has the ability to walk the C++ stack as well as use instrumentation to
  * gather information. When dealing with JS, however, SPS needs integration
  * with the engine because otherwise it is very difficult to figure out what
--- a/js/src/vm/ScopeObject-inl.h
+++ b/js/src/vm/ScopeObject-inl.h
@@ -6,17 +6,16 @@
 
 #ifndef vm_ScopeObject_inl_h
 #define vm_ScopeObject_inl_h
 
 #include "vm/ScopeObject.h"
 
 #include "jsinferinlines.h"
 #include "jsobjinlines.h"
-#include "jsscriptinlines.h"
 
 namespace js {
 
 inline void
 ScopeObject::setEnclosingScope(HandleObject obj)
 {
     JS_ASSERT_IF(obj->is<CallObject>() || obj->is<DeclEnvObject>() || obj->is<BlockObject>(),
                  obj->isDelegate());
--- a/js/src/vm/ScopeObject.cpp
+++ b/js/src/vm/ScopeObject.cpp
@@ -6,23 +6,25 @@
 
 #include "vm/ScopeObject-inl.h"
 
 #include "mozilla/PodOperations.h"
 
 #include "jscompartment.h"
 #include "jsiter.h"
 
+#include "vm/ArgumentsObject.h"
 #include "vm/GlobalObject.h"
 #include "vm/ProxyObject.h"
 #include "vm/Shape.h"
 #include "vm/Xdr.h"
 
 #include "jsatominlines.h"
 #include "jsobjinlines.h"
+#include "jsscriptinlines.h"
 
 #include "gc/Barrier-inl.h"
 #include "vm/Stack-inl.h"
 
 using namespace js;
 using namespace js::types;
 
 using mozilla::PodZero;
--- a/js/src/vm/SelfHosting.cpp
+++ b/js/src/vm/SelfHosting.cpp
@@ -12,16 +12,17 @@
 
 #include "builtin/Intl.h"
 #include "builtin/ParallelArray.h"
 #include "gc/Marking.h"
 #include "vm/ForkJoin.h"
 #include "vm/Interpreter.h"
 
 #include "jsfuninlines.h"
+#include "jsscriptinlines.h"
 
 #include "vm/BooleanObject-inl.h"
 #include "vm/NumberObject-inl.h"
 #include "vm/StringObject-inl.h"
 
 using namespace js;
 using namespace js::selfhosted;
 
--- a/js/src/vm/Shape-inl.h
+++ b/js/src/vm/Shape-inl.h
@@ -6,32 +6,25 @@
 
 #ifndef vm_Shape_inl_h
 #define vm_Shape_inl_h
 
 #include "vm/Shape.h"
 
 #include "mozilla/PodOperations.h"
 
-#include "jsarray.h"
-#include "jsbool.h"
 #include "jscntxt.h"
-#include "jsdbgapi.h"
-#include "jsfun.h"
 #include "jsgc.h"
 #include "jsobj.h"
 
 #include "gc/Marking.h"
-#include "vm/ArgumentsObject.h"
 #include "vm/ScopeObject.h"
-#include "vm/StringObject.h"
 
 #include "jsatominlines.h"
 #include "jscntxtinlines.h"
-#include "jsgcinlines.h"
 
 namespace js {
 
 static inline void
 GetterSetterWriteBarrierPost(JSRuntime *rt, JSObject **objp)
 {
 #ifdef JSGC_GENERATIONAL
     rt->gcStoreBuffer.putRelocatableCell(reinterpret_cast<gc::Cell **>(objp));
--- a/js/src/vm/Stack-inl.h
+++ b/js/src/vm/Stack-inl.h
@@ -7,26 +7,22 @@
 #ifndef vm_Stack_inl_h
 #define vm_Stack_inl_h
 
 #include "vm/Stack.h"
 
 #include "mozilla/PodOperations.h"
 
 #include "jscntxt.h"
-#include "jscompartment.h"
 
 #include "jit/BaselineFrame.h"
-
-#include "jsscriptinlines.h"
+#include "vm/ScopeObject.h"
 
 #include "jit/BaselineFrame-inl.h"
 #include "jit/IonFrameIterator-inl.h"
-#include "vm/ArgumentsObject-inl.h"
-#include "vm/ScopeObject-inl.h"
 
 namespace js {
 
 /*
  * We cache name lookup results only for the global object or for native
  * non-global objects without prototype or with prototype that never mutates,
  * see bug 462734 and bug 487039.
  */
--- a/js/src/vm/Stack.h
+++ b/js/src/vm/Stack.h
@@ -5,16 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef vm_Stack_h
 #define vm_Stack_h
 
 #include "mozilla/MemoryReporting.h"
 
 #include "jsautooplen.h"
+#include "jsdbgapi.h"
 #include "jsfun.h"
 #include "jsscript.h"
 
 #include "jit/IonFrameIterator.h"
 
 struct JSContext;
 struct JSCompartment;
 struct JSGenerator;
--- a/js/src/vm/String.cpp
+++ b/js/src/vm/String.cpp
@@ -8,16 +8,17 @@
 
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/PodOperations.h"
 #include "mozilla/RangedPtr.h"
 
 #include "gc/Marking.h"
 
+#include "jscntxtinlines.h"
 #include "jscompartmentinlines.h"
 
 using namespace js;
 
 using mozilla::PodCopy;
 using mozilla::RangedPtr;
 using mozilla::RoundUpPow2;
 
--- a/js/src/vm/String.h
+++ b/js/src/vm/String.h
@@ -11,16 +11,17 @@
 #include "mozilla/PodOperations.h"
 
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "jsstr.h"
 
 #include "gc/Barrier.h"
 #include "gc/Heap.h"
+#include "gc/Rooting.h"
 #include "js/CharacterEncoding.h"
 #include "js/RootingAPI.h"
 
 class JSDependentString;
 class JSExtensibleString;
 class JSExternalString;
 class JSInlineString;
 class JSStableString;
--- a/js/src/vm/TypedArrayObject.cpp
+++ b/js/src/vm/TypedArrayObject.cpp
@@ -13,17 +13,16 @@
 #ifndef XP_WIN
 # include <sys/mman.h>
 #endif
 
 #include "jsapi.h"
 #include "jsarray.h"
 #include "jscntxt.h"
 #include "jscpucfg.h"
-#include "jsgc.h"
 #include "jsnum.h"
 #include "jsobj.h"
 #include "jstypes.h"
 #include "jsutil.h"
 #include "jsversion.h"
 #ifdef XP_WIN
 # include "jswin.h"
 #endif
--- a/js/src/vm/TypedArrayObject.h
+++ b/js/src/vm/TypedArrayObject.h
@@ -6,18 +6,16 @@
 
 #ifndef vm_TypedArrayObject_h
 #define vm_TypedArrayObject_h
 
 #include "jsapi.h"
 #include "jsclass.h"
 #include "jsobj.h"
 
-#include "gc/Barrier.h"
-
 typedef struct JSProperty JSProperty;
 
 namespace js {
 
 typedef Vector<ArrayBufferObject *, 0, SystemAllocPolicy> ArrayBufferVector;
 
 // The inheritance hierarchy for the various classes relating to typed arrays
 // is as follows.
--- a/js/src/vm/Xdr.cpp
+++ b/js/src/vm/Xdr.cpp
@@ -4,23 +4,21 @@
  * 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 "vm/Xdr.h"
 
 #include <string.h>
 
 #include "jsapi.h"
-#include "jsprf.h"
 #include "jsscript.h"
 
+#include "vm/ObjectImpl-inl.h"
+
 #include "vm/Debugger.h"
-#include "vm/Runtime.h"
-
-#include "jsscriptinlines.h"
 
 using namespace js;
 
 void
 XDRBuffer::freeBuffer()
 {
     js_free(base);
 #ifdef DEBUG
--- a/js/src/vm/Xdr.h
+++ b/js/src/vm/Xdr.h
@@ -5,19 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef vm_Xdr_h
 #define vm_Xdr_h
 
 #include "mozilla/Endian.h"
 
 #include "jsapi.h"
-#include "jsnum.h"
-
-#include "vm/NumericConversions.h"
+#include "jsatom.h"
 
 namespace js {
 
 /*
  * Bytecode version number. Increment the subtrahend whenever JS bytecode
  * changes incompatibly.
  *
  * This version number is XDR'd near the front of xdr bytecode and
--- a/js/src/yarr/YarrInterpreter.cpp
+++ b/js/src/yarr/YarrInterpreter.cpp
@@ -23,16 +23,18 @@
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include "yarr/YarrInterpreter.h"
 
+#include "jscntxt.h"
+
 #include "yarr/Yarr.h"
 #include "yarr/YarrCanonicalizeUCS2.h"
 #include "yarr/BumpPointerAllocator.h"
 
 using namespace WTF;
 
 namespace JSC { namespace Yarr {
 
--- a/js/src/yarr/YarrInterpreter.h
+++ b/js/src/yarr/YarrInterpreter.h
@@ -17,24 +17,22 @@
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifndef yarr_YarrInterpreter_h
 #define yarr_YarrInterpreter_h
 
-#include "jscntxt.h"
-
 #include "yarr/YarrPattern.h"
 
 namespace WTF {
 class BumpPointerAllocator;
 }
 using WTF::BumpPointerAllocator;
 
 namespace JSC { namespace Yarr {