From 066d47a07a8757c95574c4b059c0802639ebcd80 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 25 Jul 2013 21:23:14 -0700 Subject: [PATCH] Bug 898263 (part 1) - Slim down jsprvtd.h. r=jorendorff. --HG-- extra : rebase_source : 7a926428c59e388fc08148bf60f6dbc7bfe71271 --- dom/base/nsDOMClassInfo.cpp | 1 - js/src/builtin/RegExp.h | 2 - js/src/frontend/BytecodeEmitter.h | 3 + js/src/frontend/FoldConstants.h | 2 - js/src/frontend/ParseMaps.h | 3 + js/src/frontend/ParseNode.h | 2 + js/src/frontend/SyntaxParseHandler.h | 3 + js/src/jsanalyze.h | 5 + js/src/jsatom.h | 3 + js/src/jsclass.h | 4 +- js/src/jscntxt.h | 5 +- js/src/jsdbgapi.cpp | 1 - js/src/jsdbgapi.h | 2 + js/src/jsfriendapi.h | 2 + js/src/jsinfer.h | 8 ++ js/src/jsobj.h | 1 - js/src/jsproxy.h | 1 + js/src/jsprvtd.h | 143 +------------------------ js/src/jsscript.h | 11 +- js/src/jsstr.h | 2 +- js/src/vm/ArgumentsObject.h | 1 + js/src/vm/Debugger.h | 2 + js/src/vm/MatchPairs.h | 3 + js/src/vm/RegExpObject.h | 3 + js/src/vm/Runtime.h | 12 ++- js/src/vm/ScopeObject.h | 2 + js/src/vm/Stack.h | 1 + js/xpconnect/src/XPCInlines.h | 1 + xpcom/base/CycleCollectedJSRuntime.cpp | 1 - xpcom/base/CycleCollectedJSRuntime.h | 2 +- 30 files changed, 72 insertions(+), 160 deletions(-) diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 1e871ec6c13..cee777ebc19 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -15,7 +15,6 @@ // 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" diff --git a/js/src/builtin/RegExp.h b/js/src/builtin/RegExp.h index 7f464c895a1..76f119a39a1 100644 --- a/js/src/builtin/RegExp.h +++ b/js/src/builtin/RegExp.h @@ -7,8 +7,6 @@ #ifndef builtin_RegExp_h #define builtin_RegExp_h -#include "jsprvtd.h" - #include "vm/MatchPairs.h" #include "vm/RegExpObject.h" diff --git a/js/src/frontend/BytecodeEmitter.h b/js/src/frontend/BytecodeEmitter.h index 3d8112bebd0..91a9afa8d05 100644 --- a/js/src/frontend/BytecodeEmitter.h +++ b/js/src/frontend/BytecodeEmitter.h @@ -24,6 +24,9 @@ namespace js { namespace frontend { +template +class Parser; + struct CGTryNoteList { Vector list; CGTryNoteList(ExclusiveContext *cx) : list(cx) {} diff --git a/js/src/frontend/FoldConstants.h b/js/src/frontend/FoldConstants.h index 7a33213cbb3..895a9025f9e 100644 --- a/js/src/frontend/FoldConstants.h +++ b/js/src/frontend/FoldConstants.h @@ -7,8 +7,6 @@ #ifndef frontend_FoldConstants_h #define frontend_FoldConstants_h -#include "jsprvtd.h" - #include "frontend/SyntaxParseHandler.h" namespace js { diff --git a/js/src/frontend/ParseMaps.h b/js/src/frontend/ParseMaps.h index ee218bfa9e6..e0b1409e57a 100644 --- a/js/src/frontend/ParseMaps.h +++ b/js/src/frontend/ParseMaps.h @@ -18,6 +18,9 @@ #include "js/Vector.h" namespace js { + +class LifoAlloc; + namespace frontend { class DefinitionSingle; diff --git a/js/src/frontend/ParseNode.h b/js/src/frontend/ParseNode.h index 790659ab0b0..186d8b69e0a 100644 --- a/js/src/frontend/ParseNode.h +++ b/js/src/frontend/ParseNode.h @@ -21,6 +21,8 @@ template struct ParseContext; class FullParseHandler; +class FunctionBox; +class ObjectBox; /* * Indicates a location in the stack that an upvar value can be retrieved from diff --git a/js/src/frontend/SyntaxParseHandler.h b/js/src/frontend/SyntaxParseHandler.h index beb9b3b7dc8..95a8576e855 100644 --- a/js/src/frontend/SyntaxParseHandler.h +++ b/js/src/frontend/SyntaxParseHandler.h @@ -13,6 +13,9 @@ namespace js { namespace frontend { +template +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. diff --git a/js/src/jsanalyze.h b/js/src/jsanalyze.h index 90b7216c756..c283f8295b7 100644 --- a/js/src/jsanalyze.h +++ b/js/src/jsanalyze.h @@ -22,6 +22,11 @@ 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 diff --git a/js/src/jsatom.h b/js/src/jsatom.h index 70d1e2041ba..3793448ef3e 100644 --- a/js/src/jsatom.h +++ b/js/src/jsatom.h @@ -218,6 +218,9 @@ template extern JSAtom * ToAtom(ExclusiveContext *cx, typename MaybeRooted::HandleType v); +template +class XDRState; + template bool XDRAtom(XDRState *xdr, js::MutableHandleAtom atomp); diff --git a/js/src/jsclass.h b/js/src/jsclass.h index 75bc6722175..0d8e57bf9c4 100644 --- a/js/src/jsclass.h +++ b/js/src/jsclass.h @@ -18,9 +18,11 @@ 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. diff --git a/js/src/jscntxt.h b/js/src/jscntxt.h index 110e26cbb60..031b390c254 100644 --- a/js/src/jscntxt.h +++ b/js/src/jscntxt.h @@ -107,10 +107,11 @@ extern void TraceCycleDetectionSet(JSTracer *trc, ObjectSet &set); struct AutoResolving; - +class DtoaCache; class ForkJoinSlice; class RegExpCompartment; -class DtoaCache; +class RegExpStatics; +class ForkJoinSlice; /* * Execution Context Overview: diff --git a/js/src/jsdbgapi.cpp b/js/src/jsdbgapi.cpp index 8e68b0bda8c..ff76b95dc6f 100644 --- a/js/src/jsdbgapi.cpp +++ b/js/src/jsdbgapi.cpp @@ -18,7 +18,6 @@ #include "jsgc.h" #include "jsobj.h" #include "jsopcode.h" -#include "jsprvtd.h" #include "jsscript.h" #include "jsstr.h" #include "jstypes.h" diff --git a/js/src/jsdbgapi.h b/js/src/jsdbgapi.h index 32dfc220029..fd831d99649 100644 --- a/js/src/jsdbgapi.h +++ b/js/src/jsdbgapi.h @@ -12,6 +12,8 @@ #include "jsprvtd.h" +namespace js { class StackFrame; } + namespace JS { struct FrameDescription diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index 696d02f6128..d6352622f14 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -30,6 +30,8 @@ #define JS_CHECK_STACK_SIZE(limit, lval) JS_CHECK_STACK_SIZE_WITH_TOLERANCE(limit, lval, 0) +class JSLinearString; + namespace JS { template class Heap; diff --git a/js/src/jsinfer.h b/js/src/jsinfer.h index e2acb29d9bf..4d799961329 100644 --- a/js/src/jsinfer.h +++ b/js/src/jsinfer.h @@ -105,8 +105,16 @@ 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; } diff --git a/js/src/jsobj.h b/js/src/jsobj.h index d2a2a58920e..9567e2a5b25 100644 --- a/js/src/jsobj.h +++ b/js/src/jsobj.h @@ -36,7 +36,6 @@ struct ObjectsExtraSizes; namespace js { class AutoPropDescArrayRooter; -class BaseProxyHandler; struct GCMarker; struct NativeIterator; class Nursery; diff --git a/js/src/jsproxy.h b/js/src/jsproxy.h index d2780bbfa0d..25e24f7b5f7 100644 --- a/js/src/jsproxy.h +++ b/js/src/jsproxy.h @@ -12,6 +12,7 @@ namespace js { +class RegExpGuard; class JS_FRIEND_API(Wrapper); /* diff --git a/js/src/jsprvtd.h b/js/src/jsprvtd.h index 254010c1ceb..1aa0dc7a3ea 100644 --- a/js/src/jsprvtd.h +++ b/js/src/jsprvtd.h @@ -6,79 +6,24 @@ #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 { @@ -91,37 +36,8 @@ enum RegExpFlag 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 -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 @@ -137,45 +53,7 @@ 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 -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 HandleShape; typedef JS::Handle HandleTypeObject; @@ -195,11 +73,6 @@ enum XDRMode { XDR_DECODE }; -template -class XDRState; - -class FreeOp; - struct IdValuePair { jsid id; @@ -213,18 +86,6 @@ struct IdValuePair } /* 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, diff --git a/js/src/jsscript.h b/js/src/jsscript.h index 535cb6a804a..6c7cbe54d9d 100644 --- a/js/src/jsscript.h +++ b/js/src/jsscript.h @@ -34,14 +34,21 @@ namespace ion { # define BASELINE_DISABLED_SCRIPT ((js::ion::BaselineScript *)0x1) -class Shape; - +class BreakpointSite; class BindingIter; +class RegExpObject; +struct SourceCompressionToken; +class Shape; +class WatchpointMap; namespace analyze { class ScriptAnalysis; } +namespace frontend { + class BytecodeEmitter; +} + } /* diff --git a/js/src/jsstr.h b/js/src/jsstr.h index cd0723c32fd..9a0fafd5762 100644 --- a/js/src/jsstr.h +++ b/js/src/jsstr.h @@ -20,11 +20,11 @@ #include "vm/Unicode.h" class JSFlatString; +class JSLinearString; class JSStableString; namespace js { -/* Implemented in jsstrinlines.h */ class StringBuffer; /* diff --git a/js/src/vm/ArgumentsObject.h b/js/src/vm/ArgumentsObject.h index a7f70ae8585..0c104dae76a 100644 --- a/js/src/vm/ArgumentsObject.h +++ b/js/src/vm/ArgumentsObject.h @@ -14,6 +14,7 @@ namespace js { class AbstractFramePtr; +class ScriptFrameIter; namespace ion { class IonJSFrameLayout; diff --git a/js/src/vm/Debugger.h b/js/src/vm/Debugger.h index 3867ed52c18..0c1355ea9c2 100644 --- a/js/src/vm/Debugger.h +++ b/js/src/vm/Debugger.h @@ -21,6 +21,8 @@ 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. diff --git a/js/src/vm/MatchPairs.h b/js/src/vm/MatchPairs.h index e0350f604df..f690472bea8 100644 --- a/js/src/vm/MatchPairs.h +++ b/js/src/vm/MatchPairs.h @@ -7,7 +7,10 @@ #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 diff --git a/js/src/vm/RegExpObject.h b/js/src/vm/RegExpObject.h index 233f4c48f8d..adc1f0d8cf4 100644 --- a/js/src/vm/RegExpObject.h +++ b/js/src/vm/RegExpObject.h @@ -47,6 +47,9 @@ */ namespace js { +class RegExpShared; +namespace frontend { class TokenStream; } + enum RegExpRunStatus { RegExpRunStatus_Error, diff --git a/js/src/vm/Runtime.h b/js/src/vm/Runtime.h index 61e7f809f97..3d3353a8403 100644 --- a/js/src/vm/Runtime.h +++ b/js/src/vm/Runtime.h @@ -23,6 +23,7 @@ #include "jsfriendapi.h" #include "jsgc.h" #include "jsprvtd.h" +#include "jsproxy.h" #include "ds/FixedSizeHash.h" #include "ds/LifoAlloc.h" @@ -63,21 +64,24 @@ js_ReportAllocationOverflow(js::ThreadSafeContext *cx); extern void js_ReportOverRecursed(js::ThreadSafeContext *cx); +namespace JSC { class ExecutableAllocator; } + +namespace WTF { class BumpPointerAllocator; } + namespace js { typedef Rooted 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, diff --git a/js/src/vm/ScopeObject.h b/js/src/vm/ScopeObject.h index aa75d5f4501..814c72984f5 100644 --- a/js/src/vm/ScopeObject.h +++ b/js/src/vm/ScopeObject.h @@ -16,6 +16,8 @@ namespace js { +namespace frontend { struct Definition; } + /*****************************************************************************/ /* diff --git a/js/src/vm/Stack.h b/js/src/vm/Stack.h index 2d4886203cc..9307c54a1ab 100644 --- a/js/src/vm/Stack.h +++ b/js/src/vm/Stack.h @@ -17,6 +17,7 @@ struct JSContext; struct JSCompartment; +struct JSGenerator; namespace js { diff --git a/js/xpconnect/src/XPCInlines.h b/js/xpconnect/src/XPCInlines.h index 13feeb87869..690c209a36a 100644 --- a/js/xpconnect/src/XPCInlines.h +++ b/js/xpconnect/src/XPCInlines.h @@ -11,6 +11,7 @@ #define xpcinlines_h___ #include "jsfriendapi.h" +#include "jsutil.h" /***************************************************************************/ diff --git a/xpcom/base/CycleCollectedJSRuntime.cpp b/xpcom/base/CycleCollectedJSRuntime.cpp index 78baf073647..a44c20016c2 100644 --- a/xpcom/base/CycleCollectedJSRuntime.cpp +++ b/xpcom/base/CycleCollectedJSRuntime.cpp @@ -59,7 +59,6 @@ #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" diff --git a/xpcom/base/CycleCollectedJSRuntime.h b/xpcom/base/CycleCollectedJSRuntime.h index 22848ac9e92..a6185021ce5 100644 --- a/xpcom/base/CycleCollectedJSRuntime.h +++ b/xpcom/base/CycleCollectedJSRuntime.h @@ -8,8 +8,8 @@ #define mozilla_CycleCollectedJSRuntime_h__ #include "mozilla/MemoryReporting.h" -#include "jsprvtd.h" #include "jsapi.h" +#include "jsfriendapi.h" #include "nsCycleCollector.h" #include "nsCycleCollectionParticipant.h"