mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-12 00:50:40 +00:00
Added calleValue()/calleObject() inline helpers to JSStackFrame (bug 512371, r=brendan).
This commit is contained in:
parent
d6c62a622f
commit
d0ad97aff9
@ -808,7 +808,7 @@ js_GetCallObject(JSContext *cx, JSStackFrame *fp)
|
||||
fp->scopeChain = env;
|
||||
JS_ASSERT(fp->argv);
|
||||
if (!js_DefineNativeProperty(cx, fp->scopeChain, ATOM_TO_JSID(lambdaName),
|
||||
fp->argv[-2],
|
||||
fp->calleeValue(),
|
||||
CalleeGetter, NULL,
|
||||
JSPROP_PERMANENT | JSPROP_READONLY,
|
||||
0, 0, NULL)) {
|
||||
@ -824,8 +824,8 @@ js_GetCallObject(JSContext *cx, JSStackFrame *fp)
|
||||
|
||||
callobj->setPrivate(fp);
|
||||
JS_ASSERT(fp->argv);
|
||||
JS_ASSERT(fp->fun == GET_FUNCTION_PRIVATE(cx, JSVAL_TO_OBJECT(fp->argv[-2])));
|
||||
STOBJ_SET_SLOT(callobj, JSSLOT_CALLEE, fp->argv[-2]);
|
||||
JS_ASSERT(fp->fun == GET_FUNCTION_PRIVATE(cx, fp->calleeObject()));
|
||||
STOBJ_SET_SLOT(callobj, JSSLOT_CALLEE, fp->calleeValue());
|
||||
fp->callobj = callobj;
|
||||
|
||||
/*
|
||||
@ -1191,7 +1191,7 @@ call_convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp)
|
||||
if (fp) {
|
||||
JS_ASSERT(fp->fun);
|
||||
JS_ASSERT(fp->argv);
|
||||
*vp = fp->argv[-2];
|
||||
*vp = fp->calleeValue();
|
||||
}
|
||||
}
|
||||
return JS_TRUE;
|
||||
@ -1325,7 +1325,7 @@ fun_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
}
|
||||
|
||||
JS_ASSERT(fp->down->argv);
|
||||
*vp = fp->down->argv[-2];
|
||||
*vp = fp->down->calleeValue();
|
||||
} else {
|
||||
*vp = JSVAL_NULL;
|
||||
}
|
||||
|
@ -2340,7 +2340,7 @@ js_TraceStackFrame(JSTracer *trc, JSStackFrame *fp)
|
||||
JS_CALL_VALUE_TRACER(trc, fp->thisv, "this");
|
||||
|
||||
if (fp->argv) {
|
||||
JS_CALL_VALUE_TRACER(trc, fp->argv[-2], "callee");
|
||||
JS_CALL_VALUE_TRACER(trc, fp->calleeValue(), "callee");
|
||||
nslots = fp->argc;
|
||||
skip = 0;
|
||||
if (fp->fun) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* vim: set ts=8 sw=4 et tw=78:
|
||||
* vim: set ts=4 sw=4 et tw=78:
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
@ -142,6 +142,16 @@ struct JSStackFrame {
|
||||
}
|
||||
}
|
||||
|
||||
jsval calleeValue() {
|
||||
JS_ASSERT(argv);
|
||||
return argv[-2];
|
||||
}
|
||||
|
||||
JSObject *calleeObject() {
|
||||
JS_ASSERT(argv);
|
||||
return JSVAL_TO_OBJECT(argv[-2]);
|
||||
}
|
||||
|
||||
JSObject *callee() {
|
||||
return argv ? JSVAL_TO_OBJECT(argv[-2]) : NULL;
|
||||
}
|
||||
|
@ -3387,9 +3387,7 @@ FlushNativeStackFrame(JSContext* cx, unsigned callDepth, const JSTraceType* mp,
|
||||
* has to be the same JSFunction (FIXME: bug 471425, eliminate fp->callee).
|
||||
*/
|
||||
JS_ASSERT(JSVAL_IS_OBJECT(fp->argv[-1]));
|
||||
JS_ASSERT(HAS_FUNCTION_CLASS(JSVAL_TO_OBJECT(fp->argv[-2])));
|
||||
JS_ASSERT(GET_FUNCTION_PRIVATE(cx, JSVAL_TO_OBJECT(fp->argv[-2])) ==
|
||||
GET_FUNCTION_PRIVATE(cx, fp->callee()));
|
||||
JS_ASSERT(HAS_FUNCTION_CLASS(fp->calleeObject()));
|
||||
JS_ASSERT(GET_FUNCTION_PRIVATE(cx, fp->callee()) == fp->fun);
|
||||
|
||||
/*
|
||||
@ -3398,7 +3396,7 @@ FlushNativeStackFrame(JSContext* cx, unsigned callDepth, const JSTraceType* mp,
|
||||
* scope object here.
|
||||
*/
|
||||
if (!fp->scopeChain) {
|
||||
fp->scopeChain = OBJ_GET_PARENT(cx, JSVAL_TO_OBJECT(fp->argv[-2]));
|
||||
fp->scopeChain = OBJ_GET_PARENT(cx, fp->calleeObject());
|
||||
if (fp->fun->flags & JSFUN_HEAVYWEIGHT) {
|
||||
/*
|
||||
* Set hookData to null because the failure case for js_GetCallObject
|
||||
@ -5579,7 +5577,7 @@ SynthesizeSlowNativeFrame(InterpState& state, JSContext *cx, VMSideExit *exit)
|
||||
fp->thisv = state.nativeVp[1];
|
||||
fp->argc = state.nativeVpLen - 2;
|
||||
fp->argv = state.nativeVp + 2;
|
||||
fp->fun = GET_FUNCTION_PRIVATE(cx, JSVAL_TO_OBJECT(fp->argv[-2]));
|
||||
fp->fun = GET_FUNCTION_PRIVATE(cx, fp->calleeObject());
|
||||
fp->rval = JSVAL_VOID;
|
||||
fp->down = cx->fp;
|
||||
fp->annotation = NULL;
|
||||
@ -7896,7 +7894,7 @@ TraceRecorder::scopeChainProp(JSObject* obj, jsval*& vp, LIns*& ins, NameResult&
|
||||
// of the scope chain if we are in a function.
|
||||
if (cx->fp->argv) {
|
||||
LIns* obj_ins;
|
||||
JSObject* parent = STOBJ_GET_PARENT(JSVAL_TO_OBJECT(cx->fp->argv[-2]));
|
||||
JSObject* parent = STOBJ_GET_PARENT(cx->fp->calleeObject());
|
||||
LIns* parent_ins = stobj_get_parent(get(&cx->fp->argv[-2]));
|
||||
CHECK_STATUS_A(traverseScopeChain(parent, parent_ins, obj, obj_ins));
|
||||
}
|
||||
@ -7988,7 +7986,7 @@ TraceRecorder::callProp(JSObject* obj, JSProperty* prop, jsid id, jsval*& vp,
|
||||
}
|
||||
|
||||
LIns* obj_ins;
|
||||
JSObject* parent = STOBJ_GET_PARENT(JSVAL_TO_OBJECT(cx->fp->argv[-2]));
|
||||
JSObject* parent = STOBJ_GET_PARENT(cx->fp->calleeObject());
|
||||
LIns* parent_ins = stobj_get_parent(get(&cx->fp->argv[-2]));
|
||||
CHECK_STATUS(traverseScopeChain(parent, parent_ins, obj, obj_ins));
|
||||
|
||||
@ -12007,7 +12005,7 @@ TraceRecorder::record_JSOP_CALLUPVAR()
|
||||
JS_REQUIRES_STACK AbortableRecordingStatus
|
||||
TraceRecorder::record_JSOP_GETDSLOT()
|
||||
{
|
||||
JSObject* callee = JSVAL_TO_OBJECT(cx->fp->argv[-2]);
|
||||
JSObject* callee = cx->fp->calleeObject();
|
||||
LIns* callee_ins = get(&cx->fp->argv[-2]);
|
||||
|
||||
unsigned index = GET_UINT16(cx->fp->regs->pc);
|
||||
|
Loading…
Reference in New Issue
Block a user