diff --git a/js/src/jsfun.cpp b/js/src/jsfun.cpp index 4b681dafa64..44cb1086951 100644 --- a/js/src/jsfun.cpp +++ b/js/src/jsfun.cpp @@ -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; diff --git a/js/src/jsinterp.cpp b/js/src/jsinterp.cpp index 940507a51ba..2e922751d3e 100644 --- a/js/src/jsinterp.cpp +++ b/js/src/jsinterp.cpp @@ -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) diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index b30964eebe7..7d518fdb404 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -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) && diff --git a/js/src/jsopcode.cpp b/js/src/jsopcode.cpp index 54cfbd38f34..9f5ee889168 100644 --- a/js/src/jsopcode.cpp +++ b/js/src/jsopcode.cpp @@ -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); } diff --git a/js/src/jsparse.cpp b/js/src/jsparse.cpp index 4d23070759d..75149af66b9 100644 --- a/js/src/jsparse.cpp +++ b/js/src/jsparse.cpp @@ -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) { diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp index fa0a11ec4c9..2176ff58013 100644 --- a/js/src/jsscript.cpp +++ b/js/src/jsscript.cpp @@ -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); diff --git a/js/src/jsscript.h b/js/src/jsscript.h index 62e46297b03..1d85fcb1476 100644 --- a/js/src/jsscript.h +++ b/js/src/jsscript.h @@ -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 */