Bug 584882: Don't attempt to compute this for dummy frames. r=jorendorff

This commit is contained in:
Andrew Drake 2010-08-10 17:21:11 -07:00
parent aa649b9ff3
commit c7dbe5a681
3 changed files with 8 additions and 2 deletions

View File

@ -1238,7 +1238,10 @@ JS_GetFrameCallObject(JSContext *cx, JSStackFrame *fp)
JS_PUBLIC_API(JSObject *)
JS_GetFrameThis(JSContext *cx, JSStackFrame *fp)
{
return fp->getThisObject(cx);
if (fp->isDummyFrame())
return NULL;
else
return fp->getThisObject(cx);
}
JS_PUBLIC_API(JSFunction *)

View File

@ -68,6 +68,7 @@ enum JSFrameFlags {
JSFRAME_YIELDING = 0x40, /* js_Interpret dispatched JSOP_YIELD */
JSFRAME_GENERATOR = 0x80, /* frame belongs to generator-iterator */
JSFRAME_OVERRIDE_ARGS = 0x100, /* overridden arguments local variable */
JSFRAME_DUMMY = 0x200, /* frame is a dummy frame */
JSFRAME_SPECIAL = JSFRAME_DEBUGGER | JSFRAME_EVAL
};
@ -222,7 +223,7 @@ struct JSStackFrame
return !!(flags & JSFRAME_FLOATING_GENERATOR);
}
bool isDummyFrame() const { return !script && !fun; }
bool isDummyFrame() const { return !!(flags & JSFRAME_DUMMY); }
};
namespace js {
@ -510,6 +511,7 @@ js_MeterSlotOpcode(JSOp op, uint32 slot);
inline JSObject *
JSStackFrame::getThisObject(JSContext *cx)
{
JS_ASSERT(!isDummyFrame());
if (flags & JSFRAME_COMPUTED_THIS)
return &thisv.toObject();
if (!js::ComputeThisFromArgv(cx, argv))

View File

@ -490,6 +490,7 @@ SetupFakeFrame(JSContext *cx, ExecuteFrameGuard &frame, JSFrameRegs &regs, JSObj
PodZero(fp); // fp->fun and fp->script are both NULL
fp->argv = vp + 2;
fp->scopeChain = obj->getGlobal();
fp->flags = JSFRAME_DUMMY;
regs.pc = NULL;
regs.sp = fp->slots();