[JAEGER] Merge from Tracemonkey part 1: don't change visibility of JSStackFrame members yet

This commit is contained in:
David Mandelin 2010-08-16 15:37:15 -07:00
commit 6f19cd8199
27 changed files with 492 additions and 378 deletions

View File

@ -5386,7 +5386,7 @@ nsContentUtils::CanAccessNativeAnon()
// Some code is running, we can't make the assumption, as above, but we
// can't use a native frame, so clear fp.
fp = nsnull;
} else if (!fp->script) {
} else if (!fp->hasScript()) {
fp = nsnull;
}
@ -5401,8 +5401,8 @@ nsContentUtils::CanAccessNativeAnon()
// if they've been cloned into less privileged contexts.
static const char prefix[] = "chrome://global/";
const char *filename;
if (fp && fp->script &&
(filename = fp->script->filename) &&
if (fp && fp->hasScript() &&
(filename = fp->getScript()->filename) &&
!strncmp(filename, prefix, NS_ARRAY_LENGTH(prefix) - 1)) {
return PR_TRUE;
}

View File

@ -1222,7 +1222,7 @@ nsJSContext::DOMOperationCallback(JSContext *cx)
cx->debugHooks->
debuggerHandlerData)) {
case JSTRAP_RETURN:
fp->rval = js::Valueify(rval);
fp->setReturnValue(js::Valueify(rval));
return JS_TRUE;
case JSTRAP_ERROR:
cx->throwing = JS_FALSE;

View File

@ -4303,7 +4303,7 @@ js_generic_native_method_dispatcher(JSContext *cx, JSObject *obj,
*/
if (!ComputeThisFromArgv(cx, argv))
return JS_FALSE;
js_GetTopStackFrame(cx)->thisv = argv[-1];
js_GetTopStackFrame(cx)->setThisValue(argv[-1]);
JS_ASSERT(cx->fp->argv == argv);
/* Clear the last parameter in case too few arguments were passed. */

View File

@ -350,7 +350,7 @@ JS_REQUIRES_STACK void
StackSpace::pushSynthesizedSlowNativeFrame(JSContext *cx, StackSegment *seg, JSStackFrame *fp,
JSFrameRegs &regs)
{
JS_ASSERT(!fp->script && FUN_SLOW_NATIVE(fp->fun));
JS_ASSERT(!fp->hasScript() && FUN_SLOW_NATIVE(fp->getFunction()));
fp->down = cx->fp;
seg->setPreviousInMemory(currentSegment);
currentSegment = seg;
@ -364,7 +364,7 @@ StackSpace::popSynthesizedSlowNativeFrame(JSContext *cx)
JS_ASSERT(isCurrentAndActive(cx));
JS_ASSERT(cx->hasActiveSegment());
JS_ASSERT(currentSegment->getInitialFrame() == cx->fp);
JS_ASSERT(!cx->fp->script && FUN_SLOW_NATIVE(cx->fp->fun));
JS_ASSERT(!cx->fp->hasScript() && FUN_SLOW_NATIVE(cx->fp->getFunction()));
cx->popSegmentAndFrame();
currentSegment = currentSegment->getPreviousInMemory();
}
@ -1343,7 +1343,7 @@ PopulateReportBlame(JSContext *cx, JSErrorReport *report)
*/
for (JSStackFrame *fp = js_GetTopStackFrame(cx); fp; fp = fp->down) {
if (fp->pc(cx)) {
report->filename = fp->script->filename;
report->filename = fp->getScript()->filename;
report->lineno = js_FramePCToLineNumber(cx, fp);
break;
}
@ -1437,7 +1437,7 @@ checkReportFlags(JSContext *cx, uintN *flags)
* the nearest scripted frame is strict, see bug 536306.
*/
JSStackFrame *fp = js_GetScriptedCaller(cx, NULL);
if (fp && fp->script->strictModeCode)
if (fp && fp->getScript()->strictModeCode)
*flags &= ~JSREPORT_WARNING;
else if (JS_HAS_STRICT_OPTION(cx))
*flags |= JSREPORT_WARNING;
@ -1911,7 +1911,7 @@ js_GetScriptedCaller(JSContext *cx, JSStackFrame *fp)
if (!fp)
fp = js_GetTopStackFrame(cx);
while (fp) {
if (fp->script)
if (fp->hasScript())
return fp;
fp = fp->down;
}

View File

@ -2098,8 +2098,8 @@ struct JSContext
JSStackFrame *findFrameAtLevel(uintN targetLevel) {
JSStackFrame *fp = this->fp;
while (true) {
JS_ASSERT(fp && fp->script);
if (fp->script->staticLevel == targetLevel)
JS_ASSERT(fp && fp->hasScript());
if (fp->getScript()->staticLevel == targetLevel)
break;
fp = fp->down;
}
@ -2383,14 +2383,14 @@ JS_ALWAYS_INLINE JSObject *
JSStackFrame::varobj(js::StackSegment *seg) const
{
JS_ASSERT(seg->contains(this));
return fun ? maybeCallObj() : seg->getInitialVarObj();
return hasFunction() ? maybeCallObj() : seg->getInitialVarObj();
}
JS_ALWAYS_INLINE JSObject *
JSStackFrame::varobj(JSContext *cx) const
{
JS_ASSERT(cx->activeSegment()->contains(this));
return fun ? maybeCallObj() : cx->activeSegment()->getInitialVarObj();
return hasFunction() ? maybeCallObj() : cx->activeSegment()->getInitialVarObj();
}
JS_ALWAYS_INLINE jsbytecode *
@ -2432,7 +2432,8 @@ class AutoCheckRequestDepth {
static inline uintN
FramePCOffset(JSContext *cx, JSStackFrame* fp)
{
return uintN((fp->hasIMacroPC() ? fp->getIMacroPC() : fp->pc(cx)) - fp->script->code);
jsbytecode *pc = fp->hasIMacroPC() ? fp->getIMacroPC() : fp->pc(cx);
return uintN(pc - fp->getScript()->code);
}
static inline JSAtom **
@ -2440,7 +2441,7 @@ FrameAtomBase(JSContext *cx, JSStackFrame *fp)
{
return fp->hasIMacroPC()
? COMMON_ATOMS_START(&cx->runtime->atomState)
: fp->script->atomMap.vector;
: fp->getScript()->atomMap.vector;
}
namespace js {

View File

@ -400,9 +400,9 @@ FrameRegsIter::contiguousDownFrameSP(JSStackFrame *up)
Value *sp = up->argv + up->argc;
#ifdef DEBUG
JS_ASSERT(sp <= up->argEnd());
JS_ASSERT(sp >= (up->down->script ? up->down->base() : up->down->slots()));
if (up->fun) {
uint16 nargs = up->fun->nargs;
JS_ASSERT(sp >= (up->down->hasScript() ? up->down->base() : up->down->slots()));
if (up->hasFunction()) {
uint16 nargs = up->getFunction()->nargs;
uintN argc = up->argc;
uintN missing = argc < nargs ? nargs - argc : 0;
JS_ASSERT(sp == up->argEnd() - missing);

View File

@ -776,8 +776,8 @@ js_watch_set(JSContext *cx, JSObject *obj, jsid id, Value *vp)
JSStackFrame *fp = frame.getFrame();
PodZero(fp);
MakeValueRangeGCSafe(fp->slots(), nfixed);
fp->script = script;
fp->fun = fun;
fp->setScript(script);
fp->setFunction(fun);
fp->argv = vp + 2;
fp->setScopeChain(closure->getParent());
fp->setArgsObj(NULL);
@ -1194,7 +1194,7 @@ JS_FrameIterator(JSContext *cx, JSStackFrame **iteratorp)
JS_PUBLIC_API(JSScript *)
JS_GetFrameScript(JSContext *cx, JSStackFrame *fp)
{
return fp->script;
return fp->maybeScript();
}
JS_PUBLIC_API(jsbytecode *)
@ -1214,16 +1214,16 @@ JS_StackFramePrincipals(JSContext *cx, JSStackFrame *fp)
{
JSSecurityCallbacks *callbacks;
if (fp->fun) {
if (fp->hasFunction()) {
callbacks = JS_GetSecurityCallbacks(cx);
if (callbacks && callbacks->findObjectPrincipals) {
if (FUN_OBJECT(fp->fun) != fp->callee())
if (FUN_OBJECT(fp->getFunction()) != fp->callee())
return callbacks->findObjectPrincipals(cx, fp->callee());
/* FALL THROUGH */
}
}
if (fp->script)
return fp->script->principals;
if (fp->hasScript())
return fp->getScript()->principals;
return NULL;
}
@ -1256,7 +1256,7 @@ JS_EvalFramePrincipals(JSContext *cx, JSStackFrame *fp, JSStackFrame *caller)
JS_PUBLIC_API(void *)
JS_GetFrameAnnotation(JSContext *cx, JSStackFrame *fp)
{
if (fp->hasAnnotation() && fp->script) {
if (fp->hasAnnotation() && fp->hasScript()) {
JSPrincipals *principals = JS_StackFramePrincipals(cx, fp);
if (principals && principals->globalPrivilegesEnabled(cx, principals)) {
@ -1291,7 +1291,7 @@ JS_GetFramePrincipalArray(JSContext *cx, JSStackFrame *fp)
JS_PUBLIC_API(JSBool)
JS_IsNativeFrame(JSContext *cx, JSStackFrame *fp)
{
return !fp->script;
return !fp->hasScript();
}
/* this is deprecated, use JS_GetFrameScopeChain instead */
@ -1316,7 +1316,7 @@ JS_GetFrameCallObject(JSContext *cx, JSStackFrame *fp)
{
JS_ASSERT(cx->stack().contains(fp));
if (! fp->fun)
if (!fp->hasFunction())
return NULL;
/* Force creation of argument object if not yet created */
@ -1341,17 +1341,17 @@ JS_GetFrameThis(JSContext *cx, JSStackFrame *fp)
JS_PUBLIC_API(JSFunction *)
JS_GetFrameFunction(JSContext *cx, JSStackFrame *fp)
{
return fp->fun;
return fp->maybeFunction();
}
JS_PUBLIC_API(JSObject *)
JS_GetFrameFunctionObject(JSContext *cx, JSStackFrame *fp)
{
if (!fp->fun)
if (!fp->hasFunction())
return NULL;
JS_ASSERT(fp->callee()->isFunction());
JS_ASSERT(fp->callee()->getPrivate() == fp->fun);
JS_ASSERT(fp->callee()->getPrivate() == fp->getFunction());
return fp->callee();
}
@ -1387,13 +1387,13 @@ JS_IsDebuggerFrame(JSContext *cx, JSStackFrame *fp)
JS_PUBLIC_API(jsval)
JS_GetFrameReturnValue(JSContext *cx, JSStackFrame *fp)
{
return Jsvalify(fp->rval);
return Jsvalify(fp->getReturnValue());
}
JS_PUBLIC_API(void)
JS_SetFrameReturnValue(JSContext *cx, JSStackFrame *fp, jsval rval)
{
fp->rval = Valueify(rval);
fp->setReturnValue(Valueify(rval));
}
/************************************************************************/
@ -1662,7 +1662,7 @@ SetupFakeFrame(JSContext *cx, ExecuteFrameGuard &frame, JSFrameRegs &regs, JSObj
JSStackFrame *fp = frame.getFrame();
PodZero(fp);
fp->fun = fun;
fp->setFunction(fun);
fp->argv = vp + 2;
fp->setScopeChain(scopeobj->getGlobal());
@ -1896,8 +1896,8 @@ JS_GetTopScriptFilenameFlags(JSContext *cx, JSStackFrame *fp)
if (!fp)
fp = js_GetTopStackFrame(cx);
while (fp) {
if (fp->script)
return JS_GetScriptFilenameFlags(fp->script);
if (fp->hasScript())
return JS_GetScriptFilenameFlags(fp->getScript());
fp = fp->down;
}
return 0;

View File

@ -1890,7 +1890,7 @@ static bool
MakeUpvarForEval(JSParseNode *pn, JSCodeGenerator *cg)
{
JSContext *cx = cg->parser->context;
JSFunction *fun = cg->parser->callerFrame->fun;
JSFunction *fun = cg->parser->callerFrame->getFunction();
uintN upvarLevel = fun->u.i.script->staticLevel;
JSFunctionBox *funbox = cg->funbox;
@ -2075,8 +2075,8 @@ BindNameToSlot(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
if (cg->flags & TCF_IN_FOR_INIT)
return JS_TRUE;
JS_ASSERT(caller->script);
if (!caller->fun)
JS_ASSERT(caller->hasScript());
if (!caller->hasFunction())
return JS_TRUE;
/*
@ -2105,7 +2105,7 @@ BindNameToSlot(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
* defeats the display optimization to static link searching used
* by JSOP_{GET,CALL}UPVAR.
*/
JSFunction *fun = cg->parser->callerFrame->fun;
JSFunction *fun = cg->parser->callerFrame->getFunction();
JS_ASSERT(cg->staticLevel >= fun->u.i.script->staticLevel);
unsigned skip = cg->staticLevel - fun->u.i.script->staticLevel;
if (cg->skipSpansGenerator(skip))
@ -2201,7 +2201,7 @@ BindNameToSlot(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
JSStackFrame *caller = cg->parser->callerFrame;
#endif
JS_ASSERT(caller);
JS_ASSERT(caller->script);
JS_ASSERT(caller->hasScript());
JSTreeContext *tc = cg;
while (tc->staticLevel != level)
@ -2210,7 +2210,7 @@ BindNameToSlot(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
JSCodeGenerator *evalcg = (JSCodeGenerator *) tc;
JS_ASSERT(evalcg->compileAndGo());
JS_ASSERT(caller->fun && cg->parser->callerVarObj == evalcg->scopeChain);
JS_ASSERT(caller->hasFunction() && cg->parser->callerVarObj == evalcg->scopeChain);
/*
* Don't generate upvars on the left side of a for loop. See

View File

@ -293,7 +293,7 @@ InitExnPrivate(JSContext *cx, JSObject *exnObject, JSString *message,
stackDepth = 0;
valueCount = 0;
for (fp = js_GetTopStackFrame(cx); fp; fp = fp->down) {
if (fp->fun && fp->argv) {
if (fp->hasFunction() && fp->argv) {
Value v = NullValue();
if (checkAccess &&
!checkAccess(cx, fp->callee(), callerid, JSACC_READ, &v)) {
@ -334,12 +334,12 @@ InitExnPrivate(JSContext *cx, JSObject *exnObject, JSString *message,
values = GetStackTraceValueBuffer(priv);
elem = priv->stackElems;
for (fp = js_GetTopStackFrame(cx); fp != fpstop; fp = fp->down) {
if (!fp->fun) {
if (!fp->hasFunction()) {
elem->funName = NULL;
elem->argc = 0;
} else {
elem->funName = fp->fun->atom
? ATOM_TO_STRING(fp->fun->atom)
elem->funName = fp->getFunction()->atom
? ATOM_TO_STRING(fp->getFunction()->atom)
: cx->runtime->emptyString;
elem->argc = fp->argc;
memcpy(values, fp->argv, fp->argc * sizeof(jsval));
@ -347,8 +347,8 @@ InitExnPrivate(JSContext *cx, JSObject *exnObject, JSString *message,
}
elem->ulineno = 0;
elem->filename = NULL;
if (fp->script) {
elem->filename = fp->script->filename;
if (fp->hasScript()) {
elem->filename = fp->getScript()->filename;
if (fp->pc(cx))
elem->ulineno = js_FramePCToLineNumber(cx, fp);
}
@ -749,7 +749,7 @@ Exception(JSContext *cx, JSObject *obj, uintN argc, Value *argv, Value *rval)
} else {
fp = js_GetScriptedCaller(cx, NULL);
if (fp) {
filename = FilenameToString(cx, fp->script->filename);
filename = FilenameToString(cx, fp->getScript()->filename);
if (!filename)
return JS_FALSE;
} else {

View File

@ -202,8 +202,8 @@ js_GetArgsObject(JSContext *cx, JSStackFrame *fp)
* We must be in a function activation; the function must be lightweight
* or else fp must have a variable object.
*/
JS_ASSERT(fp->fun);
JS_ASSERT_IF(fp->fun->flags & JSFUN_HEAVYWEIGHT,
JS_ASSERT(fp->hasFunction());
JS_ASSERT_IF(fp->getFunction()->flags & JSFUN_HEAVYWEIGHT,
fp->varobj(cx->containingSegment(fp)));
/* Skip eval and debugger frames. */
@ -779,7 +779,7 @@ JSObject *
js_GetCallObject(JSContext *cx, JSStackFrame *fp)
{
/* Create a call object for fp only if it lacks one. */
JS_ASSERT(fp->fun);
JS_ASSERT(fp->hasFunction());
if (fp->hasCallObj())
return fp->getCallObj();
@ -798,7 +798,8 @@ js_GetCallObject(JSContext *cx, JSStackFrame *fp)
* expression Call's parent points to an environment object holding
* function's name.
*/
JSAtom *lambdaName = (fp->fun->flags & JSFUN_LAMBDA) ? fp->fun->atom : NULL;
JSAtom *lambdaName =
(fp->getFunction()->flags & JSFUN_LAMBDA) ? fp->getFunction()->atom : NULL;
if (lambdaName) {
JSObject *envobj = NewDeclEnvObject(cx, fp);
if (!envobj)
@ -816,13 +817,13 @@ js_GetCallObject(JSContext *cx, JSStackFrame *fp)
}
}
JSObject *callobj = NewCallObject(cx, fp->fun, fp->getScopeChain());
JSObject *callobj = NewCallObject(cx, fp->getFunction(), fp->getScopeChain());
if (!callobj)
return NULL;
callobj->setPrivate(fp);
JS_ASSERT(fp->argv);
JS_ASSERT(fp->fun == GET_FUNCTION_PRIVATE(cx, fp->callee()));
JS_ASSERT(fp->getFunction() == GET_FUNCTION_PRIVATE(cx, fp->callee()));
callobj->setSlot(JSSLOT_CALLEE, fp->calleeValue());
fp->setCallObj(callobj);
@ -880,7 +881,7 @@ js_PutCallObject(JSContext *cx, JSStackFrame *fp)
js_PutArgsObject(cx, fp);
}
JSFunction *fun = fp->fun;
JSFunction *fun = fp->getFunction();
JS_ASSERT(fun == js_GetCallObjectFunction(callobj));
uintN n = fun->countArgsAndVars();
@ -1272,11 +1273,13 @@ JS_PUBLIC_DATA(Class) js_CallClass = {
bool
JSStackFrame::getValidCalleeObject(JSContext *cx, Value *vp)
{
if (!fun) {
if (!hasFunction()) {
*vp = argv ? argv[-2] : UndefinedValue();
return true;
}
JSFunction *fun = getFunction();
/*
* See the equivalent condition in args_getProperty for ARGS_CALLEE, but
* note that here we do not want to throw, since this escape can happen via
@ -1299,11 +1302,11 @@ JSStackFrame::getValidCalleeObject(JSContext *cx, Value *vp)
* through the frame's |this| object's method read barrier for the method
* atom by which it was uniquely associated with a property.
*/
if (thisv.isObject()) {
if (getThisValue().isObject()) {
JS_ASSERT(GET_FUNCTION_PRIVATE(cx, funobj) == fun);
if (fun == funobj && fun->methodAtom()) {
JSObject *thisp = &thisv.toObject();
JSObject *thisp = &getThisValue().toObject();
JS_ASSERT(thisp->canHaveMethodBarrier());
JSScope *scope = thisp->scope();
@ -1415,7 +1418,7 @@ fun_getProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp)
/* Find fun's top-most activation record. */
JSStackFrame *fp;
for (fp = js_GetTopStackFrame(cx);
fp && (fp->fun != fun || (fp->flags & JSFRAME_SPECIAL));
fp && (fp->maybeFunction() != fun || (fp->flags & JSFRAME_SPECIAL));
fp = fp->down) {
continue;
}
@ -1462,7 +1465,7 @@ fun_getProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp)
default:
/* XXX fun[0] and fun.arguments[0] are equivalent. */
if (fp && fp->fun && (uintN)slot < fp->fun->nargs)
if (fp && fp->hasFunction() && (uintN)slot < fp->getFunction()->nargs)
*vp = fp->argv[slot];
break;
}
@ -2217,7 +2220,8 @@ Function(JSContext *cx, JSObject *obj, uintN argc, Value *argv, Value *rval)
* Function indirectly from a script.
*/
fp = js_GetTopStackFrame(cx);
JS_ASSERT(!fp->script && fp->fun && fp->fun->u.n.native == Function);
JS_ASSERT(!fp->hasScript() && fp->hasFunction() &&
fp->getFunction()->u.n.native == Function);
caller = js_GetScriptedCaller(cx, fp);
if (caller) {
principals = JS_EvalFramePrincipals(cx, fp, caller);
@ -2551,8 +2555,8 @@ js_NewFlatClosure(JSContext *cx, JSFunction *fun)
JSObject *
js_NewDebuggableFlatClosure(JSContext *cx, JSFunction *fun)
{
JS_ASSERT(cx->fp->fun->flags & JSFUN_HEAVYWEIGHT);
JS_ASSERT(!cx->fp->fun->optimizedClosure());
JS_ASSERT(cx->fp->getFunction()->flags & JSFUN_HEAVYWEIGHT);
JS_ASSERT(!cx->fp->getFunction()->optimizedClosure());
JS_ASSERT(FUN_FLAT_CLOSURE(fun));
return WrapEscapingClosure(cx, cx->fp, fun);
@ -2672,7 +2676,7 @@ js_ReportIsNotFunction(JSContext *cx, const Value *vp, uintN flags)
++i;
if (!i.done()) {
uintN depth = js_ReconstructStackDepth(cx, i.fp()->script, i.pc());
uintN depth = js_ReconstructStackDepth(cx, i.fp()->getScript(), i.pc());
Value *simsp = i.fp()->base() + depth;
JS_ASSERT(simsp <= i.sp());
if (i.fp()->base() <= vp && vp < simsp)

View File

@ -2272,12 +2272,12 @@ js_TraceStackFrame(JSTracer *trc, JSStackFrame *fp)
JS_CALL_OBJECT_TRACER(trc, fp->getCallObj(), "call");
if (fp->hasArgsObj())
JS_CALL_OBJECT_TRACER(trc, fp->getArgsObj(), "arguments");
if (fp->script)
js_TraceScript(trc, fp->script);
if (fp->hasScript())
js_TraceScript(trc, fp->getScript());
/* Allow for primitive this parameter due to JSFUN_THISP_* flags. */
MarkValue(trc, fp->thisv, "this");
MarkValue(trc, fp->rval, "rval");
MarkValue(trc, fp->getThisValue(), "this");
MarkValue(trc, fp->getReturnValue(), "rval");
if (fp->hasScopeChain())
JS_CALL_OBJECT_TRACER(trc, fp->getScopeChain(), "scope chain");
}

View File

@ -112,8 +112,8 @@ js_GetScopeChain(JSContext *cx, JSStackFrame *fp)
* Don't force a call object for a lightweight function call, but do
* insist that there is a call object for a heavyweight function call.
*/
JS_ASSERT(!fp->fun ||
!(fp->fun->flags & JSFUN_HEAVYWEIGHT) ||
JS_ASSERT(!fp->hasFunction() ||
!(fp->getFunction()->flags & JSFUN_HEAVYWEIGHT) ||
fp->hasCallObj());
JS_ASSERT(fp->hasScopeChain());
return fp->getScopeChain();
@ -130,7 +130,7 @@ js_GetScopeChain(JSContext *cx, JSStackFrame *fp)
* Also, identify the innermost compiler-allocated block we needn't clone.
*/
JSObject *limitBlock, *limitClone;
if (fp->fun && !fp->hasCallObj()) {
if (fp->hasFunction() && !fp->hasCallObj()) {
JS_ASSERT_IF(fp->getScopeChain()->getClass() == &js_BlockClass,
fp->getScopeChain()->getPrivate() != js_FloatingFrameIfGenerator(cx, fp));
if (!js_GetCallObject(cx, fp))
@ -535,20 +535,24 @@ InvokeCommon(JSContext *cx, JSFunction *fun, JSScript *script, T native,
SetValueRangeToUndefined(fp->slots(), nvars);
/* Initialize frame. */
fp->thisv = args.thisv();
fp->setThisValue(args.thisv());
fp->setCallObj(NULL);
fp->setArgsObj(NULL);
fp->script = script;
fp->fun = fun;
fp->setScript(script);
fp->setFunction(fun);
fp->argc = args.argc();
fp->argv = args.argv();
fp->rval = (flags & JSINVOKE_CONSTRUCT) ? fp->thisv : UndefinedValue();
fp->setAnnotation(NULL);
fp->setScopeChain(NULL);
fp->setBlockChain(NULL);
fp->flags = flags;
JS_ASSERT(!fp->hasIMacroPC());
if (flags & JSINVOKE_CONSTRUCT)
fp->setReturnValue(fp->getThisValue());
else
fp->clearReturnValue();
/* Initialize regs. */
JSFrameRegs &regs = frame.getRegs();
if (script) {
@ -619,7 +623,7 @@ InvokeCommon(JSContext *cx, JSFunction *fun, JSScript *script, T native,
JSBool alreadyThrowing = cx->throwing;
#endif
/* Primitive |this| should not be passed to slow natives. */
JSObject *thisp = fun ? fp->getThisObject(cx) : fp->thisv.toObjectOrNull();
JSObject *thisp = fun ? fp->getThisObject(cx) : fp->getThisValue().toObjectOrNull();
ok = callJSNative(cx, native, thisp, fp->argc, fp->argv, &fp->rval);
JS_ASSERT(cx->fp == fp);
@ -634,7 +638,7 @@ InvokeCommon(JSContext *cx, JSFunction *fun, JSScript *script, T native,
ok = RunScript(cx, script, fun, fp->getScopeChain());
}
DTrace::exitJSFun(cx, fp, fun, fp->rval);
DTrace::exitJSFun(cx, fp, fun, fp->getReturnValue());
if (hookData) {
hook = cx->debugHooks->callHook;
@ -643,7 +647,7 @@ InvokeCommon(JSContext *cx, JSFunction *fun, JSScript *script, T native,
}
fp->putActivationObjects(cx);
args.rval() = fp->rval;
args.rval() = fp->getReturnValue();
return ok;
}
@ -666,7 +670,7 @@ DoSlowCall(JSContext *cx, uintN argc, Value *vp)
JSObject *obj = fp->getThisObject(cx);
if (!obj)
return false;
JS_ASSERT(ObjectValue(*obj) == fp->thisv);
JS_ASSERT(ObjectValue(*obj) == fp->getThisValue());
JSObject *callee = &JS_CALLEE(cx, vp).toObject();
Class *clasp = callee->getClass();
@ -857,11 +861,11 @@ Execute(JSContext *cx, JSObject *chain, JSScript *script,
if (script->hasSharps) {
JS_ASSERT(script->nfixed >= SHARP_NSLOTS);
Value *sharps = &fp->slots()[script->nfixed - SHARP_NSLOTS];
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)
: down->script->nfixed - SHARP_NSLOTS;
if (down && down->hasScript() && down->getScript()->hasSharps) {
JS_ASSERT(down->getFixedCount() >= SHARP_NSLOTS);
int base = (down->getFunction() && !(down->flags & JSFRAME_SPECIAL))
? down->getFunction()->sharpSlotBase(cx)
: down->getFixedCount() - SHARP_NSLOTS;
if (base < 0)
return false;
sharps[0] = down->slots()[base];
@ -879,8 +883,8 @@ Execute(JSContext *cx, JSObject *chain, JSScript *script,
/* Propagate arg state for eval and the debugger API. */
fp->setCallObj(down->maybeCallObj());
fp->setArgsObj(NULL);
fp->fun = (script->staticLevel > 0) ? down->fun : NULL;
fp->thisv = down->thisv;
fp->setFunction((script->staticLevel > 0) ? down->maybeFunction() : NULL);
fp->setThisValue(down->getThisValue());
fp->flags = flags;
fp->argc = down->argc;
fp->argv = down->argv;
@ -900,8 +904,8 @@ Execute(JSContext *cx, JSObject *chain, JSScript *script,
} else {
fp->setCallObj(NULL);
fp->setArgsObj(NULL);
fp->fun = NULL;
/* Ininitialize fp->thisv after pushExecuteFrame. */
fp->setFunction(NULL);
fp->setThisValue(UndefinedValue()); /* Make GC-safe until initialized below. */
fp->flags = flags;
fp->argc = 0;
fp->argv = NULL;
@ -920,8 +924,8 @@ Execute(JSContext *cx, JSObject *chain, JSScript *script,
JS_ASSERT(!initialVarObj->getOps()->defineProperty);
JS_ASSERT(!fp->hasIMacroPC());
fp->script = script;
fp->rval.setUndefined();
fp->setScript(script);
fp->clearReturnValue();
fp->setBlockChain(NULL);
/* Initialize regs. */
@ -936,7 +940,7 @@ Execute(JSContext *cx, JSObject *chain, JSScript *script,
JSObject *thisp = chain->thisObject(cx);
if (!thisp)
return false;
fp->thisv.setObject(*thisp);
fp->setThisValue(ObjectValue(*thisp));
}
void *hookData = NULL;
@ -946,7 +950,7 @@ Execute(JSContext *cx, JSObject *chain, JSScript *script,
AutoPreserveEnumerators preserve(cx);
JSBool ok = RunScript(cx, script, NULL, fp->getScopeChain());
if (result)
*result = fp->rval;
*result = fp->getReturnValue();
if (hookData) {
if (JSInterpreterHook hook = cx->debugHooks->executeHook)
@ -1410,16 +1414,16 @@ js::GetUpvar(JSContext *cx, uintN closureLevel, UpvarCookie cookie)
uintN slot = cookie.slot();
Value *vp;
if (!fp->fun || (fp->flags & JSFRAME_EVAL)) {
vp = fp->slots() + fp->script->nfixed;
} else if (slot < fp->fun->nargs) {
if (!fp->hasFunction() || (fp->flags & JSFRAME_EVAL)) {
vp = fp->slots() + fp->getFixedCount();
} else if (slot < fp->getArgumentCount()) {
vp = fp->argv;
} else if (slot == UpvarCookie::CALLEE_SLOT) {
vp = &fp->argv[-2];
slot = 0;
} else {
slot -= fp->fun->nargs;
JS_ASSERT(slot < fp->script->nslots);
slot -= fp->getArgumentCount();
JS_ASSERT(slot < fp->getSlotCount());
vp = fp->slots();
}
@ -1447,10 +1451,10 @@ js_TraceOpcode(JSContext *cx)
* Operations in prologues don't produce interesting values, and
* js_DecompileValueGenerator isn't set up to handle them anyway.
*/
if (cx->tracePrevPc && regs->pc >= fp->script->main) {
if (cx->tracePrevPc && regs->pc >= fp->getScript()->main) {
JSOp tracePrevOp = JSOp(*cx->tracePrevPc);
ndefs = js_GetStackDefs(cx, &js_CodeSpec[tracePrevOp], tracePrevOp,
fp->script, cx->tracePrevPc);
fp->getScript(), cx->tracePrevPc);
/*
* If there aren't that many elements on the stack, then we have
@ -1487,9 +1491,10 @@ js_TraceOpcode(JSContext *cx)
}
fprintf(tracefp, "%4u: ",
js_PCToLineNumber(cx, fp->script, fp->hasIMacroPC() ? fp->getIMacroPC() : regs->pc));
js_Disassemble1(cx, fp->script, regs->pc,
regs->pc - fp->script->code,
js_PCToLineNumber(cx, fp->getScript(),
fp->hasIMacroPC() ? fp->getIMacroPC() : regs->pc));
js_Disassemble1(cx, fp->getScript(), regs->pc,
regs->pc - fp->getScript()->code,
JS_FALSE, tracefp);
op = (JSOp) *regs->pc;
nuses = js_GetStackUses(&js_CodeSpec[op], op, regs->pc);
@ -1830,6 +1835,7 @@ namespace reprmeter {
#define PUSH_OBJECT_OR_NULL(obj) regs.sp++->setObjectOrNull(obj)
#define PUSH_HOLE() regs.sp++->setMagic(JS_ARRAY_HOLE)
#define POP_COPY_TO(v) v = *--regs.sp
#define POP_RETURN_VALUE() fp->setReturnValue(*--regs.sp)
#define POP_BOOLEAN(cx, vp, b) \
JS_BEGIN_MACRO \
@ -2250,7 +2256,7 @@ Interpret(JSContext *cx, JSStackFrame *entryFrame, uintN inlineCallCount)
/* Set registerized frame pointer and derived script pointer. */
JSStackFrame *fp = cx->fp;
JSScript *script = fp->script;
JSScript *script = fp->getScript();
JS_ASSERT(!script->isEmpty());
JS_ASSERT(script->length > 1);
JS_ASSERT(fp->thisv.isObjectOrNull());
@ -2317,7 +2323,7 @@ Interpret(JSContext *cx, JSStackFrame *entryFrame, uintN inlineCallCount)
#define RESTORE_INTERP_VARS() \
JS_BEGIN_MACRO \
fp = cx->fp; \
script = fp->script; \
script = fp->getScript(); \
atoms = FrameAtomBase(cx, fp); \
currentVersion = (JSVersion) script->version; \
JS_ASSERT(cx->regs == &regs); \
@ -2549,7 +2555,7 @@ Interpret(JSContext *cx, JSStackFrame *entryFrame, uintN inlineCallCount)
case JSTRAP_CONTINUE:
break;
case JSTRAP_RETURN:
fp->rval = rval;
fp->setReturnValue(rval);
interpReturnOK = JS_TRUE;
goto forced_return;
case JSTRAP_THROW:
@ -2666,7 +2672,7 @@ END_CASE(JSOP_POPN)
BEGIN_CASE(JSOP_SETRVAL)
BEGIN_CASE(JSOP_POPV)
ASSERT_NOT_THROWING(cx);
POP_COPY_TO(fp->rval);
POP_RETURN_VALUE();
END_CASE(JSOP_POPV)
BEGIN_CASE(JSOP_ENTERWITH)
@ -2692,10 +2698,10 @@ BEGIN_CASE(JSOP_LEAVEWITH)
END_CASE(JSOP_LEAVEWITH)
BEGIN_CASE(JSOP_RETURN)
POP_COPY_TO(fp->rval);
POP_RETURN_VALUE();
/* FALL THROUGH */
BEGIN_CASE(JSOP_RETRVAL) /* fp->rval already set */
BEGIN_CASE(JSOP_RETRVAL) /* fp return value already set */
BEGIN_CASE(JSOP_STOP)
{
/*
@ -2734,9 +2740,9 @@ BEGIN_CASE(JSOP_STOP)
#endif
JS_ASSERT(regs.sp == fp->base());
if ((fp->flags & JSFRAME_CONSTRUCTING) && fp->rval.isPrimitive()) {
JS_ASSERT(!fp->thisv.isPrimitive());
fp->rval = fp->thisv;
if ((fp->flags & JSFRAME_CONSTRUCTING) && fp->getReturnValue().isPrimitive()) {
JS_ASSERT(!fp->getThisValue().isPrimitive());
fp->setReturnValue(fp->getThisValue());
}
interpReturnOK = true;
@ -2760,7 +2766,7 @@ BEGIN_CASE(JSOP_STOP)
*/
fp->putActivationObjects(cx);
DTrace::exitJSFun(cx, fp, fp->fun, fp->rval);
DTrace::exitJSFun(cx, fp, fp->getFunction(), fp->getReturnValue());
/* Restore context version only if callee hasn't set version. */
if (JS_LIKELY(cx->version == currentVersion)) {
@ -2774,9 +2780,9 @@ BEGIN_CASE(JSOP_STOP)
* passed in via |this|, and instrument this constructor invocation.
*/
if (fp->flags & JSFRAME_CONSTRUCTING) {
if (fp->rval.isPrimitive()) {
JS_ASSERT(!fp->thisv.isPrimitive());
fp->rval = fp->thisv;
if (fp->getReturnValue().isPrimitive()) {
JS_ASSERT(!fp->getThisValue().isPrimitive());
fp->setReturnValue(fp->getThisValue());
}
JS_RUNTIME_METER(cx->runtime, constructs);
}
@ -2789,11 +2795,11 @@ BEGIN_CASE(JSOP_STOP)
/* Propagate return value before fp is lost. */
regs.sp = newsp;
regs.sp[-1] = fp->rval;
regs.sp[-1] = fp->getReturnValue();
/* Sync interpreter registers. */
fp = cx->fp;
script = fp->script;
script = fp->getScript();
atoms = FrameAtomBase(cx, fp);
/* Resume execution in the calling frame. */
@ -3046,7 +3052,7 @@ BEGIN_CASE(JSOP_FORARG)
{
JS_ASSERT(regs.sp - 1 >= fp->base());
uintN slot = GET_ARGNO(regs.pc);
JS_ASSERT(slot < fp->fun->nargs);
JS_ASSERT(slot < fp->getArgumentCount());
JS_ASSERT(regs.sp[-1].isObject());
if (!IteratorNext(cx, &regs.sp[-1].toObject(), &fp->argv[slot]))
goto error;
@ -3057,7 +3063,7 @@ BEGIN_CASE(JSOP_FORLOCAL)
{
JS_ASSERT(regs.sp - 1 >= fp->base());
uintN slot = GET_SLOTNO(regs.pc);
JS_ASSERT(slot < fp->script->nslots);
JS_ASSERT(slot < fp->getSlotCount());
JS_ASSERT(regs.sp[-1].isObject());
if (!IteratorNext(cx, &regs.sp[-1].toObject(), &fp->slots()[slot]))
goto error;
@ -3979,7 +3985,7 @@ BEGIN_CASE(JSOP_ARGINC)
do_arg_incop:
// If we initialize in the declaration, MSVC complains that the labels skip init.
slot = GET_ARGNO(regs.pc);
JS_ASSERT(slot < fp->fun->nargs);
JS_ASSERT(slot < fp->getArgumentCount());
METER_SLOT_OP(op, slot);
vp = fp->argv + slot;
goto do_int_fast_incop;
@ -4000,7 +4006,7 @@ BEGIN_CASE(JSOP_LOCALINC)
*/
do_local_incop:
slot = GET_SLOTNO(regs.pc);
JS_ASSERT(slot < fp->script->nslots);
JS_ASSERT(slot < fp->getSlotCount());
vp = fp->slots() + slot;
METER_SLOT_OP(op, slot);
vp = fp->slots() + slot;
@ -4025,7 +4031,7 @@ BEGIN_CASE(JSOP_LOCALINC)
BEGIN_CASE(JSOP_THIS)
if (!fp->getThisObject(cx))
goto error;
PUSH_COPY(fp->thisv);
PUSH_COPY(fp->getThisValue());
END_CASE(JSOP_THIS)
BEGIN_CASE(JSOP_UNBRANDTHIS)
@ -4055,7 +4061,7 @@ BEGIN_CASE(JSOP_GETARGPROP)
{
i = ARGNO_LEN;
uint32 slot = GET_ARGNO(regs.pc);
JS_ASSERT(slot < fp->fun->nargs);
JS_ASSERT(slot < fp->getArgumentCount());
PUSH_COPY(fp->argv[slot]);
goto do_getprop_body;
}
@ -4722,18 +4728,18 @@ BEGIN_CASE(JSOP_APPLY)
/* Initialize stack frame. */
newfp->setCallObj(NULL);
newfp->setArgsObj(NULL);
newfp->script = newscript;
newfp->fun = fun;
newfp->setScript(newscript);
newfp->setFunction(fun);
newfp->argc = argc;
newfp->argv = vp + 2;
newfp->rval.setUndefined();
newfp->clearReturnValue();
newfp->setAnnotation(NULL);
newfp->setScopeChain(obj->getParent());
newfp->flags = flags;
newfp->setBlockChain(NULL);
JS_ASSERT(!JSFUN_BOUND_METHOD_TEST(fun->flags));
JS_ASSERT_IF(!vp[1].isPrimitive(), IsSaneThisObject(vp[1].toObject()));
newfp->thisv = vp[1];
newfp->setThisValue(vp[1]);
JS_ASSERT(!newfp->hasIMacroPC());
/* Push void to initialize local variables. */
@ -5224,7 +5230,7 @@ BEGIN_CASE(JSOP_TRAP)
case JSTRAP_ERROR:
goto error;
case JSTRAP_RETURN:
fp->rval = rval;
fp->setReturnValue(rval);
interpReturnOK = JS_TRUE;
goto forced_return;
case JSTRAP_THROW:
@ -5275,7 +5281,7 @@ BEGIN_CASE(JSOP_GETARG)
BEGIN_CASE(JSOP_CALLARG)
{
uint32 slot = GET_ARGNO(regs.pc);
JS_ASSERT(slot < fp->fun->nargs);
JS_ASSERT(slot < fp->getArgumentCount());
METER_SLOT_OP(op, slot);
PUSH_COPY(fp->argv[slot]);
if (op == JSOP_CALLARG)
@ -5286,7 +5292,7 @@ END_CASE(JSOP_GETARG)
BEGIN_CASE(JSOP_SETARG)
{
uint32 slot = GET_ARGNO(regs.pc);
JS_ASSERT(slot < fp->fun->nargs);
JS_ASSERT(slot < fp->getArgumentCount());
METER_SLOT_OP(op, slot);
fp->argv[slot] = regs.sp[-1];
}
@ -5336,7 +5342,7 @@ END_CASE(JSOP_GETUPVAR)
BEGIN_CASE(JSOP_GETUPVAR_DBG)
BEGIN_CASE(JSOP_CALLUPVAR_DBG)
{
JSFunction *fun = fp->fun;
JSFunction *fun = fp->getFunction();
JS_ASSERT(FUN_KIND(fun) == JSFUN_INTERPRETED);
JS_ASSERT(fun->u.i.wrapper);
@ -6218,7 +6224,7 @@ END_CASE(JSOP_INITELEM)
BEGIN_CASE(JSOP_DEFSHARP)
{
uint32 slot = GET_UINT16(regs.pc);
JS_ASSERT(slot + 1 < fp->script->nfixed);
JS_ASSERT(slot + 1 < fp->getFixedCount());
const Value &lref = fp->slots()[slot];
JSObject *obj;
if (lref.isObject()) {
@ -6248,7 +6254,7 @@ END_CASE(JSOP_DEFSHARP)
BEGIN_CASE(JSOP_USESHARP)
{
uint32 slot = GET_UINT16(regs.pc);
JS_ASSERT(slot + 1 < fp->script->nfixed);
JS_ASSERT(slot + 1 < fp->getFixedCount());
const Value &lref = fp->slots()[slot];
jsint i = (jsint) GET_UINT16(regs.pc + UINT16_LEN);
Value rval;
@ -6275,7 +6281,7 @@ END_CASE(JSOP_USESHARP)
BEGIN_CASE(JSOP_SHARPINIT)
{
uint32 slot = GET_UINT16(regs.pc);
JS_ASSERT(slot + 1 < fp->script->nfixed);
JS_ASSERT(slot + 1 < fp->getFixedCount());
Value *vp = &fp->slots()[slot];
Value rval = vp[1];
@ -6437,7 +6443,7 @@ BEGIN_CASE(JSOP_DEBUGGER)
case JSTRAP_CONTINUE:
break;
case JSTRAP_RETURN:
fp->rval = rval;
fp->setReturnValue(rval);
interpReturnOK = JS_TRUE;
goto forced_return;
case JSTRAP_THROW:
@ -6827,7 +6833,7 @@ BEGIN_CASE(JSOP_GENERATOR)
if (!obj)
goto error;
JS_ASSERT(!fp->hasCallObj() && !fp->hasArgsObj());
fp->rval.setObject(*obj);
fp->setReturnValue(ObjectValue(*obj));
interpReturnOK = true;
if (entryFrame != fp)
goto inline_return;
@ -6841,7 +6847,7 @@ BEGIN_CASE(JSOP_YIELD)
JSDVG_SEARCH_STACK, fp->argv[-2], NULL);
goto error;
}
fp->rval = regs.sp[-1];
fp->setReturnValue(regs.sp[-1]);
fp->flags |= JSFRAME_YIELDING;
regs.pc += JSOP_YIELD_LENGTH;
interpReturnOK = JS_TRUE;
@ -6970,7 +6976,7 @@ END_CASE(JSOP_ARRAYPUSH)
goto error;
case JSTRAP_RETURN:
cx->throwing = JS_FALSE;
fp->rval = rval;
fp->setReturnValue(rval);
interpReturnOK = JS_TRUE;
goto forced_return;
case JSTRAP_THROW:
@ -7035,7 +7041,7 @@ END_CASE(JSOP_ARRAYPUSH)
switch (tn->kind) {
case JSTRY_CATCH:
JS_ASSERT(js_GetOpcode(cx, fp->script, regs.pc) == JSOP_ENTERBLOCK);
JS_ASSERT(js_GetOpcode(cx, fp->getScript(), regs.pc) == JSOP_ENTERBLOCK);
#if JS_HAS_GENERATORS
/* Catch cannot intercept the closing of a generator. */
@ -7064,7 +7070,7 @@ END_CASE(JSOP_ARRAYPUSH)
case JSTRY_ITER: {
/* This is similar to JSOP_ENDITER in the interpreter loop. */
JS_ASSERT(js_GetOpcode(cx, fp->script, regs.pc) == JSOP_ENDITER);
JS_ASSERT(js_GetOpcode(cx, fp->getScript(), regs.pc) == JSOP_ENDITER);
AutoValueRooter tvr(cx, cx->exception);
cx->throwing = false;
ok = js_CloseIterator(cx, &regs.sp[-1].toObject());
@ -7088,7 +7094,7 @@ END_CASE(JSOP_ARRAYPUSH)
cx->exception.isMagic(JS_GENERATOR_CLOSING))) {
cx->throwing = JS_FALSE;
interpReturnOK = JS_TRUE;
fp->rval.setUndefined();
fp->clearReturnValue();
}
#endif
}

View File

@ -151,7 +151,7 @@ struct JSStackFrame
}
js::Value *base() const {
return slots() + script->nfixed;
return slots() + getScript()->nfixed;
}
/* Call object accessors */
@ -287,6 +287,33 @@ struct JSStackFrame
blockChain = obj;
}
/* IMacroPC accessors. */
bool hasIMacroPC() const { return flags & JSFRAME_IN_IMACRO; }
/*
* @pre hasIMacroPC
* @return The PC at which an imacro started executing (guaranteed non-null. The PC of the
* executing imacro must be in regs.pc, so the displaced
* original value is stored here.
*/
jsbytecode *getIMacroPC() const {
JS_ASSERT(flags & JSFRAME_IN_IMACRO);
return imacpc;
}
/* @return The imacro pc if hasIMacroPC; otherwise, NULL. */
jsbytecode *maybeIMacroPC() const { return hasIMacroPC() ? getIMacroPC() : NULL; }
void clearIMacroPC() { flags &= ~JSFRAME_IN_IMACRO; }
void setIMacroPC(jsbytecode *newIMacPC) {
JS_ASSERT(newIMacPC);
JS_ASSERT(!(flags & JSFRAME_IN_IMACRO));
imacpc = newIMacPC;
flags |= JSFRAME_IN_IMACRO;
}
/* Annotation accessors */
bool hasAnnotation() const {
@ -335,31 +362,90 @@ struct JSStackFrame
callerVersion = version;
}
/* IMacroPC accessors. */
/* Script accessors */
bool hasIMacroPC() const { return flags & JSFRAME_IN_IMACRO; }
/*
* @pre hasIMacroPC
* @return The PC at which an imacro started executing (guaranteed non-null. The PC of the
* executing imacro must be in regs.pc, so the displaced
* original value is stored here.
*/
jsbytecode *getIMacroPC() const {
JS_ASSERT(flags & JSFRAME_IN_IMACRO);
return imacpc;
bool hasScript() const {
return script != NULL;
}
/* @return The imacro pc if hasIMacroPC; otherwise, NULL. */
jsbytecode *maybeIMacroPC() const { return hasIMacroPC() ? getIMacroPC() : NULL; }
JSScript* getScript() const {
JS_ASSERT(hasScript());
return script;
}
void clearIMacroPC() { flags &= ~JSFRAME_IN_IMACRO; }
JSScript* maybeScript() const {
return script;
}
void setIMacroPC(jsbytecode *newIMacPC) {
JS_ASSERT(newIMacPC);
JS_ASSERT(!(flags & JSFRAME_IN_IMACRO));
imacpc = newIMacPC;
flags |= JSFRAME_IN_IMACRO;
size_t getFixedCount() const {
return getScript()->nfixed;
}
size_t getSlotCount() const {
return getScript()->nslots;
}
void setScript(JSScript *s) {
script = s;
}
static size_t offsetScript() {
return offsetof(JSStackFrame, script);
}
/* Function accessors */
bool hasFunction() const {
return fun != NULL;
}
JSFunction* getFunction() const {
JS_ASSERT(hasFunction());
return fun;
}
JSFunction* maybeFunction() const {
return fun;
}
size_t getArgumentCount() const {
return getFunction()->nargs;
}
void setFunction(JSFunction *f) {
fun = f;
}
/* This-value accessors */
const js::Value& getThisValue() {
return thisv;
}
void setThisValue(const js::Value &v) {
thisv = v;
}
/* Return-value accessors */
const js::Value& getReturnValue() {
return rval;
}
void setReturnValue(const js::Value &v) {
rval = v;
}
void clearReturnValue() {
rval.setUndefined();
}
js::Value* addressReturnValue() {
return &rval;
}
static size_t offsetReturnValue() {
return offsetof(JSStackFrame, rval);
}
/* Other accessors */
@ -427,6 +513,9 @@ struct JSStackFrame
private:
JSObject *computeThisObject(JSContext *cx);
/* Contains static assertions for member alignment, don't call. */
inline void staticAsserts();
};
namespace js {
@ -434,16 +523,20 @@ namespace js {
JS_STATIC_ASSERT(sizeof(JSStackFrame) % sizeof(Value) == 0);
static const size_t VALUES_PER_STACK_FRAME = sizeof(JSStackFrame) / sizeof(Value);
JS_STATIC_ASSERT(offsetof(JSStackFrame, rval) % sizeof(Value) == 0);
JS_STATIC_ASSERT(offsetof(JSStackFrame, thisv) % sizeof(Value) == 0);
} /* namespace js */
inline void
JSStackFrame::staticAsserts()
{
JS_STATIC_ASSERT(offsetof(JSStackFrame, rval) % sizeof(js::Value) == 0);
JS_STATIC_ASSERT(offsetof(JSStackFrame, thisv) % sizeof(js::Value) == 0);
}
static JS_INLINE uintN
GlobalVarCount(JSStackFrame *fp)
{
JS_ASSERT(!fp->fun);
return fp->script->nfixed;
JS_ASSERT(!fp->hasFunction());
return fp->getScript()->nfixed;
}
/*

View File

@ -1142,7 +1142,7 @@ js_NewGenerator(JSContext *cx)
/* Load and compute stack slot counts. */
JSStackFrame *fp = cx->fp;
uintN argc = fp->argc;
uintN nargs = JS_MAX(argc, fp->fun->nargs);
uintN nargs = JS_MAX(argc, fp->getArgumentCount());
uintN vplen = 2 + nargs;
/* Compute JSGenerator size. */
@ -1150,7 +1150,7 @@ js_NewGenerator(JSContext *cx)
(-1 + /* one Value included in JSGenerator */
vplen +
VALUES_PER_STACK_FRAME +
fp->script->nslots) * sizeof(Value);
fp->getSlotCount()) * sizeof(Value);
JSGenerator *gen = (JSGenerator *) cx->malloc(nbytes);
if (!gen)
@ -1165,8 +1165,8 @@ js_NewGenerator(JSContext *cx)
gen->obj = obj;
gen->state = JSGEN_NEWBORN;
gen->savedRegs.pc = cx->regs->pc;
JS_ASSERT(cx->regs->sp == fp->slots() + fp->script->nfixed);
gen->savedRegs.sp = slots + fp->script->nfixed;
JS_ASSERT(cx->regs->sp == fp->slots() + fp->getFixedCount());
gen->savedRegs.sp = slots + fp->getFixedCount();
gen->vplen = vplen;
gen->enumerators = NULL;
gen->liveFrame = newfp;
@ -1182,12 +1182,12 @@ js_NewGenerator(JSContext *cx)
fp->getArgsObj()->setPrivate(newfp);
fp->setArgsObj(NULL);
}
newfp->script = fp->script;
newfp->fun = fp->fun;
newfp->thisv = fp->thisv;
newfp->setScript(fp->getScript());
newfp->setFunction(fp->getFunction());
newfp->setThisValue(fp->getThisValue());
newfp->argc = fp->argc;
newfp->argv = vp + 2;
newfp->rval = fp->rval;
newfp->setReturnValue(fp->getReturnValue());
newfp->setAnnotation(NULL);
newfp->setScopeChain(fp->maybeScopeChain());
JS_ASSERT(!fp->hasBlockChain());
@ -1197,7 +1197,7 @@ js_NewGenerator(JSContext *cx)
/* Copy in arguments and slots. */
memcpy(vp, fp->argv - 2, vplen * sizeof(Value));
memcpy(slots, fp->slots(), fp->script->nfixed * sizeof(Value));
memcpy(slots, fp->slots(), fp->getFixedCount() * sizeof(Value));
obj->setPrivate(gen);
return obj;
@ -1230,7 +1230,7 @@ SendToGenerator(JSContext *cx, JSGeneratorOp op, JSObject *obj,
if (gen->state == JSGEN_RUNNING || gen->state == JSGEN_CLOSING) {
js_ReportValueError(cx, JSMSG_NESTING_GENERATOR,
JSDVG_SEARCH_STACK, ObjectOrNullValue(obj),
JS_GetFunctionId(gen->getFloatingFrame()->fun));
JS_GetFunctionId(gen->getFloatingFrame()->getFunction()));
return JS_FALSE;
}
@ -1269,7 +1269,7 @@ SendToGenerator(JSContext *cx, JSGeneratorOp op, JSObject *obj,
{
Value *genVp = gen->floatingStack;
uintN vplen = gen->vplen;
uintN nfixed = genfp->script->nslots;
uintN nfixed = genfp->getSlotCount();
/*
* Get a pointer to new frame/slots. This memory is not "claimed", so
@ -1293,7 +1293,7 @@ SendToGenerator(JSContext *cx, JSGeneratorOp op, JSObject *obj,
fp->flags &= ~JSFRAME_FLOATING_GENERATOR;
fp->argv = vp + 2;
gen->savedRegs.sp = fp->slots() + (gen->savedRegs.sp - genfp->slots());
JS_ASSERT(uintN(gen->savedRegs.sp - fp->slots()) <= fp->script->nslots);
JS_ASSERT(uintN(gen->savedRegs.sp - fp->slots()) <= fp->getSlotCount());
#ifdef DEBUG
JSObject *callobjBefore = fp->maybeCallObj();
@ -1338,13 +1338,13 @@ SendToGenerator(JSContext *cx, JSGeneratorOp op, JSObject *obj,
JS_ASSERT_IF(callobjBefore, callobjBefore == fp->maybeCallObj());
/* Copy and rebase stack frame/args/slots. Restore "floating" flag. */
JS_ASSERT(uintN(gen->savedRegs.sp - fp->slots()) <= fp->script->nslots);
JS_ASSERT(uintN(gen->savedRegs.sp - fp->slots()) <= fp->getSlotCount());
uintN usedAfter = gen->savedRegs.sp - vp;
memcpy(genVp, vp, usedAfter * sizeof(Value));
genfp->flags |= JSFRAME_FLOATING_GENERATOR;
genfp->argv = genVp + 2;
gen->savedRegs.sp = genfp->slots() + (gen->savedRegs.sp - fp->slots());
JS_ASSERT(uintN(gen->savedRegs.sp - genfp->slots()) <= genfp->script->nslots);
JS_ASSERT(uintN(gen->savedRegs.sp - genfp->slots()) <= genfp->getSlotCount());
}
if (gen->getFloatingFrame()->flags & JSFRAME_YIELDING) {
@ -1358,7 +1358,7 @@ SendToGenerator(JSContext *cx, JSGeneratorOp op, JSObject *obj,
return JS_TRUE;
}
genfp->rval.setUndefined();
genfp->clearReturnValue();
gen->state = JSGEN_CLOSED;
if (ok) {
/* Returned, explicitly or by falling off the end. */
@ -1447,7 +1447,7 @@ generator_op(JSContext *cx, JSGeneratorOp op, Value *vp, uintN argc)
bool undef = ((op == JSGENOP_SEND || op == JSGENOP_THROW) && argc != 0);
if (!SendToGenerator(cx, op, obj, gen, undef ? vp[2] : UndefinedValue()))
return JS_FALSE;
*vp = gen->getFloatingFrame()->rval;
*vp = gen->getFloatingFrame()->getReturnValue();
return JS_TRUE;
}

View File

@ -951,7 +951,7 @@ js_ComputeFilename(JSContext *cx, JSStackFrame *caller,
#endif
JS_ASSERT(principals || !(callbacks && callbacks->findObjectPrincipals));
flags = JS_GetScriptFilenameFlags(caller->script);
flags = JS_GetScriptFilenameFlags(caller->getScript());
if ((flags & JSFILENAME_PROTECTED) &&
principals &&
strcmp(principals->codebase, "[System Principal]")) {
@ -960,13 +960,13 @@ js_ComputeFilename(JSContext *cx, JSStackFrame *caller,
}
jsbytecode *pc = caller->pc(cx);
if (pc && js_GetOpcode(cx, caller->script, pc) == JSOP_EVAL) {
JS_ASSERT(js_GetOpcode(cx, caller->script, pc + JSOP_EVAL_LENGTH) == JSOP_LINENO);
if (pc && js_GetOpcode(cx, caller->getScript(), pc) == JSOP_EVAL) {
JS_ASSERT(js_GetOpcode(cx, caller->getScript(), pc + JSOP_EVAL_LENGTH) == JSOP_LINENO);
*linenop = GET_UINT16(pc + JSOP_EVAL_LENGTH);
} else {
*linenop = js_FramePCToLineNumber(cx, caller);
}
return caller->script->filename;
return caller->getScript()->filename;
}
#ifndef EVAL_CACHE_CHAIN_LIMIT
@ -1053,18 +1053,18 @@ obj_eval(JSContext *cx, uintN argc, Value *vp)
* when evaluating the code string. Warn when such uses are seen so that
* authors will know that support for eval(s, o) has been removed.
*/
if (argc > 1 && !caller->script->warnedAboutTwoArgumentEval) {
if (argc > 1 && !caller->getScript()->warnedAboutTwoArgumentEval) {
static const char TWO_ARGUMENT_WARNING[] =
"Support for eval(code, scopeObject) has been removed. "
"Use |with (scopeObject) eval(code);| instead.";
if (!JS_ReportWarning(cx, TWO_ARGUMENT_WARNING))
return JS_FALSE;
caller->script->warnedAboutTwoArgumentEval = true;
caller->getScript()->warnedAboutTwoArgumentEval = true;
}
/* From here on, control must exit through label out with ok set. */
MUST_FLOW_THROUGH("out");
uintN staticLevel = caller->script->staticLevel + 1;
uintN staticLevel = caller->getScript()->staticLevel + 1;
/*
* Bring fp->scopeChain up to date. We're either going to use
@ -1141,7 +1141,7 @@ obj_eval(JSContext *cx, uintN argc, Value *vp)
* calls to eval from global code are not cached.
*/
JSScript **bucket = EvalCacheHash(cx, str);
if (!indirectCall && caller->fun) {
if (!indirectCall && caller->hasFunction()) {
uintN count = 0;
JSScript **scriptp = bucket;
@ -1159,7 +1159,7 @@ obj_eval(JSContext *cx, uintN argc, Value *vp)
*/
JSFunction *fun = script->getFunction(0);
if (fun == caller->fun) {
if (fun == caller->getFunction()) {
/*
* Get the source string passed for safekeeping in the
* atom map by the prior eval to Compiler::compileScript.
@ -2694,7 +2694,7 @@ Detecting(JSContext *cx, jsbytecode *pc)
JSOp op;
JSAtom *atom;
script = cx->fp->script;
script = cx->fp->getScript();
endpc = script->code + script->length;
for (;; pc += js_CodeSpec[op].length) {
JS_ASSERT_IF(!cx->fp->hasIMacroPC(), script->code <= pc && pc < endpc);
@ -2768,7 +2768,7 @@ js_InferFlags(JSContext *cx, uintN defaultFlags)
JSStackFrame *const fp = js_GetTopStackFrame(cx);
if (!fp || !(pc = cx->regs->pc))
return defaultFlags;
cs = &js_CodeSpec[js_GetOpcode(cx, fp->script, pc)];
cs = &js_CodeSpec[js_GetOpcode(cx, fp->getScript(), pc)];
format = cs->format;
if (JOF_MODE(format) != JOF_NAME)
flags |= JSRESOLVE_QUALIFIED;
@ -2777,7 +2777,7 @@ js_InferFlags(JSContext *cx, uintN defaultFlags)
flags |= JSRESOLVE_ASSIGNING;
} else if (cs->length >= 0) {
pc += cs->length;
if (pc < cx->fp->script->code + cx->fp->script->length && Detecting(cx, pc))
if (pc < cx->fp->getScript()->code + cx->fp->getScript()->length && Detecting(cx, pc))
flags |= JSRESOLVE_DETECTING;
}
if (format & JOF_DECLARING)
@ -2979,7 +2979,7 @@ js_PutBlockObject(JSContext *cx, JSBool normalUnwind)
/* See comments in CheckDestructuring from jsparse.cpp. */
JS_ASSERT(count >= 1);
depth += fp->script->nfixed;
depth += fp->getFixedCount();
obj->fslots[JSSLOT_BLOCK_DEPTH + 1] = fp->slots()[depth];
if (normalUnwind && count > 1) {
--count;
@ -3008,8 +3008,8 @@ block_getProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp)
JSStackFrame *fp = (JSStackFrame *) obj->getPrivate();
if (fp) {
fp = js_LiveFrameIfGenerator(fp);
index += fp->script->nfixed + OBJ_BLOCK_DEPTH(cx, obj);
JS_ASSERT(index < fp->script->nslots);
index += fp->getFixedCount() + OBJ_BLOCK_DEPTH(cx, obj);
JS_ASSERT(index < fp->getSlotCount());
*vp = fp->slots()[index];
return true;
}
@ -3034,8 +3034,8 @@ block_setProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp)
JSStackFrame *fp = (JSStackFrame *) obj->getPrivate();
if (fp) {
fp = js_LiveFrameIfGenerator(fp);
index += fp->script->nfixed + OBJ_BLOCK_DEPTH(cx, obj);
JS_ASSERT(index < fp->script->nslots);
index += fp->getFixedCount() + OBJ_BLOCK_DEPTH(cx, obj);
JS_ASSERT(index < fp->getSlotCount());
fp->slots()[index] = *vp;
return true;
}
@ -4777,7 +4777,7 @@ js_GetPropertyHelper(JSContext *cx, JSObject *obj, jsid id, uintN getHow,
op = (JSOp) *pc;
if (op == JSOP_TRAP) {
JS_ASSERT_NOT_ON_TRACE(cx);
op = JS_GetTrapOpcode(cx, cx->fp->script, pc);
op = JS_GetTrapOpcode(cx, cx->fp->getScript(), pc);
}
if (op == JSOP_GETXPROP) {
flags = JSREPORT_ERROR;
@ -4869,7 +4869,7 @@ js_CheckUndeclaredVarAssignment(JSContext *cx, JSString *propname)
return true;
/* If neither cx nor the code is strict, then no check is needed. */
if (!(fp->script && fp->script->strictModeCode) &&
if (!(fp->hasScript() && fp->getScript()->strictModeCode) &&
!JS_HAS_STRICT_OPTION(cx)) {
return true;
}
@ -5266,8 +5266,8 @@ js_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval)
if (fun != funobj) {
for (JSStackFrame *fp = cx->fp; fp; fp = fp->down) {
if (fp->callee() == fun &&
fp->thisv.isObject() &&
&fp->thisv.toObject() == obj) {
fp->getThisValue().isObject() &&
&fp->getThisValue().toObject() == obj) {
fp->setCalleeObject(*funobj);
}
}
@ -6371,11 +6371,13 @@ js_DumpStackFrame(JSContext *cx, JSStackFrame *start)
}
fputc('\n', stderr);
if (fp->script)
fprintf(stderr, "file %s line %u\n", fp->script->filename, (unsigned) fp->script->lineno);
if (fp->hasScript()) {
fprintf(stderr, "file %s line %u\n",
fp->getScript()->filename, (unsigned) fp->getScript()->lineno);
}
if (jsbytecode *pc = i.pc()) {
if (!fp->script) {
if (!fp->hasScript()) {
fprintf(stderr, "*** pc && !script, skipping frame\n\n");
continue;
}
@ -6401,9 +6403,9 @@ js_DumpStackFrame(JSContext *cx, JSStackFrame *start)
fprintf(stderr, " argv: %p (argc: %u)\n", (void *) fp->argv, (unsigned) fp->argc);
MaybeDumpObject("callobj", fp->maybeCallObj());
MaybeDumpObject("argsobj", fp->maybeArgsObj());
MaybeDumpValue("this", fp->thisv);
MaybeDumpValue("this", fp->getThisValue());
fprintf(stderr, " rval: ");
dumpValue(fp->rval);
dumpValue(fp->getReturnValue());
fputc('\n', stderr);
fprintf(stderr, " flags:");

View File

@ -279,7 +279,7 @@ js_Disassemble(JSContext *cx, JSScript *script, JSBool lines, FILE *fp)
JS_FRIEND_API(JSBool)
js_DumpPC(JSContext *cx)
{
return js_DisassembleAtPC(cx, cx->fp->script, true, stdout, cx->regs->pc);
return js_DisassembleAtPC(cx, cx->fp->getScript(), true, stdout, cx->regs->pc);
}
JSBool
@ -2883,8 +2883,8 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop)
if (fp) {
while (!(fp->flags & JSFRAME_EVAL))
fp = fp->down;
JS_ASSERT(fp->script == jp->script);
JS_ASSERT(fp->down->fun == jp->fun);
JS_ASSERT(fp->getScript() == jp->script);
JS_ASSERT(fp->down->getFunction() == jp->fun);
JS_ASSERT(FUN_INTERPRETED(jp->fun));
JS_ASSERT(jp->script != jp->fun->u.i.script);
JS_ASSERT(jp->script->upvarsOffset != 0);
@ -5117,14 +5117,14 @@ js_DecompileValueGenerator(JSContext *cx, intN spindex, jsval v_in,
/* Get scripted caller */
FrameRegsIter i(cx);
while (!i.done() && !i.fp()->script)
while (!i.done() && !i.fp()->hasScript())
++i;
if (i.done() || !i.pc() || i.fp()->script->nslots == 0)
if (i.done() || !i.pc() || i.fp()->getSlotCount() == 0)
goto do_fallback;
fp = i.fp();
script = fp->script;
script = fp->getScript();
pc = fp->hasIMacroPC() ? fp->getIMacroPC() : i.pc();
JS_ASSERT(pc >= script->main && pc < script->code + script->length);
@ -5205,7 +5205,7 @@ js_DecompileValueGenerator(JSContext *cx, intN spindex, jsval v_in,
if (savedIMacroPC && size_t(pc - script->code) >= script->length)
name = FAILED_EXPRESSION_DECOMPILER;
else
name = DecompileExpression(cx, script, fp->fun, pc);
name = DecompileExpression(cx, script, fp->maybeFunction(), pc);
if (savedIMacroPC) {
if (fp == cx->fp)

View File

@ -792,8 +792,8 @@ Compiler::compileScript(JSContext *cx, JSObject *scopeChain, JSStackFrame *calle
/* If this is a direct call to eval, inherit the caller's strictness. */
if (callerFrame &&
callerFrame->script &&
callerFrame->script->strictModeCode) {
callerFrame->hasScript() &&
callerFrame->getScript()->strictModeCode) {
cg.flags |= TCF_STRICT_MODE_CODE;
tokenStream.setStrictMode();
}
@ -816,13 +816,13 @@ Compiler::compileScript(JSContext *cx, JSObject *scopeChain, JSStackFrame *calle
goto out;
}
if (callerFrame && callerFrame->fun) {
if (callerFrame && callerFrame->hasFunction()) {
/*
* An eval script in a caller frame needs to have its enclosing
* function captured in case it refers to an upvar, and someone
* wishes to decompile it while it's running.
*/
funbox = parser.newObjectBox(FUN_OBJECT(callerFrame->fun));
funbox = parser.newObjectBox(FUN_OBJECT(callerFrame->getFunction()));
if (!funbox)
goto out;
funbox->emitLink = cg.objectList.lastbox;

View File

@ -967,7 +967,7 @@ struct Parser : private js::AutoGCRooter
{
js::PodArrayZero(tempFreeList);
setPrincipals(prin);
JS_ASSERT_IF(cfp, cfp->script);
JS_ASSERT_IF(cfp, cfp->hasScript());
}
~Parser();

View File

@ -128,7 +128,7 @@ PropertyCache::fill(JSContext *cx, JSObject *obj, uintN scopeIndex, uintN protoI
* opcode format flags.
*/
pc = cx->regs->pc;
op = js_GetOpcode(cx, cx->fp->script, pc);
op = js_GetOpcode(cx, cx->fp->getScript(), pc);
cs = &js_CodeSpec[op];
kshape = 0;
@ -322,7 +322,7 @@ GetAtomFromBytecode(JSContext *cx, jsbytecode *pc, JSOp op, const JSCodeSpec &cs
ptrdiff_t pcoff = (JOF_TYPE(cs.format) == JOF_SLOTATOM) ? SLOTNO_LEN : 0;
JSAtom *atom;
GET_ATOM_FROM_BYTECODE(cx->fp->script, pc, pcoff, atom);
GET_ATOM_FROM_BYTECODE(cx->fp->getScript(), pc, pcoff, atom);
return atom;
}
@ -334,10 +334,11 @@ PropertyCache::fullTest(JSContext *cx, jsbytecode *pc, JSObject **objp, JSObject
uint32 vcap;
JS_ASSERT(this == &JS_PROPERTY_CACHE(cx));
JS_ASSERT(uintN((cx->fp->hasIMacroPC() ? cx->fp->getIMacroPC() : pc) - cx->fp->script->code)
< cx->fp->script->length);
JS_ASSERT(
uintN((cx->fp->hasIMacroPC() ? cx->fp->getIMacroPC() : pc) - cx->fp->getScript()->code)
< cx->fp->getScript()->length);
JSOp op = js_GetOpcode(cx, cx->fp->script, pc);
JSOp op = js_GetOpcode(cx, cx->fp->getScript(), pc);
const JSCodeSpec &cs = js_CodeSpec[op];
obj = *objp;

View File

@ -213,7 +213,7 @@ JS_REQUIRES_STACK AbortableRecordingStatus
TraceRecorder::upRecursion()
{
JS_ASSERT((JSOp)*cx->fp->down->savedPC == JSOP_CALL);
JS_ASSERT(js_CodeSpec[js_GetOpcode(cx, cx->fp->down->script,
JS_ASSERT(js_CodeSpec[js_GetOpcode(cx, cx->fp->down->getScript(),
cx->fp->down->savedPC)].length == JSOP_CALL_LENGTH);
JS_ASSERT(callDepth == 0);
@ -390,7 +390,7 @@ JS_REQUIRES_STACK AbortableRecordingStatus
TraceRecorder::slurpDownFrames(jsbytecode* return_pc)
{
/* Missing - no go */
if (cx->fp->argc != cx->fp->fun->nargs)
if (cx->fp->argc != cx->fp->getArgumentCount())
RETURN_STOP_A("argc != nargs");
LIns* argv_ins;
@ -432,9 +432,9 @@ TraceRecorder::slurpDownFrames(jsbytecode* return_pc)
guard(true,
lir->ins2(LIR_eqp,
addName(lir->insLoad(LIR_ldp, fp_ins,
offsetof(JSStackFrame, script), ACCSET_OTHER),
JSStackFrame::offsetScript(), ACCSET_OTHER),
"script"),
INS_CONSTPTR(cx->fp->down->script)),
INS_CONSTPTR(cx->fp->down->getScript())),
RECURSIVE_LOOP_EXIT);
}
@ -591,7 +591,7 @@ TraceRecorder::slurpDownFrames(jsbytecode* return_pc)
/* this */
slurpSlot(argv_ins, -1 * ptrdiff_t(sizeof(Value)), &fp->argv[-1], &info);
/* args[0..n] */
for (unsigned i = 0; i < JS_MAX(fp->argc, fp->fun->nargs); i++)
for (unsigned i = 0; i < JS_MAX(fp->argc, fp->getArgumentCount()); i++)
slurpSlot(argv_ins, i * sizeof(Value), &fp->argv[i], &info);
/* argsobj */
slurpFrameObjPtrSlot(fp_ins, JSStackFrame::offsetArgsObj(), fp->addressArgsObj(), &info);
@ -600,10 +600,10 @@ TraceRecorder::slurpDownFrames(jsbytecode* return_pc)
/* vars */
LIns* slots_ins = addName(lir->ins2(LIR_addp, fp_ins, INS_CONSTWORD(sizeof(JSStackFrame))),
"slots");
for (unsigned i = 0; i < fp->script->nfixed; i++)
for (unsigned i = 0; i < fp->getFixedCount(); i++)
slurpSlot(slots_ins, i * sizeof(Value), &fp->slots()[i], &info);
/* stack vals */
unsigned nfixed = fp->script->nfixed;
unsigned nfixed = fp->getFixedCount();
Value* stack = fp->base();
LIns* stack_ins = addName(lir->ins2(LIR_addp,
slots_ins,
@ -614,7 +614,7 @@ TraceRecorder::slurpDownFrames(jsbytecode* return_pc)
if (anchor && anchor->exitType == RECURSIVE_SLURP_FAIL_EXIT)
limit--;
else
limit -= fp->fun->nargs + 2;
limit -= fp->getArgumentCount() + 2;
for (size_t i = 0; i < limit; i++)
slurpSlot(stack_ins, i * sizeof(Value), &stack[i], &info);
@ -673,14 +673,15 @@ JS_REQUIRES_STACK AbortableRecordingStatus
TraceRecorder::downRecursion()
{
JSStackFrame* fp = cx->fp;
if ((jsbytecode*)fragment->ip < fp->script->code ||
(jsbytecode*)fragment->ip >= fp->script->code + fp->script->length) {
JSScript *script = fp->getScript();
if ((jsbytecode*)fragment->ip < script->code ||
(jsbytecode*)fragment->ip >= script->code + script->length) {
RETURN_STOP_A("inner recursive call must compile first");
}
/* Adjust the stack by the budget the down-frame needs. */
int slots = NativeStackSlots(cx, 1) - NativeStackSlots(cx, 0);
JS_ASSERT(unsigned(slots) == NativeStackSlots(cx, 1) - fp->argc - 2 - fp->script->nfixed - 2);
JS_ASSERT(unsigned(slots) == NativeStackSlots(cx, 1) - fp->argc - 2 - fp->getFixedCount() - 2);
/* Guard that there is enough stack space. */
JS_ASSERT(tree->maxNativeStackSlots >= tree->nativeStackBase / sizeof(double));
@ -722,11 +723,11 @@ TraceRecorder::downRecursion()
* tree pc.
*/
VMSideExit* exit;
if ((jsbytecode*)fragment->root->ip == fp->script->code)
if ((jsbytecode*)fragment->root->ip == script->code)
exit = snapshot(UNSTABLE_LOOP_EXIT);
else
exit = snapshot(RECURSIVE_UNLINKED_EXIT);
exit->recursive_pc = fp->script->code;
exit->recursive_pc = script->code;
debug_only_print0(LC_TMTracer, "Compiling down-recursive function call.\n");
JS_ASSERT(tree->recursion != Recursion_Disallowed);
tree->recursion = Recursion_Detected;

View File

@ -1401,7 +1401,8 @@ js_GetSrcNoteCached(JSContext *cx, JSScript *script, jsbytecode *pc)
uintN
js_FramePCToLineNumber(JSContext *cx, JSStackFrame *fp)
{
return js_PCToLineNumber(cx, fp->script, fp->hasIMacroPC() ? fp->getIMacroPC() : fp->pc(cx));
return js_PCToLineNumber(cx, fp->getScript(),
fp->hasIMacroPC() ? fp->getIMacroPC() : fp->pc(cx));
}
uintN

View File

@ -1094,7 +1094,7 @@ Tracker::set(const void* v, LIns* i)
static inline jsuint
argSlots(JSStackFrame* fp)
{
return JS_MAX(fp->argc, fp->fun->nargs);
return JS_MAX(fp->argc, fp->getArgumentCount());
}
static inline bool
@ -1188,7 +1188,7 @@ static JS_REQUIRES_STACK inline int
StackSlotHash(JSContext* cx, unsigned slot, const void* pc)
{
uintptr_t h = HASH_SEED;
HashAccum(h, uintptr_t(cx->fp->script), ORACLE_MASK);
HashAccum(h, uintptr_t(cx->fp->getScript()), ORACLE_MASK);
HashAccum(h, uintptr_t(pc), ORACLE_MASK);
HashAccum(h, uintptr_t(slot), ORACLE_MASK);
return int(h);
@ -1203,7 +1203,7 @@ GlobalSlotHash(JSContext* cx, unsigned slot)
while (fp->down)
fp = fp->down;
HashAccum(h, uintptr_t(fp->script), ORACLE_MASK);
HashAccum(h, uintptr_t(fp->maybeScript()), ORACLE_MASK);
HashAccum(h, uintptr_t(fp->getScopeChain()->getGlobal()->shape()), ORACLE_MASK);
HashAccum(h, uintptr_t(slot), ORACLE_MASK);
return int(h);
@ -1535,11 +1535,11 @@ TreeFragment::initialize(JSContext* cx, SlotList *globalSlots, bool speculate)
this->spOffsetAtEntry = cx->regs->sp - cx->fp->base();
#ifdef DEBUG
this->treeFileName = cx->fp->script->filename;
this->treeFileName = cx->fp->getScript()->filename;
this->treeLineNumber = js_FramePCToLineNumber(cx, cx->fp);
this->treePCOffset = FramePCOffset(cx, cx->fp);
#endif
this->script = cx->fp->script;
this->script = cx->fp->getScript();
this->recursion = Recursion_None;
this->gcthings.clear();
this->sprops.clear();
@ -1828,17 +1828,17 @@ VisitFrameSlots(Visitor &visitor, JSContext *cx, unsigned depth,
if (!visitor.visitFrameObjPtr(fp->addressScopeChain(), fp))
return false;
visitor.setStackSlotKind("var");
if (!visitor.visitStackSlots(fp->slots(), fp->script->nfixed, fp))
if (!visitor.visitStackSlots(fp->slots(), fp->getFixedCount(), fp))
return false;
}
visitor.setStackSlotKind("stack");
Value *base = fp->base();
JS_ASSERT(sp >= base && sp <= fp->slots() + fp->script->nslots);
JS_ASSERT(sp >= base && sp <= fp->slots() + fp->getSlotCount());
if (!visitor.visitStackSlots(base, size_t(sp - base), fp))
return false;
if (up) {
int missing = up->fun->nargs - up->argc;
int missing = up->getArgumentCount() - up->argc;
if (missing > 0) {
visitor.setStackSlotKind("missing");
if (!visitor.visitStackSlots(sp, size_t(missing), fp))
@ -2000,7 +2000,7 @@ NativeStackSlots(JSContext *cx, unsigned callDepth)
JSStackFrame *const fp = i.fp();
slots += i.sp() - fp->base();
if (fp->argv)
slots += fp->script->nfixed + SPECIAL_FRAME_SLOTS;
slots += fp->getFixedCount() + SPECIAL_FRAME_SLOTS;
if (depth-- == 0) {
if (fp->argv)
slots += 2/*callee,this*/ + argSlots(fp);
@ -2011,7 +2011,7 @@ NativeStackSlots(JSContext *cx, unsigned callDepth)
#endif
return slots;
}
int missing = fp->fun->nargs - fp->argc;
int missing = fp->getArgumentCount() - fp->argc;
if (missing > 0)
slots += missing;
}
@ -2244,7 +2244,7 @@ TraceRecorder::TraceRecorder(JSContext* cx, VMSideExit* anchor, VMFragment* frag
global_dslots(NULL),
callDepth(anchor ? anchor->calldepth : 0),
atoms(FrameAtomBase(cx, cx->fp)),
consts(cx->fp->script->constOffset ? cx->fp->script->consts()->vector : NULL),
consts(cx->fp->getScript()->constOffset ? cx->fp->getScript()->consts()->vector : NULL),
cfgMerges(&tempAlloc()),
trashSelf(false),
whichTreesToTrash(&tempAlloc()),
@ -2489,7 +2489,7 @@ TraceRecorder::finishAbort(const char* reason)
tree->treeFileName,
tree->treeLineNumber,
tree->treePCOffset,
cx->fp->script->filename,
cx->fp->getScript()->filename,
js_FramePCToLineNumber(cx, cx->fp),
FramePCOffset(cx, cx->fp),
reason);
@ -2634,7 +2634,7 @@ TraceRecorder::nativeStackOffsetImpl(const void* p) const
*/
if (!visitor.stopped()) {
const Value *vp = (const Value *)p;
JS_ASSERT(size_t(vp - cx->fp->slots()) < cx->fp->script->nslots);
JS_ASSERT(size_t(vp - cx->fp->slots()) < cx->fp->getSlotCount());
offset += size_t(vp - cx->regs->sp) * sizeof(double);
}
return offset;
@ -3235,13 +3235,13 @@ GetUpvarVarOnTrace(JSContext* cx, uint32 upvarLevel, int32 slot, uint32 callDept
*/
struct UpvarStackTraits {
static Value interp_get(JSStackFrame* fp, int32 slot) {
return fp->slots()[slot + fp->script->nfixed];
return fp->slots()[slot + fp->getFixedCount()];
}
static uint32 native_slot(uint32 argc, int32 slot) {
/*
* Locals are not imported by the tracer when the frame has no
* function, so we do not add fp->script->nfixed.
* function, so we do not add fp->getFixedCount().
*/
JS_ASSERT(argc == 0);
return slot;
@ -3458,10 +3458,10 @@ FlushNativeStackFrame(JSContext* cx, unsigned callDepth, const JSValueType* mp,
JS_ASSERT(fp->argv[-1].isObjectOrNull());
JS_ASSERT(fp->callee()->isFunction());
JS_ASSERT(GET_FUNCTION_PRIVATE(cx, fp->callee()) == fp->fun);
JS_ASSERT(GET_FUNCTION_PRIVATE(cx, fp->callee()) == fp->getFunction());
if (FUN_INTERPRETED(fp->fun) &&
(fp->fun->flags & JSFUN_HEAVYWEIGHT)) {
if (FUN_INTERPRETED(fp->getFunction()) &&
(fp->getFunction()->flags & JSFUN_HEAVYWEIGHT)) {
// Iff these fields are NULL, then |fp| was synthesized on trace exit, so
// we need to update the frame fields.
if (!fp->hasCallObj())
@ -3475,7 +3475,7 @@ FlushNativeStackFrame(JSContext* cx, unsigned callDepth, const JSValueType* mp,
if (!fp->getScopeChain()->getPrivate())
fp->getScopeChain()->setPrivate(fp);
}
fp->thisv = fp->argv[-1];
fp->setThisValue(fp->argv[-1]);
}
}
}
@ -3527,19 +3527,21 @@ TraceRecorder::importImpl(LIns* base, ptrdiff_t offset, const void* p, JSValueTy
const char* funName = NULL;
if (*prefix == 'a' || *prefix == 'v') {
mark = JS_ARENA_MARK(&cx->tempPool);
if (fp->fun->hasLocalNames())
localNames = js_GetLocalNameArray(cx, fp->fun, &cx->tempPool);
funName = fp->fun->atom ? js_AtomToPrintableString(cx, fp->fun->atom) : "<anonymous>";
if (fp->getFunction()->hasLocalNames())
localNames = js_GetLocalNameArray(cx, fp->getFunction(), &cx->tempPool);
funName = fp->getFunction()->atom
? js_AtomToPrintableString(cx, fp->getFunction()->atom)
: "<anonymous>";
}
if (!strcmp(prefix, "argv")) {
if (index < fp->fun->nargs) {
if (index < fp->getArgumentCount()) {
JSAtom *atom = JS_LOCAL_NAME_TO_ATOM(localNames[index]);
JS_snprintf(name, sizeof name, "$%s.%s", funName, js_AtomToPrintableString(cx, atom));
} else {
JS_snprintf(name, sizeof name, "$%s.<arg%d>", funName, index);
}
} else if (!strcmp(prefix, "vars")) {
JSAtom *atom = JS_LOCAL_NAME_TO_ATOM(localNames[fp->fun->nargs + index]);
JSAtom *atom = JS_LOCAL_NAME_TO_ATOM(localNames[fp->getArgumentCount() + index]);
JS_snprintf(name, sizeof name, "$%s.%s", funName, js_AtomToPrintableString(cx, atom));
} else {
JS_snprintf(name, sizeof name, "$%s%d", prefix, index);
@ -3813,7 +3815,7 @@ TraceRecorder::attemptImport(const Value* p)
CountSlotsVisitor countVisitor(p);
VisitStackSlots(countVisitor, cx, callDepth);
if (countVisitor.stopped() || size_t(p - cx->fp->slots()) < cx->fp->script->nslots)
if (countVisitor.stopped() || size_t(p - cx->fp->slots()) < cx->fp->getSlotCount())
return get(p);
return NULL;
@ -4131,7 +4133,7 @@ TreevisLogExit(JSContext* cx, VMSideExit* exit)
{
debug_only_printf(LC_TMTreeVis, "TREEVIS ADDEXIT EXIT=%p TYPE=%s FRAG=%p PC=%p FILE=\"%s\""
" LINE=%d OFFS=%d", (void*)exit, getExitName(exit->exitType),
(void*)exit->from, (void*)cx->regs->pc, cx->fp->script->filename,
(void*)exit->from, (void*)cx->regs->pc, cx->fp->getScript()->filename,
js_FramePCToLineNumber(cx, cx->fp), FramePCOffset(cx, cx->fp));
debug_only_print0(LC_TMTreeVis, " STACK=\"");
for (unsigned i = 0; i < exit->numStackSlots; i++)
@ -4486,7 +4488,7 @@ TraceRecorder::compile()
/* :TODO: windows support */
#if defined DEBUG && !defined WIN32
/* Associate a filename and line number with the fragment. */
const char* filename = cx->fp->script->filename;
const char* filename = cx->fp->getScript()->filename;
char* label = (char*)js_malloc((filename ? strlen(filename) : 7) + 16);
sprintf(label, "%s:%u", filename ? filename : "<stdin>",
js_FramePCToLineNumber(cx, cx->fp));
@ -4998,7 +5000,7 @@ TraceRecorder::closeLoop(SlotMap& slotMap, VMSideExit* exit)
#ifdef JS_JIT_SPEW
debug_only_printf(LC_TMMinimal,
"Recording completed at %s:%u@%u via closeLoop (FragID=%06u)\n",
cx->fp->script->filename,
cx->fp->getScript()->filename,
js_FramePCToLineNumber(cx, cx->fp),
FramePCOffset(cx, cx->fp),
fragment->profFragID);
@ -5172,7 +5174,7 @@ TraceRecorder::endLoop(VMSideExit* exit)
#ifdef JS_JIT_SPEW
debug_only_printf(LC_TMMinimal,
"Recording completed at %s:%u@%u via endLoop (FragID=%06u)\n",
cx->fp->script->filename,
cx->fp->getScript()->filename,
js_FramePCToLineNumber(cx, cx->fp),
FramePCOffset(cx, cx->fp),
fragment->profFragID);
@ -5411,7 +5413,7 @@ TraceRecorder::trackCfgMerges(jsbytecode* pc)
{
/* If we hit the beginning of an if/if-else, then keep track of the merge point after it. */
JS_ASSERT((*pc == JSOP_IFEQ) || (*pc == JSOP_IFEQX));
jssrcnote* sn = js_GetSrcNote(cx->fp->script, pc);
jssrcnote* sn = js_GetSrcNote(cx->fp->getScript(), pc);
if (sn != NULL) {
if (SN_TYPE(sn) == SRC_IF) {
cfgMerges.add((*pc == JSOP_IFEQ)
@ -5660,8 +5662,8 @@ SynthesizeFrame(JSContext* cx, const FrameInfo& fi, JSObject* callee)
/* Assert that we have a correct sp distance from cx->fp->slots in fi. */
JSStackFrame* const fp = cx->fp;
JS_ASSERT_IF(!fi.imacpc,
js_ReconstructStackDepth(cx, fp->script, fi.pc) ==
uintN(fi.spdist - fp->script->nfixed));
js_ReconstructStackDepth(cx, fp->getScript(), fi.pc) ==
uintN(fi.spdist - fp->getFixedCount()));
/* Simulate js_Interpret locals for when |cx->fp == fp|. */
JSScript* newscript = fun->u.i.script;
@ -5701,8 +5703,8 @@ SynthesizeFrame(JSContext* cx, const FrameInfo& fi, JSObject* callee)
/* Initialize the new stack frame. */
newfp->setCallObj(NULL);
newfp->setArgsObj(NULL);
newfp->script = newscript;
newfp->fun = fun;
newfp->setScript(newscript);
newfp->setFunction(fun);
newfp->argc = argc;
newfp->argv = argv;
#ifdef DEBUG
@ -5710,19 +5712,19 @@ SynthesizeFrame(JSContext* cx, const FrameInfo& fi, JSObject* callee)
// someone forgets to initialize it later.
newfp->argv[-1].setMagic(JS_THIS_POISON);
#endif
newfp->rval = UndefinedValue();
newfp->clearReturnValue();
newfp->setAnnotation(NULL);
newfp->setScopeChain(NULL); // will be updated in FlushNativeStackFrame
newfp->flags = fi.is_constructing() ? JSFRAME_CONSTRUCTING : 0;
newfp->setBlockChain(NULL);
newfp->thisv.setNull(); // will be updated in FlushNativeStackFrame
newfp->setThisValue(NullValue()); // will be updated in FlushNativeStackFrame
JS_ASSERT(!newfp->hasIMacroPC());
/*
* Note that fp->script is still the caller's script; set the callee
* inline frame's idea of caller version from its version.
*/
newfp->setCallerVersion((JSVersion) fp->script->version);
newfp->setCallerVersion((JSVersion) fp->getScript()->version);
/* Push inline frame. (Copied from js_Interpret.) */
stack.pushInlineFrame(cx, fp, fi.pc, newfp);
@ -5750,7 +5752,7 @@ SynthesizeFrame(JSContext* cx, const FrameInfo& fi, JSObject* callee)
* everything down to the caller's fp->slots (where vars start) and avoid
* some of the complexity?
*/
return (fi.spdist - newfp->down->script->nfixed) +
return (fi.spdist - newfp->down->getFixedCount()) +
((fun->nargs > newfp->argc) ? fun->nargs - newfp->argc : 0) +
newscript->nfixed + SPECIAL_FRAME_SLOTS;
}
@ -5776,12 +5778,12 @@ SynthesizeSlowNativeFrame(TracerState& state, JSContext *cx, VMSideExit *exit)
fp->setCallObj(NULL);
fp->setArgsObj(NULL);
fp->script = NULL;
fp->thisv = state.nativeVp[1];
fp->setScript(NULL);
fp->setThisValue(state.nativeVp[1]);
fp->argc = state.nativeVpLen - 2;
fp->argv = state.nativeVp + 2;
fp->fun = GET_FUNCTION_PRIVATE(cx, fp->callee());
fp->rval = UndefinedValue();
fp->setFunction(GET_FUNCTION_PRIVATE(cx, fp->callee()));
fp->clearReturnValue();
fp->setAnnotation(NULL);
fp->setScopeChain(cx->fp->getScopeChain());
fp->setBlockChain(NULL);
@ -5999,7 +6001,7 @@ CreateBranchFragment(JSContext* cx, TreeFragment* root, VMSideExit* anchor)
debug_only_printf(LC_TMTreeVis, "TREEVIS CREATEBRANCH ROOT=%p FRAG=%p PC=%p FILE=\"%s\""
" LINE=%d ANCHOR=%p OFFS=%d\n",
(void*)root, (void*)f, (void*)cx->regs->pc, cx->fp->script->filename,
(void*)root, (void*)f, (void*)cx->regs->pc, cx->fp->getScript()->filename,
js_FramePCToLineNumber(cx, cx->fp), (void*)anchor,
FramePCOffset(cx, cx->fp));
verbose_only( tm->branches = new (*tm->dataAlloc) Seq<Fragment*>(f, tm->branches); )
@ -6162,7 +6164,7 @@ TraceRecorder::recordLoopEdge(JSContext* cx, TraceRecorder* r, uintN& inlineCall
debug_only_printf(LC_TMTracer,
"Looking for type-compatible peer (%s:%d@%d)\n",
cx->fp->script->filename,
cx->fp->getScript()->filename,
js_FramePCToLineNumber(cx, cx->fp),
FramePCOffset(cx, cx->fp));
@ -6205,9 +6207,9 @@ TraceRecorder::attemptTreeCall(TreeFragment* f, uintN& inlineCallCount)
* In the interim, just do tree calls knowing that they won't go into
* recursive trees that can pop parent frames.
*/
if (f->script == cx->fp->script) {
if (f->script == cx->fp->getScript()) {
if (f->recursion >= Recursion_Unwinds) {
Blacklist(cx->fp->script->code);
Blacklist(cx->fp->getScript()->code);
AbortRecording(cx, "Inner tree is an unsupported type of recursion");
return ARECORD_ABORTED;
}
@ -6735,7 +6737,7 @@ ExecuteTree(JSContext* cx, TreeFragment* f, uintN& inlineCallCount,
AUDIT(traceTriggered);
debug_only_printf(LC_TMTracer, "entering trace at %s:%u@%u, execs: %u code: %p\n",
cx->fp->script->filename,
cx->fp->getScript()->filename,
js_FramePCToLineNumber(cx, cx->fp),
FramePCOffset(cx, cx->fp),
f->execs,
@ -6854,11 +6856,11 @@ LeaveTree(TraceMonitor *tm, TracerState& state, VMSideExit* lr)
*
* First, if we just returned from a slow native, pop its stack frame.
*/
if (!cx->fp->script) {
if (!cx->fp->hasScript()) {
JS_ASSERT(cx->regs == &state.bailedSlowNativeRegs);
cx->stack().popSynthesizedSlowNativeFrame(cx);
}
JS_ASSERT(cx->fp->script);
JS_ASSERT(cx->fp->hasScript());
if (!(bs & BUILTIN_ERROR)) {
/*
@ -6904,8 +6906,8 @@ LeaveTree(TraceMonitor *tm, TracerState& state, VMSideExit* lr)
regs->sp += cs.ndefs;
regs->pc += cs.length;
JS_ASSERT_IF(!cx->fp->hasIMacroPC(),
cx->fp->slots() + cx->fp->script->nfixed +
js_ReconstructStackDepth(cx, cx->fp->script, regs->pc) ==
cx->fp->slots() + cx->fp->getFixedCount() +
js_ReconstructStackDepth(cx, cx->fp->getScript(), regs->pc) ==
regs->sp);
/*
@ -6964,7 +6966,7 @@ LeaveTree(TraceMonitor *tm, TracerState& state, VMSideExit* lr)
JSStackFrame* fp = cx->fp;
debug_only_printf(LC_TMTracer,
"synthesized deep frame for %s:%u@%u, slots=%d, fi=%p\n",
fp->script->filename,
fp->getScript()->filename,
js_FramePCToLineNumber(cx, fp),
FramePCOffset(cx, fp),
slots,
@ -7000,7 +7002,7 @@ LeaveTree(TraceMonitor *tm, TracerState& state, VMSideExit* lr)
JSStackFrame* fp = cx->fp;
debug_only_printf(LC_TMTracer,
"synthesized shallow frame for %s:%u@%u\n",
fp->script->filename, js_FramePCToLineNumber(cx, fp),
fp->getScript()->filename, js_FramePCToLineNumber(cx, fp),
FramePCOffset(cx, fp));
#endif
}
@ -7027,8 +7029,8 @@ LeaveTree(TraceMonitor *tm, TracerState& state, VMSideExit* lr)
fp->clearIMacroPC();
cx->regs->sp = fp->base() + (innermost->sp_adj / sizeof(double)) - calldepth_slots;
JS_ASSERT_IF(!fp->hasIMacroPC(),
fp->slots() + fp->script->nfixed +
js_ReconstructStackDepth(cx, fp->script, cx->regs->pc) == cx->regs->sp);
fp->slots() + fp->getFixedCount() +
js_ReconstructStackDepth(cx, fp->getScript(), cx->regs->pc) == cx->regs->sp);
#ifdef EXECUTE_TREE_TIMER
uint64 cycles = rdtsc() - state.startTime;
@ -7039,7 +7041,7 @@ LeaveTree(TraceMonitor *tm, TracerState& state, VMSideExit* lr)
debug_only_printf(LC_TMTracer,
"leaving trace at %s:%u@%u, op=%s, lr=%p, exitType=%s, sp=%lld, "
"calldepth=%d, cycles=%llu\n",
fp->script->filename,
fp->getScript()->filename,
js_FramePCToLineNumber(cx, fp),
FramePCOffset(cx, fp),
js_CodeName[fp->hasIMacroPC() ? *fp->getIMacroPC() : *cx->regs->pc],
@ -7402,9 +7404,9 @@ TraceRecorder::monitorRecording(JSOp op)
debug_only_stmt(
if (LogController.lcbits & LC_TMRecorder) {
js_Disassemble1(cx, cx->fp->script, cx->regs->pc,
js_Disassemble1(cx, cx->fp->getScript(), cx->regs->pc,
cx->fp->hasIMacroPC()
? 0 : cx->regs->pc - cx->fp->script->code,
? 0 : cx->regs->pc - cx->fp->getScript()->code,
!cx->fp->hasIMacroPC(), stdout);
}
)
@ -8059,14 +8061,14 @@ DeepBail(JSContext *cx)
JS_REQUIRES_STACK Value&
TraceRecorder::argval(unsigned n) const
{
JS_ASSERT(n < cx->fp->fun->nargs);
JS_ASSERT(n < cx->fp->getArgumentCount());
return cx->fp->argv[n];
}
JS_REQUIRES_STACK Value&
TraceRecorder::varval(unsigned n) const
{
JS_ASSERT(n < cx->fp->script->nslots);
JS_ASSERT(n < cx->fp->getSlotCount());
return cx->fp->slots()[n];
}
@ -8080,9 +8082,9 @@ JS_REQUIRES_STACK void
TraceRecorder::updateAtoms()
{
atoms = FrameAtomBase(cx, cx->fp);
consts = cx->fp->hasIMacroPC() || cx->fp->script->constOffset == 0
consts = cx->fp->hasIMacroPC() || cx->fp->getScript()->constOffset == 0
? 0
: cx->fp->script->consts()->vector;
: cx->fp->getScript()->consts()->vector;
}
JS_REQUIRES_STACK void
@ -8244,15 +8246,15 @@ TraceRecorder::callProp(JSObject* obj, JSProperty* prop, jsid id, Value*& vp,
JSStackFrame* cfp = (JSStackFrame*) obj->getPrivate();
if (cfp) {
if (sprop->getterOp() == js_GetCallArg) {
JS_ASSERT(slot < cfp->fun->nargs);
JS_ASSERT(slot < cfp->getArgumentCount());
vp = &cfp->argv[slot];
upvar_slot = slot;
nr.v = *vp;
} else if (sprop->getterOp() == js_GetCallVar ||
sprop->getterOp() == js_GetCallVarChecked) {
JS_ASSERT(slot < cfp->script->nslots);
JS_ASSERT(slot < cfp->getSlotCount());
vp = &cfp->slots()[slot];
upvar_slot = cx->fp->fun->nargs + slot;
upvar_slot = cx->fp->getArgumentCount() + slot;
nr.v = *vp;
} else {
RETURN_STOP("dynamic property of Call object");
@ -9554,7 +9556,7 @@ TraceRecorder::guardPropertyCacheHit(LIns* obj_ins,
if (entry->adding())
RETURN_STOP("adding a property to the global object");
JSOp op = js_GetOpcode(cx, cx->fp->script, cx->regs->pc);
JSOp op = js_GetOpcode(cx, cx->fp->getScript(), cx->regs->pc);
if (JOF_OPMODE(op) != JOF_NAME) {
guard(true,
addName(lir->ins2(LIR_eqp, obj_ins, INS_CONSTOBJ(globalObj)), "guard_global"),
@ -10277,14 +10279,14 @@ TraceRecorder::clearEntryFrameSlotsFromTracker(Tracker& which)
JSStackFrame *fp = entryFrame();
// Clear only slots that are not also used by the next frame up.
clearFrameSlotsFromTracker(which, fp, fp->script->nfixed);
clearFrameSlotsFromTracker(which, fp, fp->getFixedCount());
}
JS_REQUIRES_STACK void
TraceRecorder::clearCurrentFrameSlotsFromTracker(Tracker& which)
{
// Clear out all local slots.
clearFrameSlotsFromTracker(which, cx->fp, cx->fp->script->nslots);
clearFrameSlotsFromTracker(which, cx->fp, cx->fp->getSlotCount());
}
/*
@ -10296,12 +10298,14 @@ JS_REQUIRES_STACK void
TraceRecorder::putActivationObjects()
{
bool have_args = cx->fp->hasArgsObj() && cx->fp->argc;
bool have_call = cx->fp->fun && JSFUN_HEAVYWEIGHT_TEST(cx->fp->fun->flags) && cx->fp->fun->countArgsAndVars();
bool have_call = cx->fp->hasFunction() &&
JSFUN_HEAVYWEIGHT_TEST(cx->fp->getFunction()->flags) &&
cx->fp->getFunction()->countArgsAndVars();
if (!have_args && !have_call)
return;
int nargs = have_args ? argSlots(cx->fp) : cx->fp->fun->nargs;
int nargs = have_args ? argSlots(cx->fp) : cx->fp->getArgumentCount();
LIns* args_ins;
if (nargs) {
@ -10321,7 +10325,7 @@ TraceRecorder::putActivationObjects()
}
if (have_call) {
int nslots = cx->fp->fun->countVars();
int nslots = cx->fp->getFunction()->countVars();
LIns* slots_ins;
if (nslots) {
slots_ins = lir->insAlloc(sizeof(Value) * nslots);
@ -10335,7 +10339,7 @@ TraceRecorder::putActivationObjects()
LIns* scopeChain_ins = getFrameObjPtr(cx->fp->addressScopeChain());
LIns* args[] = { slots_ins, INS_CONST(nslots), args_ins,
INS_CONST(cx->fp->fun->nargs), scopeChain_ins, cx_ins };
INS_CONST(cx->fp->getArgumentCount()), scopeChain_ins, cx_ins };
lir->insCall(&js_PutCallObjectOnTrace_ci, args);
}
}
@ -10347,11 +10351,11 @@ IsTraceableRecursion(JSContext *cx)
JSStackFrame *down = cx->fp->down;
if (!down)
return false;
if (down->script != fp->script)
if (down->maybeScript() != fp->maybeScript())
return false;
if (down->argc != fp->argc)
return false;
if (fp->argc != fp->fun->nargs)
if (fp->argc != fp->getArgumentCount())
return false;
if (fp->hasIMacroPC() || down->hasIMacroPC())
return false;
@ -10359,7 +10363,7 @@ IsTraceableRecursion(JSContext *cx)
return false;
if (fp->hasBlockChain() || down->hasBlockChain())
return false;
if (*fp->script->code != JSOP_TRACE)
if (*fp->getScript()->code != JSOP_TRACE)
return false;
return true;
}
@ -10373,11 +10377,11 @@ TraceRecorder::record_EnterFrame(uintN& inlineCallCount)
RETURN_STOP_A("exceeded maximum call depth");
debug_only_printf(LC_TMTracer, "EnterFrame %s, callDepth=%d\n",
js_AtomToPrintableString(cx, cx->fp->fun->atom),
js_AtomToPrintableString(cx, cx->fp->getFunction()->atom),
callDepth);
debug_only_stmt(
if (LogController.lcbits & LC_TMRecorder) {
js_Disassemble(cx, cx->fp->script, JS_TRUE, stdout);
js_Disassemble(cx, cx->fp->getScript(), JS_TRUE, stdout);
debug_only_print0(LC_TMTracer, "----\n");
}
)
@ -10397,7 +10401,7 @@ TraceRecorder::record_EnterFrame(uintN& inlineCallCount)
// slots defined as imported by VisitFrameSlots.
Value* vp = &fp->argv[fp->argc];
Value* vpstop = vp + ptrdiff_t(fp->fun->nargs) - ptrdiff_t(fp->argc);
Value* vpstop = vp + ptrdiff_t(fp->getArgumentCount()) - ptrdiff_t(fp->argc);
for (; vp < vpstop; ++vp) {
nativeFrameTracker.set(vp, NULL);
set(vp, void_ins);
@ -10408,29 +10412,29 @@ TraceRecorder::record_EnterFrame(uintN& inlineCallCount)
nativeFrameTracker.set(fp->addressScopeChain(), NULL);
vp = fp->slots();
vpstop = vp + fp->script->nfixed;
vpstop = vp + fp->getFixedCount();
for (; vp < vpstop; ++vp) {
nativeFrameTracker.set(vp, NULL);
set(vp, void_ins);
}
vp = vpstop;
vpstop = vp + (fp->script->nslots - fp->script->nfixed);
vpstop = vp + (fp->getSlotCount() - fp->getFixedCount());
for (; vp < vpstop; ++vp)
nativeFrameTracker.set(vp, NULL);
LIns* callee_ins = get(&cx->fp->argv[-2]);
LIns* scopeChain_ins = stobj_get_parent(callee_ins);
if (cx->fp->fun && JSFUN_HEAVYWEIGHT_TEST(cx->fp->fun->flags)) {
if (cx->fp->hasFunction() && JSFUN_HEAVYWEIGHT_TEST(cx->fp->getFunction()->flags)) {
// We need to make sure every part of the frame is known to the tracker
// before taking a snapshot.
setFrameObjPtr(fp->addressScopeChain(), INS_NULL());
if (js_IsNamedLambda(cx->fp->fun))
if (js_IsNamedLambda(cx->fp->getFunction()))
RETURN_STOP_A("can't call named lambda heavyweight on trace");
LIns* fun_ins = INS_CONSTPTR(cx->fp->fun);
LIns* fun_ins = INS_CONSTPTR(cx->fp->getFunction());
LIns* args[] = { scopeChain_ins, callee_ins, fun_ins, cx_ins };
LIns* call_ins = lir->insCall(&js_CreateCallObjectOnTrace_ci, args);
@ -10449,18 +10453,18 @@ TraceRecorder::record_EnterFrame(uintN& inlineCallCount)
* concerned about. That should pass through below to not regress pre-recursion
* functionality.
*/
if (IsTraceableRecursion(cx) && tree->script == cx->fp->script) {
if (IsTraceableRecursion(cx) && tree->script == cx->fp->getScript()) {
if (tree->recursion == Recursion_Disallowed)
RETURN_STOP_A("recursion not allowed in this tree");
if (tree->script != cx->fp->script)
if (tree->script != cx->fp->getScript())
RETURN_STOP_A("recursion does not match original tree");
return InjectStatus(downRecursion());
}
#endif
/* Try inlining one level in case this recursion doesn't go too deep. */
if (fp->script == fp->down->script &&
fp->down->down && fp->down->down->script == fp->script) {
if (fp->getScript() == fp->down->getScript() &&
fp->down->down && fp->down->down->getScript() == fp->getScript()) {
RETURN_STOP_A("recursion started inlining");
}
@ -10513,14 +10517,14 @@ JS_REQUIRES_STACK AbortableRecordingStatus
TraceRecorder::record_LeaveFrame()
{
debug_only_stmt(
if (cx->fp->fun)
if (cx->fp->hasFunction())
debug_only_printf(LC_TMTracer,
"LeaveFrame (back to %s), callDepth=%d\n",
js_AtomToPrintableString(cx, cx->fp->fun->atom),
js_AtomToPrintableString(cx, cx->fp->getFunction()->atom),
callDepth);
);
JS_ASSERT(js_CodeSpec[js_GetOpcode(cx, cx->fp->script,
JS_ASSERT(js_CodeSpec[js_GetOpcode(cx, cx->fp->getScript(),
cx->regs->pc)].length == JSOP_CALL_LENGTH);
if (callDepth-- <= 0)
@ -10549,7 +10553,7 @@ TraceRecorder::record_JSOP_POPV()
// frame because POPV appears only in global and eval code and we don't
// trace JSOP_EVAL or leaving the frame where tracing started.
LIns *fp_ins = lir->insLoad(LIR_ldp, cx_ins, offsetof(JSContext, fp), ACCSET_OTHER);
box_value_into(rval, get(&rval), fp_ins, offsetof(JSStackFrame, rval), ACCSET_OTHER);
box_value_into(rval, get(&rval), fp_ins, JSStackFrame::offsetReturnValue(), ACCSET_OTHER);
return ARECORD_CONTINUE;
}
@ -10588,7 +10592,7 @@ TraceRecorder::record_JSOP_RETURN()
if (callDepth == 0) {
#if 0
if (IsTraceableRecursion(cx) && tree->recursion != Recursion_Disallowed &&
tree->script == cx->fp->script) {
tree->script == cx->fp->getScript()) {
return InjectStatus(upRecursion());
} else
#endif
@ -10602,7 +10606,7 @@ TraceRecorder::record_JSOP_RETURN()
#ifdef MOZ_TRACE_JSCALLS
if (cx->functionCallback) {
LIns* args[] = { INS_CONST(0), INS_CONSTPTR(cx->fp->fun), cx_ins };
LIns* args[] = { INS_CONST(0), INS_CONSTPTR(cx->fp->getFunction()), cx_ins };
LIns* call_ins = lir->insCall(&functionProbe_ci, args);
guard(false, lir->insEqI_0(call_ins), MISMATCH_EXIT);
}
@ -10612,14 +10616,14 @@ TraceRecorder::record_JSOP_RETURN()
Value& rval = stackval(-1);
JSStackFrame *fp = cx->fp;
if ((cx->fp->flags & JSFRAME_CONSTRUCTING) && rval.isPrimitive()) {
JS_ASSERT(fp->thisv == fp->argv[-1]);
JS_ASSERT(fp->getThisValue() == fp->argv[-1]);
rval_ins = get(&fp->argv[-1]);
} else {
rval_ins = get(&rval);
}
debug_only_printf(LC_TMTracer,
"returning from %s\n",
js_AtomToPrintableString(cx, cx->fp->fun->atom));
js_AtomToPrintableString(cx, cx->fp->getFunction()->atom));
clearCurrentFrameSlotsFromTracker(nativeFrameTracker);
return ARECORD_CONTINUE;
@ -10633,7 +10637,7 @@ TraceRecorder::record_JSOP_GOTO()
* generate an always-taken loop exit guard. For other downward gotos
* (like if/else) continue recording.
*/
jssrcnote* sn = js_GetSrcNote(cx->fp->script, cx->regs->pc);
jssrcnote* sn = js_GetSrcNote(cx->fp->getScript(), cx->regs->pc);
if (sn && (SN_TYPE(sn) == SRC_BREAK || SN_TYPE(sn) == SRC_CONT2LABEL)) {
AUDIT(breakLoopExits);
@ -13166,10 +13170,10 @@ TraceRecorder::upvar(JSScript* script, JSUpvarArray* uva, uintN index, Value& v)
JSStackFrame* fp = cx->findFrameAtLevel(level);
const CallInfo* ci;
int32 slot;
if (!fp->fun || (fp->flags & JSFRAME_EVAL)) {
if (!fp->hasFunction() || (fp->flags & JSFRAME_EVAL)) {
ci = &GetUpvarStackOnTrace_ci;
slot = cookieSlot;
} else if (cookieSlot < fp->fun->nargs) {
} else if (cookieSlot < fp->getArgumentCount()) {
ci = &GetUpvarArgOnTrace_ci;
slot = cookieSlot;
} else if (cookieSlot == UpvarCookie::CALLEE_SLOT) {
@ -13177,7 +13181,7 @@ TraceRecorder::upvar(JSScript* script, JSUpvarArray* uva, uintN index, Value& v)
slot = -2;
} else {
ci = &GetUpvarVarOnTrace_ci;
slot = cookieSlot - fp->fun->nargs;
slot = cookieSlot - fp->getArgumentCount();
}
LIns* outp = lir->insAlloc(sizeof(double));
@ -13237,7 +13241,7 @@ JS_REQUIRES_STACK AbortableRecordingStatus
TraceRecorder::record_JSOP_GETUPVAR()
{
uintN index = GET_UINT16(cx->regs->pc);
JSScript *script = cx->fp->script;
JSScript *script = cx->fp->getScript();
JSUpvarArray* uva = script->upvars();
JS_ASSERT(index < uva->length);
@ -14175,7 +14179,7 @@ JS_REQUIRES_STACK AbortableRecordingStatus
TraceRecorder::record_JSOP_OBJECT()
{
JSStackFrame* const fp = cx->fp;
JSScript* script = fp->script;
JSScript* script = fp->getScript();
unsigned index = atoms - script->atomMap.vector + GET_INDEX(cx->regs->pc);
JSObject* obj;
@ -14764,7 +14768,7 @@ TraceRecorder::record_JSOP_BINDNAME()
JSStackFrame* const fp = cx->fp;
JSObject *obj;
if (!fp->fun) {
if (!fp->hasFunction()) {
obj = fp->getScopeChain();
#ifdef DEBUG
@ -14776,7 +14780,7 @@ TraceRecorder::record_JSOP_BINDNAME()
while (obj->getClass() == &js_BlockClass) {
// The block's values are still on the stack.
#ifdef DEBUG
// NB: fp2 can't be a generator frame, because !fp->fun.
// NB: fp2 can't be a generator frame, because !fp->hasFunction.
while (obj->getPrivate() != fp2) {
JS_ASSERT(fp2->flags & JSFRAME_SPECIAL);
fp2 = fp2->down;
@ -14808,7 +14812,7 @@ TraceRecorder::record_JSOP_BINDNAME()
// We can't trace BINDNAME in functions that contain direct calls to eval,
// as they might add bindings which previously-traced references would have
// to see.
if (JSFUN_HEAVYWEIGHT_TEST(fp->fun->flags))
if (JSFUN_HEAVYWEIGHT_TEST(fp->getFunction()->flags))
RETURN_STOP_A("BINDNAME in heavyweight function.");
// We don't have the scope chain on trace, so instead we get a start object
@ -15064,7 +15068,7 @@ jsatomid
TraceRecorder::getFullIndex(ptrdiff_t pcoff)
{
jsatomid index = GET_INDEX(cx->regs->pc + pcoff);
index += atoms - cx->fp->script->atomMap.vector;
index += atoms - cx->fp->getScript()->atomMap.vector;
return index;
}
@ -15072,7 +15076,7 @@ JS_REQUIRES_STACK AbortableRecordingStatus
TraceRecorder::record_JSOP_LAMBDA()
{
JSFunction* fun;
fun = cx->fp->script->getFunction(getFullIndex());
fun = cx->fp->getScript()->getFunction(getFullIndex());
/*
* Emit code to clone a null closure parented by this recorder's global
@ -15171,7 +15175,7 @@ JS_REQUIRES_STACK AbortableRecordingStatus
TraceRecorder::record_JSOP_LAMBDA_FC()
{
JSFunction* fun;
fun = cx->fp->script->getFunction(getFullIndex());
fun = cx->fp->getScript()->getFunction(getFullIndex());
if (FUN_OBJECT(fun)->getParent() != globalObj)
return ARECORD_STOP;
@ -15255,7 +15259,7 @@ JS_REQUIRES_STACK AbortableRecordingStatus
TraceRecorder::record_JSOP_ARGSUB()
{
JSStackFrame* const fp = cx->fp;
if (!(fp->fun->flags & JSFUN_HEAVYWEIGHT)) {
if (!(fp->getFunction()->flags & JSFUN_HEAVYWEIGHT)) {
uintN slot = GET_ARGNO(cx->regs->pc);
if (slot >= fp->argc)
RETURN_STOP_A("can't trace out-of-range arguments");
@ -15279,7 +15283,7 @@ TraceRecorder::guardArgsLengthNotAssigned(LIns* argsobj_ins)
JS_REQUIRES_STACK AbortableRecordingStatus
TraceRecorder::record_JSOP_ARGCNT()
{
if (cx->fp->fun->flags & JSFUN_HEAVYWEIGHT)
if (cx->fp->getFunction()->flags & JSFUN_HEAVYWEIGHT)
RETURN_STOP_A("can't trace heavyweight JSOP_ARGCNT");
// argc is fixed on trace, so ideally we would simply generate LIR for
@ -15427,7 +15431,7 @@ JS_REQUIRES_STACK AbortableRecordingStatus
TraceRecorder::record_JSOP_REGEXP()
{
JSStackFrame* const fp = cx->fp;
JSScript* script = fp->script;
JSScript* script = fp->getScript();
unsigned index = atoms - script->atomMap.vector + GET_INDEX(cx->regs->pc);
LIns* proto_ins;
@ -15712,7 +15716,7 @@ TraceRecorder::record_JSOP_STOP()
#if 0
if (callDepth == 0 && IsTraceableRecursion(cx) &&
tree->recursion != Recursion_Disallowed &&
tree->script == cx->fp->script) {
tree->script == cx->fp->getScript()) {
return InjectStatus(upRecursion());
}
#endif
@ -15724,7 +15728,7 @@ TraceRecorder::record_JSOP_STOP()
* interpreter's JSOP_STOP case will return from the imacro, back to
* the pc after the calling op, still in the same JSStackFrame.
*/
updateAtoms(fp->script);
updateAtoms(fp->getScript());
return ARECORD_CONTINUE;
}
@ -15732,7 +15736,7 @@ TraceRecorder::record_JSOP_STOP()
#ifdef MOZ_TRACE_JSCALLS
if (cx->functionCallback) {
LIns* args[] = { INS_CONST(0), INS_CONSTPTR(cx->fp->fun), cx_ins };
LIns* args[] = { INS_CONST(0), INS_CONSTPTR(cx->fp->getFunction()), cx_ins };
LIns* call_ins = lir->insCall(&functionProbe_ci, args);
guard(false, lir->insEqI_0(call_ins), MISMATCH_EXIT);
}
@ -15747,7 +15751,7 @@ TraceRecorder::record_JSOP_STOP()
* of the last expression-statement, debugger API calls).
*/
if (fp->flags & JSFRAME_CONSTRUCTING) {
JS_ASSERT(fp->thisv == fp->argv[-1]);
JS_ASSERT(fp->getThisValue() == fp->argv[-1]);
rval_ins = get(&fp->argv[-1]);
} else {
rval_ins = INS_UNDEFINED();
@ -15787,7 +15791,7 @@ JS_REQUIRES_STACK AbortableRecordingStatus
TraceRecorder::record_JSOP_ENTERBLOCK()
{
JSObject* obj;
obj = cx->fp->script->getObject(getFullIndex(0));
obj = cx->fp->getScript()->getObject(getFullIndex(0));
LIns* void_ins = INS_UNDEFINED();
for (int i = 0, n = OBJ_BLOCK_COUNT(cx, obj); i < n; i++)
@ -15820,7 +15824,7 @@ JS_REQUIRES_STACK AbortableRecordingStatus
TraceRecorder::record_JSOP_ARRAYPUSH()
{
uint32_t slot = GET_UINT16(cx->regs->pc);
JS_ASSERT(cx->fp->script->nfixed <= slot);
JS_ASSERT(cx->fp->getFixedCount() <= slot);
JS_ASSERT(cx->fp->slots() + slot < cx->regs->sp - 1);
Value &arrayval = cx->fp->slots()[slot];
JS_ASSERT(arrayval.isObject());
@ -15861,7 +15865,7 @@ TraceRecorder::record_JSOP_GETTHISPROP()
* It's safe to just use cx->fp->thisv here because getThis() returns
* ARECORD_STOP if thisv is not available.
*/
CHECK_STATUS_A(getProp(&cx->fp->thisv.toObject(), this_ins));
CHECK_STATUS_A(getProp(&cx->fp->getThisValue().toObject(), this_ins));
return ARECORD_CONTINUE;
}

View File

@ -1716,14 +1716,14 @@ ParseXMLSource(JSContext *cx, JSString *src)
xml = NULL;
FrameRegsIter i(cx);
for (; !i.done() && !i.pc(); ++i)
JS_ASSERT(!i.fp()->script);
JS_ASSERT(!i.fp()->hasScript());
filename = NULL;
lineno = 1;
if (!i.done()) {
JSStackFrame *fp = i.fp();
op = (JSOp) *i.pc();
if (op == JSOP_TOXML || op == JSOP_TOXMLLIST) {
filename = fp->script->filename;
filename = fp->getScript()->filename;
lineno = js_FramePCToLineNumber(cx, fp);
for (endp = srcp + srclen; srcp < endp; srcp++) {
if (*srcp == '\n')

View File

@ -1451,7 +1451,7 @@ ValueToScript(JSContext *cx, jsval v)
script = (JSScript *) JS_GetPrivate(cx, obj);
} else if (clasp == Jsvalify(&js_GeneratorClass)) {
JSGenerator *gen = (JSGenerator *) JS_GetPrivate(cx, obj);
fun = gen->getFloatingFrame()->fun;
fun = gen->getFloatingFrame()->getFunction();
script = FUN_SCRIPT(fun);
}
}
@ -1492,7 +1492,7 @@ GetTrapArgs(JSContext *cx, uintN argc, jsval *argv, JSScript **scriptp,
uintN intarg;
JSScript *script;
*scriptp = JS_GetScriptedCaller(cx, NULL)->script;
*scriptp = JS_GetScriptedCaller(cx, NULL)->getScript();
*ip = 0;
if (argc != 0) {
v = argv[0];
@ -1522,7 +1522,8 @@ TrapHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval,
JSStackFrame *caller = JS_GetScriptedCaller(cx, NULL);
if (!JS_EvaluateUCInStackFrame(cx, caller,
JS_GetStringChars(str), JS_GetStringLength(str),
caller->script->filename, caller->script->lineno,
caller->getScript()->filename,
caller->getScript()->lineno,
rval)) {
return JSTRAP_ERROR;
}
@ -1621,7 +1622,7 @@ LineToPC(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
JS_ReportErrorNumber(cx, my_GetErrorMessage, NULL, JSSMSG_LINE2PC_USAGE);
return JS_FALSE;
}
script = JS_GetScriptedCaller(cx, NULL)->script;
script = JS_GetScriptedCaller(cx, NULL)->getScript();
if (!GetTrapArgs(cx, argc, argv, &script, &i))
return JS_FALSE;
lineno = (i == 0) ? script->lineno : (uintN)i;
@ -3149,8 +3150,8 @@ EvalInContext(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
return false;
}
if (!JS_EvaluateUCScript(cx, sobj, src, srclen,
fp->script->filename,
JS_PCToLineNumber(cx, fp->script, fp->pc(cx)),
fp->getScript()->filename,
JS_PCToLineNumber(cx, fp->getScript(), fp->pc(cx)),
rval)) {
return false;
}
@ -3185,7 +3186,7 @@ EvalInFrame(JSContext *cx, uintN argc, jsval *vp)
}
JSStackFrame *const fp = fi.fp();
if (!fp->script) {
if (!fp->hasScript()) {
JS_ReportError(cx, "cannot eval in non-script frame");
return JS_FALSE;
}
@ -3195,8 +3196,8 @@ EvalInFrame(JSContext *cx, uintN argc, jsval *vp)
oldfp = JS_SaveFrameChain(cx);
JSBool ok = JS_EvaluateUCInStackFrame(cx, fp, str->chars(), str->length(),
fp->script->filename,
JS_PCToLineNumber(cx, fp->script,
fp->getScript()->filename,
JS_PCToLineNumber(cx, fp->getScript(),
fi.pc()),
vp);
@ -3918,9 +3919,9 @@ Snarf(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
/* Get the currently executing script's name. */
fp = JS_GetScriptedCaller(cx, NULL);
JS_ASSERT(fp && fp->script->filename);
JS_ASSERT(fp && fp->getScript()->filename);
#ifdef XP_UNIX
pathname = MakeAbsolutePathname(cx, fp->script->filename, filename);
pathname = MakeAbsolutePathname(cx, fp->getScript()->filename, filename);
if (!pathname)
return JS_FALSE;
#else

View File

@ -200,7 +200,7 @@ AllowedToAct(JSContext *cx, jsid id)
// Some code is running, we can't make the assumption, as above, but we
// can't use a native frame, so clear fp.
fp = nsnull;
} else if (!fp->script) {
} else if (!fp->hasScript()) {
fp = nsnull;
}
@ -215,7 +215,7 @@ AllowedToAct(JSContext *cx, jsid id)
// if they've been cloned into less privileged contexts.
const char *filename;
if (fp &&
(filename = fp->script->filename) &&
(filename = fp->getScript()->filename) &&
!strncmp(filename, prefix, NS_ARRAY_LENGTH(prefix) - 1)) {
return JS_TRUE;
}
@ -246,7 +246,7 @@ CheckFilename(JSContext *cx, jsid id, JSStackFrame *fp)
{
const char *filename;
if (fp &&
(filename = fp->script->filename) &&
(filename = fp->getScript()->filename) &&
!strncmp(filename, prefix, NS_ARRAY_LENGTH(prefix) - 1)) {
return JS_TRUE;
}

View File

@ -1309,7 +1309,7 @@ XPCConvert::NativeInterface2JSObject(XPCLazyCallContext& lccx,
JSStackFrame* fp = JS_GetScriptedCaller(cx, NULL);
if(fp)
{
script = fp->script;
script = fp->maybeScript();
callee = fp->callee();
}
}

View File

@ -207,7 +207,7 @@ AccessCheck::isSystemOnlyAccessPermitted(JSContext *cx)
// Some code is running, we can't make the assumption, as above, but we
// can't use a native frame, so clear fp.
fp = NULL;
} else if (!fp->script) {
} else if (!fp->hasScript()) {
fp = NULL;
}
@ -222,7 +222,7 @@ AccessCheck::isSystemOnlyAccessPermitted(JSContext *cx)
static const char prefix[] = "chrome://global/";
const char *filename;
if (fp &&
(filename = fp->script->filename) &&
(filename = fp->getScript()->filename) &&
!strncmp(filename, prefix, NS_ARRAY_LENGTH(prefix) - 1)) {
return true;
}