From 558ce1c6d7dd15fcb21cec797619438b282d9e2a Mon Sep 17 00:00:00 2001 From: Robert Sayre Date: Thu, 6 Jan 2011 21:40:54 -0500 Subject: [PATCH] Backed out changeset feb6682a10af --- js/src/jsfun.cpp | 29 +++++++++++++---------------- js/src/jsinterpinlines.h | 7 ++----- js/src/jsobj.h | 3 --- js/src/jsobjinlines.h | 14 ++------------ 4 files changed, 17 insertions(+), 36 deletions(-) diff --git a/js/src/jsfun.cpp b/js/src/jsfun.cpp index 33936c848b2..81c9ff82cd5 100644 --- a/js/src/jsfun.cpp +++ b/js/src/jsfun.cpp @@ -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); diff --git a/js/src/jsinterpinlines.h b/js/src/jsinterpinlines.h index d83ff45a0ec..f449f92f620 100644 --- a/js/src/jsinterpinlines.h +++ b/js/src/jsinterpinlines.h @@ -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); - } } /* diff --git a/js/src/jsobj.h b/js/src/jsobj.h index 46add1b2ec9..29640b3494b 100644 --- a/js/src/jsobj.h +++ b/js/src/jsobj.h @@ -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; diff --git a/js/src/jsobjinlines.h b/js/src/jsobjinlines.h index 74002e39dd3..ef4dbab46d1 100644 --- a/js/src/jsobjinlines.h +++ b/js/src/jsobjinlines.h @@ -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); }