Bug 898263 (part 1) - Slim down jsprvtd.h. r=jorendorff.
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 25 Jul 2013 21:23:14 -0700
changeset 142123 ab5587721464258ee90c6c4a2ad53db12bd9a1f8
parent 142122 ea854a4e9e95ddaad6031e90c31436cdeb6dd7dc
child 142124 6dcbea61c4891d8fda3fd620dd4e02bf4cad2f00
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersjorendorff
bugs898263
milestone26.0a1
Bug 898263 (part 1) - Slim down jsprvtd.h. r=jorendorff.
dom/base/nsDOMClassInfo.cpp
js/src/builtin/RegExp.h
js/src/frontend/BytecodeEmitter.h
js/src/frontend/FoldConstants.h
js/src/frontend/ParseMaps.h
js/src/frontend/ParseNode.h
js/src/frontend/SyntaxParseHandler.h
js/src/jsanalyze.h
js/src/jsatom.h
js/src/jsclass.h
js/src/jscntxt.h
js/src/jsdbgapi.cpp
js/src/jsdbgapi.h
js/src/jsfriendapi.h
js/src/jsinfer.h
js/src/jsobj.h
js/src/jsproxy.h
js/src/jsprvtd.h
js/src/jsscript.h
js/src/jsstr.h
js/src/vm/ArgumentsObject.h
js/src/vm/Debugger.h
js/src/vm/MatchPairs.h
js/src/vm/RegExpObject.h
js/src/vm/Runtime.h
js/src/vm/ScopeObject.h
js/src/vm/Stack.h
js/xpconnect/src/XPCInlines.h
xpcom/base/CycleCollectedJSRuntime.cpp
xpcom/base/CycleCollectedJSRuntime.h
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -10,17 +10,16 @@
 
 #ifdef XP_WIN
 #undef GetClassName
 #endif
 
 // JavaScript includes
 #include "jsapi.h"
 #include "jsfriendapi.h"
-#include "jsprvtd.h"    // we are using private JS typedefs...
 #include "jsdbgapi.h"
 #include "WrapperFactory.h"
 #include "AccessCheck.h"
 #include "XrayWrapper.h"
 
 #include "xpcpublic.h"
 #include "xpcprivate.h"
 #include "XPCWrapper.h"
--- a/js/src/builtin/RegExp.h
+++ b/js/src/builtin/RegExp.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 builtin_RegExp_h
 #define builtin_RegExp_h
 
-#include "jsprvtd.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
--- a/js/src/frontend/BytecodeEmitter.h
+++ b/js/src/frontend/BytecodeEmitter.h
@@ -19,16 +19,19 @@
 #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;
+
 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/FoldConstants.h
+++ b/js/src/frontend/FoldConstants.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 frontend_FoldConstants_h
 #define frontend_FoldConstants_h
 
-#include "jsprvtd.h"
-
 #include "frontend/SyntaxParseHandler.h"
 
 namespace js {
 namespace frontend {
 
 // Perform constant folding on the given AST. For example, the program
 // `print(2 + 2)` would become `print(4)`.
 //
--- a/js/src/frontend/ParseMaps.h
+++ b/js/src/frontend/ParseMaps.h
@@ -13,16 +13,19 @@
 #include "jsprvtd.h"
 
 #include "ds/InlineMap.h"
 #include "gc/Barrier.h"
 #include "js/HashTable.h"
 #include "js/Vector.h"
 
 namespace js {
+
+class LifoAlloc;
+
 namespace frontend {
 
 class DefinitionSingle;
 class DefinitionList;
 
 typedef InlineMap<JSAtom *, jsatomid, 24> AtomIndexMap;
 typedef InlineMap<JSAtom *, DefinitionSingle, 24> AtomDefnMap;
 typedef InlineMap<JSAtom *, DefinitionList, 24> AtomDefnListMap;
--- a/js/src/frontend/ParseNode.h
+++ b/js/src/frontend/ParseNode.h
@@ -16,16 +16,18 @@
 
 namespace js {
 namespace frontend {
 
 template <typename ParseHandler>
 struct ParseContext;
 
 class FullParseHandler;
+class FunctionBox;
+class ObjectBox;
 
 /*
  * Indicates a location in the stack that an upvar value can be retrieved from
  * as a two tuple of (level, slot).
  *
  * Some existing client code uses the level value as a delta, or level "skip"
  * quantity. We could probably document that through use of more types at some
  * point in the future.
--- a/js/src/frontend/SyntaxParseHandler.h
+++ b/js/src/frontend/SyntaxParseHandler.h
@@ -8,16 +8,19 @@
 #define frontend_SyntaxParseHandler_h
 
 #include "frontend/ParseNode.h"
 #include "frontend/TokenStream.h"
 
 namespace js {
 namespace frontend {
 
+template <typename ParseHandler>
+class Parser;
+
 // Parse handler used when processing the syntax in a block of code, to generate
 // the minimal information which is required to detect syntax errors and allow
 // bytecode to be emitted for outer functions.
 //
 // When parsing, we start at the top level with a full parse, and when possible
 // only check the syntax for inner functions, so that they can be lazily parsed
 // into bytecode when/if they first run. Checking the syntax of a function is
 // several times faster than doing a full parse/emit, and lazy parsing improves
--- a/js/src/jsanalyze.h
+++ b/js/src/jsanalyze.h
@@ -17,16 +17,21 @@
 
 #include "vm/Runtime.h"
 
 class JSScript;
 
 namespace js {
 namespace analyze {
 
+class LoopAnalysis;
+class SlotValue;
+class SSAValue;
+class SSAUseChain;
+
 /*
  * There are three analyses we can perform on a JSScript, outlined below.
  * The results of all three are stored in ScriptAnalysis, but the analyses
  * themselves can be performed separately. Along with type inference results,
  * per-script analysis results are tied to the per-compartment analysis pool
  * and are freed on every garbage collection.
  *
  * - Basic bytecode analysis. For each bytecode, determine the stack depth at
--- a/js/src/jsatom.h
+++ b/js/src/jsatom.h
@@ -213,15 +213,18 @@ AtomizeChars(ExclusiveContext *cx, const
 template <AllowGC allowGC>
 extern JSAtom *
 AtomizeString(ExclusiveContext *cx, JSString *str, js::InternBehavior ib = js::DoNotInternAtom);
 
 template <AllowGC allowGC>
 extern JSAtom *
 ToAtom(ExclusiveContext *cx, typename MaybeRooted<Value, allowGC>::HandleType v);
 
+template <XDRMode mode>
+class XDRState;
+
 template<XDRMode mode>
 bool
 XDRAtom(XDRState<mode> *xdr, js::MutableHandleAtom atomp);
 
 } /* namespace js */
 
 #endif /* jsatom_h */
--- a/js/src/jsclass.h
+++ b/js/src/jsclass.h
@@ -13,19 +13,21 @@
  * object behavior and, e.g., allows custom slow layout.
  */
 
 #include "jsapi.h"
 #include "jsprvtd.h"
 
 namespace js {
 
+class Class;
+class FreeOp;
+class PropertyId;
 class PropertyName;
 class SpecialId;
-class PropertyId;
 
 // This is equal to JSFunction::class_.  Use it in places where you don't want
 // to #include jsfun.h.
 extern JS_FRIEND_DATA(js::Class* const) FunctionClassPtr;
 
 static JS_ALWAYS_INLINE jsid
 SPECIALID_TO_JSID(const SpecialId &sid);
 
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -102,20 +102,21 @@ class AutoCycleDetector
     bool foundCycle() { return cyclic; }
 };
 
 /* Updates references in the cycle detection set if the GC moves them. */
 extern void
 TraceCycleDetectionSet(JSTracer *trc, ObjectSet &set);
 
 struct AutoResolving;
-
+class DtoaCache;
 class ForkJoinSlice;
 class RegExpCompartment;
-class DtoaCache;
+class RegExpStatics;
+class ForkJoinSlice;
 
 /*
  * Execution Context Overview:
  *
  * Several different structures may be used to provide a context for operations
  * on the VM. Each context is thread local, but varies in what data it can
  * access and what other threads may be running.
  *
--- a/js/src/jsdbgapi.cpp
+++ b/js/src/jsdbgapi.cpp
@@ -13,17 +13,16 @@
 #include <string.h>
 
 #include "jsapi.h"
 #include "jscntxt.h"
 #include "jsfun.h"
 #include "jsgc.h"
 #include "jsobj.h"
 #include "jsopcode.h"
-#include "jsprvtd.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/jsdbgapi.h
+++ b/js/src/jsdbgapi.h
@@ -7,16 +7,18 @@
 #ifndef jsdbgapi_h
 #define jsdbgapi_h
 /*
  * JS debugger API.
  */
 
 #include "jsprvtd.h"
 
+namespace js { class StackFrame; }
+
 namespace JS {
 
 struct FrameDescription
 {
     JSScript *script;
     unsigned lineno;
     JSFunction *fun;
 };
--- a/js/src/jsfriendapi.h
+++ b/js/src/jsfriendapi.h
@@ -25,16 +25,18 @@
     ((uintptr_t)(sp) < (limit)+(tolerance))
 #else
 # define JS_CHECK_STACK_SIZE_WITH_TOLERANCE(limit, sp, tolerance)  \
     ((uintptr_t)(sp) > (limit)-(tolerance))
 #endif
 
 #define JS_CHECK_STACK_SIZE(limit, lval) JS_CHECK_STACK_SIZE_WITH_TOLERANCE(limit, lval, 0)
 
+class JSLinearString;
+
 namespace JS {
 template <class T>
 class Heap;
 } /* namespace JS */
 
 extern JS_FRIEND_API(void)
 JS_SetGrayGCRootsTracer(JSRuntime *rt, JSTraceDataOp traceOp, void *data);
 
--- a/js/src/jsinfer.h
+++ b/js/src/jsinfer.h
@@ -100,18 +100,26 @@ class RootedBase<TaggedProto> : public T
 };
 
 class CallObject;
 
 namespace ion {
     struct IonScript;
 }
 
+namespace analyze {
+    class ScriptAnalysis;
+}
+
 namespace types {
 
+class TypeCallsite;
+class TypeCompartment;
+class TypeSet;
+
 /* Type set entry for either a JSObject with singleton type or a non-singleton TypeObject. */
 struct TypeObjectKey {
     static intptr_t keyBits(TypeObjectKey *obj) { return (intptr_t) obj; }
     static TypeObjectKey *getKey(TypeObjectKey *obj) { return obj; }
 };
 
 /*
  * Information about a single concrete type. We pack this into a single word,
--- a/js/src/jsobj.h
+++ b/js/src/jsobj.h
@@ -31,17 +31,16 @@
 
 namespace JS {
 struct ObjectsExtraSizes;
 }
 
 namespace js {
 
 class AutoPropDescArrayRooter;
-class BaseProxyHandler;
 struct GCMarker;
 struct NativeIterator;
 class Nursery;
 struct StackShape;
 
 inline JSObject *
 CastAsObject(PropertyOp op)
 {
--- a/js/src/jsproxy.h
+++ b/js/src/jsproxy.h
@@ -7,16 +7,17 @@
 #ifndef jsproxy_h
 #define jsproxy_h
 
 #include "jsapi.h"
 #include "jsfriendapi.h"
 
 namespace js {
 
+class RegExpGuard;
 class JS_FRIEND_API(Wrapper);
 
 /*
  * A proxy is a JSObject that implements generic behavior by providing custom
  * implementations for each object trap. The implementation for each trap is
  * provided by a C++ object stored on the proxy, known as its handler.
  *
  * A major use case for proxies is to forward each trap to another object,
--- a/js/src/jsprvtd.h
+++ b/js/src/jsprvtd.h
@@ -1,186 +1,64 @@
 /* -*- 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 jsprvtd_h
 #define jsprvtd_h
+
 /*
  * JS private typename definitions.
- *
- * This header is included only in other .h files, for convenience and for
- * simplicity of type naming.  The alternative for structures is to use tags,
- * which are named the same as their typedef names (legal in C/C++, and less
- * noisy than suffixing the typedef name with "Struct" or "Str").  Instead,
- * all .h files that include this file may use the same typedef name, whether
- * declaring a pointer to struct type, or defining a member of struct type.
- *
- * A few fundamental scalar types are defined here too.  Neither the scalar
- * nor the struct typedefs should change much, therefore the nearly-global
- * make dependency induced by this file should not prove painful.
  */
 
 #include "jsapi.h"
-#include "jsutil.h"
-
-#include "js/HashTable.h"
-#include "js/Vector.h"
-
-/*
- * Convenience constants.
- */
-#define JS_BITS_PER_UINT32_LOG2 5
-#define JS_BITS_PER_UINT32      32
-
-/* The alignment required of objects stored in GC arenas. */
-static const unsigned JS_GCTHING_ALIGN = 8;
-static const unsigned JS_GCTHING_ZEROBITS = 3;
 
 /* Scalar typedefs. */
 typedef uint8_t     jsbytecode;
 typedef uint8_t     jssrcnote;
 typedef uintptr_t   jsatomid;
 
-/* Struct typedefs. */
-typedef struct JSGCThing            JSGCThing;
-typedef struct JSGenerator          JSGenerator;
-typedef struct JSNativeEnumerator   JSNativeEnumerator;
-typedef struct JSTryNote            JSTryNote;
-
-/* Friend "Advanced API" typedefs. */
-typedef struct JSAtomState          JSAtomState;
-typedef struct JSCodeSpec           JSCodeSpec;
-typedef struct JSPrinter            JSPrinter;
-typedef struct JSStackHeader        JSStackHeader;
-typedef struct JSSubString          JSSubString;
-typedef struct JSSpecializedNative  JSSpecializedNative;
-
 /* String typedefs. */
-class JSDependentString;
-class JSExtensibleString;
-class JSExternalString;
-class JSLinearString;
-class JSRope;
 class JSAtom;
-class JSWrapper;
 
 namespace js {
 
-struct ArgumentsData;
-struct Class;
-
-class AutoNameVector;
-class RegExpGuard;
-class RegExpObject;
-class RegExpObjectBuilder;
-class RegExpShared;
-class RegExpStatics;
-class MatchPairs;
 class PropertyName;
-class LazyScript;
 
 enum RegExpFlag
 {
     IgnoreCaseFlag  = 0x01,
     GlobalFlag      = 0x02,
     MultilineFlag   = 0x04,
     StickyFlag      = 0x08,
 
     NoFlags         = 0x00,
     AllFlags        = 0x0f
 };
 
-class StringBuffer;
-
-class FrameRegs;
-class StackFrame;
-class ScriptFrameIter;
-
-class Proxy;
-class JS_FRIEND_API(AutoEnterPolicy);
-class JS_FRIEND_API(BaseProxyHandler);
-class JS_FRIEND_API(Wrapper);
-class JS_FRIEND_API(CrossCompartmentWrapper);
-
-class TempAllocPolicy;
-class RuntimeAllocPolicy;
-
-class GlobalObject;
-
-template <typename K,
-          typename V,
-          size_t InlineElems>
-class InlineMap;
-
-class LifoAlloc;
-
 class Shape;
 
-class Breakpoint;
-class BreakpointSite;
-class Debugger;
-class WatchpointMap;
-
 /*
  * Env is the type of what ES5 calls "lexical environments" (runtime
  * activations of lexical scopes). This is currently just JSObject, and is
  * implemented by Call, Block, With, and DeclEnv objects, among others--but
  * environments and objects are really two different concepts.
  */
 typedef JSObject Env;
 
 typedef JSNative             Native;
 typedef JSParallelNative     ParallelNative;
 typedef JSThreadSafeNative   ThreadSafeNative;
 typedef JSPropertyOp         PropertyOp;
 typedef JSStrictPropertyOp   StrictPropertyOp;
 typedef JSPropertyDescriptor PropertyDescriptor;
 
-struct SourceCompressionToken;
-
-namespace frontend {
-
-struct BytecodeEmitter;
-struct Definition;
-class FullParseHandler;
-class FunctionBox;
-class ObjectBox;
-struct Token;
-struct TokenPos;
-class TokenStream;
-class ParseMapPool;
-class ParseNode;
-
-template <typename ParseHandler>
-class Parser;
-
-} /* namespace frontend */
-
-namespace analyze {
-
-struct LifetimeVariable;
-class LoopAnalysis;
-class ScriptAnalysis;
-class SlotValue;
-class SSAValue;
-class SSAUseChain;
-
-} /* namespace analyze */
-
-namespace types {
-
-class TypeSet;
-struct TypeCallsite;
-struct TypeObject;
-struct TypeCompartment;
-
-} /* namespace types */
+namespace types { struct TypeObject; }
 
 typedef JS::Handle<Shape*>             HandleShape;
 typedef JS::Handle<types::TypeObject*> HandleTypeObject;
 typedef JS::Handle<JSAtom*>            HandleAtom;
 typedef JS::Handle<PropertyName*>      HandlePropertyName;
 
 typedef JS::MutableHandle<Shape*>      MutableHandleShape;
 typedef JS::MutableHandle<JSAtom*>     MutableHandleAtom;
@@ -190,46 +68,29 @@ typedef JS::Rooted<types::TypeObject*> R
 typedef JS::Rooted<JSAtom*>            RootedAtom;
 typedef JS::Rooted<PropertyName*>      RootedPropertyName;
 
 enum XDRMode {
     XDR_ENCODE,
     XDR_DECODE
 };
 
-template <XDRMode mode>
-class XDRState;
-
-class FreeOp;
-
 struct IdValuePair
 {
     jsid id;
     Value value;
 
     IdValuePair() {}
     IdValuePair(jsid idArg)
       : id(idArg), value(UndefinedValue())
     {}
 };
 
 } /* namespace js */
 
-namespace JSC {
-
-class ExecutableAllocator;
-
-} /* namespace JSC */
-
-namespace WTF {
-
-class BumpPointerAllocator;
-
-} /* namespace WTF */
-
 /* "Friend" types used by jscntxt.h and jsdbgapi.h. */
 typedef enum JSTrapStatus {
     JSTRAP_ERROR,
     JSTRAP_CONTINUE,
     JSTRAP_RETURN,
     JSTRAP_THROW,
     JSTRAP_LIMIT
 } JSTrapStatus;
--- a/js/src/jsscript.h
+++ b/js/src/jsscript.h
@@ -29,24 +29,31 @@ namespace ion {
     struct IonScriptCounts;
 }
 
 # define ION_DISABLED_SCRIPT ((js::ion::IonScript *)0x1)
 # define ION_COMPILING_SCRIPT ((js::ion::IonScript *)0x2)
 
 # define BASELINE_DISABLED_SCRIPT ((js::ion::BaselineScript *)0x1)
 
+class BreakpointSite;
+class BindingIter;
+class RegExpObject;
+struct SourceCompressionToken;
 class Shape;
-
-class BindingIter;
+class WatchpointMap;
 
 namespace analyze {
     class ScriptAnalysis;
 }
 
+namespace frontend {
+    class BytecodeEmitter;
+}
+
 }
 
 /*
  * Type of try note associated with each catch or finally block, and also with
  * for-in and other kinds of loops. Non-for-in loops do not need these notes
  * for exception unwinding, but storing their boundaries here is helpful for
  * heuristics that need to know whether a given op is inside a loop.
  */
--- a/js/src/jsstr.h
+++ b/js/src/jsstr.h
@@ -15,21 +15,21 @@
 #include "jsatom.h"
 #include "jslock.h"
 #include "jsutil.h"
 
 #include "js/HashTable.h"
 #include "vm/Unicode.h"
 
 class JSFlatString;
+class JSLinearString;
 class JSStableString;
 
 namespace js {
 
-/* Implemented in jsstrinlines.h */
 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.
--- a/js/src/vm/ArgumentsObject.h
+++ b/js/src/vm/ArgumentsObject.h
@@ -9,16 +9,17 @@
 
 #include "mozilla/MemoryReporting.h"
 
 #include "jsfun.h"
 
 namespace js {
 
 class AbstractFramePtr;
+class ScriptFrameIter;
 
 namespace ion {
 class IonJSFrameLayout;
 }
 
 /*
  * ArgumentsData stores the initial indexed arguments provided to the
  * corresponding and that function itself.  It is used to store arguments[i]
--- a/js/src/vm/Debugger.h
+++ b/js/src/vm/Debugger.h
@@ -16,16 +16,18 @@
 #include "jsweakmap.h"
 
 #include "gc/Barrier.h"
 #include "js/HashTable.h"
 #include "vm/GlobalObject.h"
 
 namespace js {
 
+class Breakpoint;
+
 /*
  * A weakmap that supports the keys being in different compartments to the
  * values, although all values must be in the same compartment.
  *
  * The Key and Value classes must support the compartment() method.
  *
  * The purpose of this is to allow the garbage collector to easily find edges
  * from debugee object compartments to debugger compartments when calculating
--- a/js/src/vm/MatchPairs.h
+++ b/js/src/vm/MatchPairs.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 vm_MatchPairs_h
 #define vm_MatchPairs_h
 
+#include "jsalloc.h"
+
 #include "ds/LifoAlloc.h"
+#include "js/Vector.h"
 
 /*
  * RegExp match results are succinctly represented by pairs of integer
  * indices delimiting (start, limit] segments of the input string.
  *
  * The pair count for a given RegExp match is the capturing parentheses
  * count plus one for the "0 capturing paren" whole text match.
  */
--- a/js/src/vm/RegExpObject.h
+++ b/js/src/vm/RegExpObject.h
@@ -42,16 +42,19 @@
  * needed for execution. When a RegExpShared needs to be created, it is looked
  * up in a per-compartment table to allow reuse between objects. Lastly, on
  * GC, every RegExpShared (that is not active on the callstack) is discarded.
  * Because of the last point, any code using a RegExpShared (viz., by executing
  * a regexp) must indicate the RegExpShared is active via RegExpGuard.
  */
 namespace js {
 
+class RegExpShared;
+namespace frontend { class TokenStream; }
+
 enum RegExpRunStatus
 {
     RegExpRunStatus_Error,
     RegExpRunStatus_Success,
     RegExpRunStatus_Success_NotFound
 };
 
 class RegExpObjectBuilder
--- a/js/src/vm/Runtime.h
+++ b/js/src/vm/Runtime.h
@@ -18,16 +18,17 @@
 #include <string.h>
 
 #include "jsapi.h"
 #include "jsatom.h"
 #include "jsclist.h"
 #include "jsfriendapi.h"
 #include "jsgc.h"
 #include "jsprvtd.h"
+#include "jsproxy.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"
 #include "jit/AsmJSSignalHandlers.h"
@@ -58,31 +59,34 @@ extern void
 js_ReportOutOfMemory(js::ThreadSafeContext *cx);
 
 extern void
 js_ReportAllocationOverflow(js::ThreadSafeContext *cx);
 
 extern void
 js_ReportOverRecursed(js::ThreadSafeContext *cx);
 
+namespace JSC { class ExecutableAllocator; }
+
+namespace WTF { class BumpPointerAllocator; }
+
 namespace js {
 
 typedef Rooted<JSLinearString*> RootedLinearString;
 
+class AsmJSActivation;
+class InterpreterFrames;
 class MathCache;
+class WorkerThreadState;
 
 namespace ion {
 class IonRuntime;
 struct PcScriptCache;
 }
 
-class AsmJSActivation;
-class InterpreterFrames;
-class WorkerThreadState;
-
 /*
  * 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.
  */
 struct GSNCache {
     typedef HashMap<jsbytecode *,
--- a/js/src/vm/ScopeObject.h
+++ b/js/src/vm/ScopeObject.h
@@ -11,16 +11,18 @@
 #include "jsobj.h"
 #include "jsweakmap.h"
 
 #include "gc/Barrier.h"
 #include "vm/ProxyObject.h"
 
 namespace js {
 
+namespace frontend { struct Definition; }
+
 /*****************************************************************************/
 
 /*
  * All function scripts have an "enclosing static scope" that refers to the
  * innermost enclosing let or function in the program text. This allows full
  * reconstruction of the lexical scope for debugging or compiling efficient
  * access to variables in enclosing scopes. The static scope is represented at
  * runtime by a tree of compiler-created objects representing each scope:
--- a/js/src/vm/Stack.h
+++ b/js/src/vm/Stack.h
@@ -12,16 +12,17 @@
 #include "jsautooplen.h"
 #include "jsfun.h"
 #include "jsscript.h"
 
 #include "jit/IonFrameIterator.h"
 
 struct JSContext;
 struct JSCompartment;
+struct JSGenerator;
 
 namespace js {
 
 class StackFrame;
 class FrameRegs;
 
 class InvokeFrameGuard;
 class FrameGuard;
--- a/js/xpconnect/src/XPCInlines.h
+++ b/js/xpconnect/src/XPCInlines.h
@@ -6,16 +6,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* private inline methods (#include'd by xpcprivate.h). */
 
 #ifndef xpcinlines_h___
 #define xpcinlines_h___
 
 #include "jsfriendapi.h"
+#include "jsutil.h"
 
 /***************************************************************************/
 
 inline void
 XPCJSRuntime::AddVariantRoot(XPCTraceableVariant* variant)
 {
     variant->AddToRootSet(GetMapLock(), &mVariantRoots);
 }
--- a/xpcom/base/CycleCollectedJSRuntime.cpp
+++ b/xpcom/base/CycleCollectedJSRuntime.cpp
@@ -54,17 +54,16 @@
 // To improve debugging, if WantAllTraces() is true all JS objects are
 // traversed.
 
 #include "mozilla/CycleCollectedJSRuntime.h"
 #include <algorithm>
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/DOMJSClass.h"
-#include "jsfriendapi.h"
 #include "jsprf.h"
 #include "nsCycleCollectionNoteRootCallback.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsCycleCollector.h"
 #include "nsDOMJSUtils.h"
 #include "xpcpublic.h"
 
 using namespace mozilla;
--- a/xpcom/base/CycleCollectedJSRuntime.h
+++ b/xpcom/base/CycleCollectedJSRuntime.h
@@ -3,18 +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 mozilla_CycleCollectedJSRuntime_h__
 #define mozilla_CycleCollectedJSRuntime_h__
 
 #include "mozilla/MemoryReporting.h"
-#include "jsprvtd.h"
 #include "jsapi.h"
+#include "jsfriendapi.h"
 
 #include "nsCycleCollector.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsDataHashtable.h"
 #include "nsHashKeys.h"
 #include "nsTArray.h"
 
 class nsCycleCollectionNoteRootCallback;