This commit is contained in:
Robert Sayre 2011-01-06 21:41:00 -05:00
Родитель a465632e5e 558ce1c6d7
Коммит 5141c15aed
4 изменённых файлов: 17 добавлений и 36 удалений

Просмотреть файл

@ -1077,14 +1077,9 @@ js_PutCallObject(JSContext *cx, JSStackFrame *fp)
{
JSObject &callobj = fp->callObj();
/*
* Strict mode eval frames have Call objects to put. Normal eval frames
* never put a Call object.
*/
JS_ASSERT(fp->isEvalFrame() == callobj.callIsForEval());
/* Get the arguments object to snapshot fp's actual argument values. */
if (fp->hasArgsObj()) {
JS_ASSERT(!fp->isEvalFrame());
if (!fp->hasOverriddenArgs())
callobj.setCallObjArguments(ObjectValue(fp->argsObj()));
js_PutArgsObject(cx, fp);
@ -1093,15 +1088,10 @@ js_PutCallObject(JSContext *cx, JSStackFrame *fp)
JSScript *script = fp->script();
Bindings &bindings = script->bindings;
if (callobj.callIsForEval()) {
JS_ASSERT(script->strictModeCode);
JS_ASSERT(bindings.countArgs() == 0);
/* This could be optimized as below, but keep it simple for now. */
CopyValuesToCallObject(callobj, 0, NULL, bindings.countVars(), fp->slots());
} else {
JSObject *callee = callobj.getCallObjCallee();
if (callee) {
JSFunction *fun = fp->fun();
JS_ASSERT(fun == callobj.getCallObjCalleeFunction());
JS_ASSERT(fun == callee->getFunctionPrivate());
JS_ASSERT(script == fun->script());
if (uintN n = bindings.countArgsAndVars()) {
@ -1114,9 +1104,9 @@ js_PutCallObject(JSContext *cx, JSStackFrame *fp)
JSScript *script = fun->script();
if (script->usesEval
#ifdef JS_METHODJIT
#ifdef JS_METHODJIT
|| script->debugMode
#endif
#endif
) {
CopyValuesToCallObject(callobj, nargs, fp->formalArgs(), nvars, fp->slots());
} else {
@ -1146,6 +1136,13 @@ js_PutCallObject(JSContext *cx, JSStackFrame *fp)
JS_ASSERT(env->getPrivate() == fp);
env->setPrivate(NULL);
}
} else {
JS_ASSERT(fp->isEvalFrame());
JS_ASSERT(script->strictModeCode);
JS_ASSERT(bindings.countArgs() == 0);
/* This could be optimized as above. But for now, keep it simple. */
CopyValuesToCallObject(callobj, 0, NULL, bindings.countVars(), fp->slots());
}
callobj.setPrivate(NULL);

Просмотреть файл

@ -731,9 +731,8 @@ ScriptEpilogue(JSContext *cx, JSStackFrame *fp, JSBool ok)
*/
if (fp->script()->strictModeCode) {
JS_ASSERT(!fp->isYielding());
JS_ASSERT(!fp->hasArgsObj());
JS_ASSERT(fp->hasCallObj());
JS_ASSERT(fp->callObj().callIsForEval());
JS_ASSERT(!fp->hasArgsObj());
js_PutCallObject(cx, fp);
}
} else {
@ -742,10 +741,8 @@ ScriptEpilogue(JSContext *cx, JSStackFrame *fp, JSBool ok)
* frame's activation objects are transferred to the floating frame,
* stored in the generator, and thus need not be synced.
*/
if (fp->isFunctionFrame() && !fp->isYielding()) {
JS_ASSERT_IF(fp->hasCallObj(), !fp->callObj().callIsForEval());
if (fp->isFunctionFrame() && !fp->isYielding())
PutActivationObjects(cx, fp);
}
}
/*

Просмотреть файл

@ -897,9 +897,6 @@ struct JSObject : js::gc::Cell {
/* Number of reserved slots. */
static const uint32 CALL_RESERVED_SLOTS = 2;
/* True if this is for a strict mode eval frame or for a function call. */
inline bool callIsForEval() const;
/* The stack frame for this Call object, if the frame is still active. */
inline JSStackFrame *maybeCallObjStackFrame() const;

Просмотреть файл

@ -432,16 +432,6 @@ JSObject::setArgsElement(uint32 i, const js::Value &v)
getArgsData()->slots[i] = v;
}
inline bool
JSObject::callIsForEval() const
{
JS_ASSERT(isCall());
JS_ASSERT(getSlot(JSSLOT_CALL_CALLEE).isObjectOrNull());
JS_ASSERT_IF(getSlot(JSSLOT_CALL_CALLEE).isObject(),
getSlot(JSSLOT_CALL_CALLEE).toObject().isFunction());
return getSlot(JSSLOT_CALL_CALLEE).isNull();
}
inline JSStackFrame *
JSObject::maybeCallObjStackFrame() const
{
@ -475,7 +465,7 @@ inline const js::Value &
JSObject::getCallObjArguments() const
{
JS_ASSERT(isCall());
JS_ASSERT(!callIsForEval());
JS_ASSERT(getCallObjCallee() != NULL);
return getSlot(JSSLOT_CALL_ARGUMENTS);
}
@ -483,7 +473,7 @@ inline void
JSObject::setCallObjArguments(const js::Value &v)
{
JS_ASSERT(isCall());
JS_ASSERT(!callIsForEval());
JS_ASSERT(getCallObjCallee() != NULL);
setSlot(JSSLOT_CALL_ARGUMENTS, v);
}