mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-05 00:02:37 +00:00
Bug 514585: Use bitfields in JSScript instead of a flag word. r=brendan
This is behavior-neutral cleanup in preparation for the real patch.
This commit is contained in:
parent
6c2fa1a2df
commit
fb40bfec5a
@ -471,7 +471,9 @@ WrapEscapingClosure(JSContext *cx, JSStackFrame *fp, JSObject *funobj, JSFunctio
|
||||
* Fill in the rest of wscript. This means if you add members to JSScript
|
||||
* you must update this code. FIXME: factor into JSScript::clone method.
|
||||
*/
|
||||
wscript->flags = script->flags;
|
||||
wscript->noScriptRval = script->noScriptRval;
|
||||
wscript->savedCallerFun = script->savedCallerFun;
|
||||
wscript->hasSharps = script->hasSharps;
|
||||
wscript->version = script->version;
|
||||
wscript->nfixed = script->nfixed;
|
||||
wscript->filename = script->filename;
|
||||
|
@ -1523,11 +1523,11 @@ js_Execute(JSContext *cx, JSObject *chain, JSScript *script,
|
||||
#if JS_HAS_SHARP_VARS
|
||||
JS_STATIC_ASSERT(SHARP_NSLOTS == 2);
|
||||
|
||||
if (script->flags & JSSF_HAS_SHARPS) {
|
||||
if (script->hasSharps) {
|
||||
JS_ASSERT(script->nfixed >= SHARP_NSLOTS);
|
||||
jsval *sharps = &frame.slots[script->nfixed - SHARP_NSLOTS];
|
||||
|
||||
if (down && down->script && (down->script->flags & JSSF_HAS_SHARPS)) {
|
||||
if (down && down->script && down->script->hasSharps) {
|
||||
JS_ASSERT(down->script->nfixed >= SHARP_NSLOTS);
|
||||
int base = (down->fun && !(down->flags & JSFRAME_SPECIAL))
|
||||
? down->fun->sharpSlotBase(cx)
|
||||
|
@ -1419,7 +1419,7 @@ obj_eval(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
|
||||
EVAL_CACHE_METER(probe);
|
||||
while ((script = *scriptp) != NULL) {
|
||||
if ((script->flags & JSSF_SAVED_CALLER_FUN) &&
|
||||
if (script->savedCallerFun &&
|
||||
script->version == cx->version &&
|
||||
(script->principals == principals ||
|
||||
(principals->subsume(principals, script->principals) &&
|
||||
|
@ -2816,7 +2816,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop)
|
||||
case JSOP_CALLDSLOT:
|
||||
{
|
||||
if (!jp->fun) {
|
||||
JS_ASSERT(jp->script->flags & JSSF_SAVED_CALLER_FUN);
|
||||
JS_ASSERT(jp->script->savedCallerFun);
|
||||
jp->fun = jp->script->getFunction(0);
|
||||
}
|
||||
|
||||
|
@ -1001,7 +1001,7 @@ JSCompiler::compileScript(JSContext *cx, JSObject *scopeChain, JSStackFrame *cal
|
||||
#endif
|
||||
script = js_NewScriptFromCG(cx, &cg);
|
||||
if (script && funbox)
|
||||
script->flags |= JSSF_SAVED_CALLER_FUN;
|
||||
script->savedCallerFun = true;
|
||||
|
||||
#ifdef JS_SCOPE_DEPTH_METER
|
||||
if (script) {
|
||||
|
@ -1531,9 +1531,9 @@ js_NewScriptFromCG(JSContext *cx, JSCodeGenerator *cg)
|
||||
if (cg->regexpList.length != 0)
|
||||
cg->regexpList.finish(script->regexps());
|
||||
if (cg->flags & TCF_NO_SCRIPT_RVAL)
|
||||
script->flags |= JSSF_NO_SCRIPT_RVAL;
|
||||
script->noScriptRval = true;
|
||||
if (cg->hasSharps())
|
||||
script->flags |= JSSF_HAS_SHARPS;
|
||||
script->hasSharps = true;
|
||||
|
||||
if (cg->upvarList.count != 0) {
|
||||
JS_ASSERT(cg->upvarList.count <= cg->upvarMap.length);
|
||||
|
@ -115,7 +115,11 @@ struct JSScript {
|
||||
regexps or 0 if none. */
|
||||
uint8 trynotesOffset; /* offset to the array of try notes or
|
||||
0 if none */
|
||||
uint8 flags; /* see below */
|
||||
bool noScriptRval:1; /* no need for result value of last
|
||||
expression statement */
|
||||
bool savedCallerFun:1; /* object 0 is caller function */
|
||||
bool hasSharps:1; /* script uses sharp variables */
|
||||
|
||||
jsbytecode *main; /* main entry point, after predef'ing prolog */
|
||||
JSAtomMap atomMap; /* maps immediate index to literal struct */
|
||||
const char *filename; /* source filename or null */
|
||||
@ -170,11 +174,6 @@ struct JSScript {
|
||||
inline JSObject *getRegExp(size_t index);
|
||||
};
|
||||
|
||||
#define JSSF_NO_SCRIPT_RVAL 0x01 /* no need for result value of last
|
||||
expression statement */
|
||||
#define JSSF_SAVED_CALLER_FUN 0x02 /* object 0 is caller function */
|
||||
#define JSSF_HAS_SHARPS 0x04 /* script uses sharp variables */
|
||||
|
||||
#define SHARP_NSLOTS 2 /* [#array, #depth] slots if the script
|
||||
uses sharp variables */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user