diff --git a/js/src/jsdbgapi.cpp b/js/src/jsdbgapi.cpp index a4f1e142c3b8..6217749e35d8 100644 --- a/js/src/jsdbgapi.cpp +++ b/js/src/jsdbgapi.cpp @@ -1267,10 +1267,8 @@ JS_EvaluateUCInStackFrame(JSContext *cx, JSStackFrame *fp, * variable references made by this frame. */ script = JSCompiler::compileScript(cx, scobj, fp, JS_StackFramePrincipals(cx, fp), - TCF_COMPILE_N_GO | - TCF_PUT_STATIC_LEVEL(JS_DISPLAY_SIZE), - chars, length, NULL, - filename, lineno); + TCF_COMPILE_N_GO, chars, length, NULL, + filename, lineno, NULL, JS_DISPLAY_SIZE); if (!script) return JS_FALSE; diff --git a/js/src/jsemit.h b/js/src/jsemit.h index bf0a7521a92f..46276dba1702 100644 --- a/js/src/jsemit.h +++ b/js/src/jsemit.h @@ -277,14 +277,6 @@ struct JSTreeContext { /* tree context for semantic checks */ TCF_FUN_USES_OWN_NAME | \ TCF_HAS_SHARPS) -/* - * Flags field, not stored in JSTreeContext.flags, for passing a static level - * into js_CompileScript. - */ -#define TCF_STATIC_LEVEL_MASK 0xffff0000 -#define TCF_GET_STATIC_LEVEL(f) ((uint32)(f) >> 16) -#define TCF_PUT_STATIC_LEVEL(d) ((uint16)(d) << 16) - /* * Span-dependent instructions are jumps whose span (from the jump bytecode to * the jump target) may require 2 or 4 bytes of immediate operand. diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index 7d518fdb4045..1f1f57113174 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -1243,7 +1243,6 @@ obj_eval(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { JSStackFrame *fp, *caller, *callerFrame; JSBool indirectCall; - uint32 tcflags; JSPrincipals *principals; const char *file; uintN line; @@ -1404,7 +1403,6 @@ obj_eval(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) goto out; } - tcflags = TCF_COMPILE_N_GO | TCF_PUT_STATIC_LEVEL(staticLevel); principals = JS_EvalFramePrincipals(cx, fp, caller); file = js_ComputeFilename(cx, caller, principals, &line); @@ -1485,9 +1483,9 @@ obj_eval(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) callerFrame = (staticLevel != 0) ? caller : NULL; if (!script) { script = JSCompiler::compileScript(cx, scopeobj, callerFrame, - principals, tcflags, + principals, TCF_COMPILE_N_GO, str->chars(), str->length(), - NULL, file, line, str); + NULL, file, line, str, staticLevel); if (!script) { ok = JS_FALSE; goto out; diff --git a/js/src/jsparse.cpp b/js/src/jsparse.cpp index 75149af66b9e..f5684ff717da 100644 --- a/js/src/jsparse.cpp +++ b/js/src/jsparse.cpp @@ -788,7 +788,8 @@ JSCompiler::compileScript(JSContext *cx, JSObject *scopeChain, JSStackFrame *cal JSPrincipals *principals, uint32 tcflags, const jschar *chars, size_t length, FILE *file, const char *filename, uintN lineno, - JSString *source /* = NULL */) + JSString *source /* = NULL */, + unsigned staticLevel /* = 0 */) { JSCompiler jsc(cx, principals, callerFrame); JSArenaPool codePool, notePool; @@ -800,15 +801,14 @@ JSCompiler::compileScript(JSContext *cx, JSObject *scopeChain, JSStackFrame *cal void *sbrk(ptrdiff_t), *before = sbrk(0); #endif - JS_ASSERT(!(tcflags & ~(TCF_COMPILE_N_GO | TCF_NO_SCRIPT_RVAL | - TCF_STATIC_LEVEL_MASK))); + JS_ASSERT(!(tcflags & ~(TCF_COMPILE_N_GO | TCF_NO_SCRIPT_RVAL))); /* * The scripted callerFrame can only be given for compile-and-go scripts * and non-zero static level requires callerFrame. */ JS_ASSERT_IF(callerFrame, tcflags & TCF_COMPILE_N_GO); - JS_ASSERT_IF(TCF_GET_STATIC_LEVEL(tcflags) != 0, callerFrame); + JS_ASSERT_IF(staticLevel != 0, callerFrame); if (!jsc.init(chars, length, file, filename, lineno)) return NULL; @@ -827,7 +827,7 @@ JSCompiler::compileScript(JSContext *cx, JSObject *scopeChain, JSStackFrame *cal cg.flags |= uint16(tcflags); cg.scopeChain = scopeChain; - if (!SetStaticLevel(&cg, TCF_GET_STATIC_LEVEL(tcflags))) + if (!SetStaticLevel(&cg, staticLevel)) goto out; /* diff --git a/js/src/jsparse.h b/js/src/jsparse.h index 4cdf1b87e5f0..1396c782aa47 100644 --- a/js/src/jsparse.h +++ b/js/src/jsparse.h @@ -885,7 +885,8 @@ struct JSCompiler { JSPrincipals *principals, uint32 tcflags, const jschar *chars, size_t length, FILE *file, const char *filename, uintN lineno, - JSString *source = NULL); + JSString *source = NULL, + unsigned staticLevel = 0); }; /*