From e7e16aadcead5ab404d9bd7fc436afea48fe72bd Mon Sep 17 00:00:00 2001 From: "igor.bukanov%gmail.com" Date: Tue, 23 Jan 2007 23:57:36 +0000 Subject: [PATCH] Bug 367481: Patch from Seno.Aiko@gmail.com to rearrange JSContext to reduce code size. r=myself --- js/src/jscntxt.h | 114 +++++++++++++++++++++++------------------------ 1 file changed, 56 insertions(+), 58 deletions(-) diff --git a/js/src/jscntxt.h b/js/src/jscntxt.h index bc71fddbeed8..79c131cc8824 100644 --- a/js/src/jscntxt.h +++ b/js/src/jscntxt.h @@ -659,8 +659,60 @@ struct JSContext { /* JSRuntime contextList linkage. */ JSCList links; - /* Interpreter activation count. */ - uintN interpLevel; + /* Counter of operations for branch callback calls. */ + uint32 operationCounter; + +#if JS_HAS_XML_SUPPORT + /* + * Bit-set formed from binary exponentials of the XML_* tiny-ids defined + * for boolean settings in jsxml.c, plus an XSF_CACHE_VALID bit. Together + * these act as a cache of the boolean XML.ignore* and XML.prettyPrinting + * property values associated with this context's global object. + */ + uint8 xmlSettingFlags; +#endif + + /* Runtime version control identifier. */ + uint16 version; + + /* Per-context options. */ + uint32 options; /* see jsapi.h for JSOPTION_* */ + + /* Locale specific callbacks for string conversion. */ + JSLocaleCallbacks *localeCallbacks; + + /* + * cx->resolvingTable is non-null and non-empty if we are initializing + * standard classes lazily, or if we are otherwise recursing indirectly + * from js_LookupProperty through a JSClass.resolve hook. It is used to + * limit runaway recursion (see jsapi.c and jsobj.c). + */ + JSDHashTable *resolvingTable; + +#if JS_HAS_LVALUE_RETURN + /* + * Secondary return value from native method called on the left-hand side + * of an assignment operator. The native should store the object in which + * to set a property in *rval, and return the property's id expressed as a + * jsval by calling JS_SetCallReturnValue2(cx, idval). + */ + jsval rval2; + JSPackedBool rval2set; +#endif + + /* + * True if generating an error, to prevent runaway recursion. + * NB: generatingError packs with rval2set, #if JS_HAS_LVALUE_RETURN; + * with insideGCMarkCallback and with throwing below. + */ + JSPackedBool generatingError; + + /* Flag to indicate that we run inside gcCallback(cx, JSGC_MARK_END). */ + JSPackedBool insideGCMarkCallback; + + /* Exception state -- the exception member is a GC root by definition. */ + JSPackedBool throwing; /* is there a pending exception? */ + jsval exception; /* most-recently-thrown exception */ /* Limit pointer for checking stack consumption during recursion. */ jsuword stackLimit; @@ -700,8 +752,8 @@ struct JSContext { JSBranchCallback branchCallback; JSErrorReporter errorReporter; - /* Counter of operations for branch callback calls. */ - uint32 operationCounter; + /* Interpreter activation count. */ + uintN interpLevel; /* Client opaque pointer */ void *data; @@ -720,60 +772,6 @@ struct JSContext { ((JSContext *)((char *)(tl) - offsetof(JSContext, threadLinks))) #endif -#if JS_HAS_LVALUE_RETURN - /* - * Secondary return value from native method called on the left-hand side - * of an assignment operator. The native should store the object in which - * to set a property in *rval, and return the property's id expressed as a - * jsval by calling JS_SetCallReturnValue2(cx, idval). - */ - jsval rval2; - JSPackedBool rval2set; -#endif - -#if JS_HAS_XML_SUPPORT - /* - * Bit-set formed from binary exponentials of the XML_* tiny-ids defined - * for boolean settings in jsxml.c, plus an XSF_CACHE_VALID bit. Together - * these act as a cache of the boolean XML.ignore* and XML.prettyPrinting - * property values associated with this context's global object. - */ - uint8 xmlSettingFlags; -#endif - - /* - * True if generating an error, to prevent runaway recursion. - * NB: generatingError packs with rval2set, #if JS_HAS_LVALUE_RETURN; - * with xmlSettingFlags, #if JS_HAS_XML_SUPPORT; and with throwing below. - */ - JSPackedBool generatingError; - - /* - * Exception state -- the exception member is a GC root by definition. - * NB: throwing packs with generatingError and rval2set, above. - */ - JSPackedBool throwing; /* is there a pending exception? */ - jsval exception; /* most-recently-thrown exception */ - /* Flag to indicate that we run inside gcCallback(cx, JSGC_MARK_END). */ - JSPackedBool insideGCMarkCallback; - - /* Runtime version control identifier. */ - uint16 version; - - /* Per-context options. */ - uint32 options; /* see jsapi.h for JSOPTION_* */ - - /* Locale specific callbacks for string conversion. */ - JSLocaleCallbacks *localeCallbacks; - - /* - * cx->resolvingTable is non-null and non-empty if we are initializing - * standard classes lazily, or if we are otherwise recursing indirectly - * from js_LookupProperty through a JSClass.resolve hook. It is used to - * limit runaway recursion (see jsapi.c and jsobj.c). - */ - JSDHashTable *resolvingTable; - /* PDL of stack headers describing stack slots not rooted by argv, etc. */ JSStackHeader *stackHeaders;