Bug 819509 - Rename almost everything dealing with strict mode to just |strict|. r=njn

--HG--
extra : rebase_source : b9698ec5c0fee259ca84aa29ec15118509d9e86f
This commit is contained in:
Benjamin Peterson 2012-12-12 01:37:34 -05:00
Родитель 199f1a1879
Коммит 2039da32f7
27 изменённых файлов: 104 добавлений и 104 удалений

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

@ -226,7 +226,7 @@ EvalKernel(JSContext *cx, const CallArgs &args, EvalType evalType, StackFrame *c
if (length > 2 &&
((chars[0] == '[' && chars[length - 1] == ']') ||
(chars[0] == '(' && chars[length - 1] == ')')) &&
(!caller || !caller->script()->strictModeCode))
(!caller || !caller->script()->strict))
{
// Remarkably, JavaScript syntax is not a superset of JSON syntax:
// strings in JavaScript cannot contain the Unicode line and paragraph

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

@ -129,8 +129,8 @@ frontend::CompileScript(JSContext *cx, HandleObject scopeChain, StackFrame *call
return NULL;
/* If this is a direct call to eval, inherit the caller's strictness. */
if (callerFrame && callerFrame->script()->strictModeCode)
globalsc.strictMode = true;
if (callerFrame && callerFrame->script()->strict)
globalsc.strict = true;
if (options.compileAndGo) {
if (source) {
@ -151,7 +151,7 @@ frontend::CompileScript(JSContext *cx, HandleObject scopeChain, StackFrame *call
* wishes to decompile it while it's running.
*/
JSFunction *fun = callerFrame->fun();
ObjectBox *funbox = parser.newFunctionBox(fun, &pc, fun->inStrictMode());
ObjectBox *funbox = parser.newFunctionBox(fun, &pc, fun->strict());
if (!funbox)
return NULL;
bce.objectList.add(funbox);

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

@ -1177,7 +1177,7 @@ TryConvertToGname(BytecodeEmitter *bce, ParseNode *pn, JSOp *op)
bce->hasGlobalScope &&
!(bce->sc->isFunction && bce->sc->asFunbox()->mightAliasLocals()) &&
!pn->isDeoptimized() &&
!bce->sc->strictMode)
!bce->sc->strict)
{
switch (*op) {
case JSOP_NAME: *op = JSOP_GETGNAME; break;
@ -1576,7 +1576,7 @@ CheckSideEffects(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, bool *answe
case PNK_DOT:
#if JS_HAS_XML_SUPPORT
case PNK_DBLDOT:
JS_ASSERT_IF(pn2->getKind() == PNK_DBLDOT, !bce->sc->strictMode);
JS_ASSERT_IF(pn2->getKind() == PNK_DBLDOT, !bce->sc->strict);
/* FALL THROUGH */
#endif
@ -1794,7 +1794,7 @@ EmitNameOp(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, bool callContext)
static bool
EmitXMLName(JSContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce)
{
JS_ASSERT(!bce->sc->strictMode);
JS_ASSERT(!bce->sc->strict);
JS_ASSERT(pn->isKind(PNK_XMLUNARY));
JS_ASSERT(pn->isOp(JSOP_XMLNAME));
JS_ASSERT(op == JSOP_XMLNAME || op == JSOP_CALLXMLNAME);
@ -3503,7 +3503,7 @@ EmitAssignment(JSContext *cx, BytecodeEmitter *bce, ParseNode *lhs, JSOp op, Par
break;
#if JS_HAS_XML_SUPPORT
case PNK_XMLUNARY:
JS_ASSERT(!bce->sc->strictMode);
JS_ASSERT(!bce->sc->strict);
JS_ASSERT(lhs->isOp(JSOP_SETXMLNAME));
if (!EmitTree(cx, bce, lhs->pn_kid))
return false;
@ -3646,7 +3646,7 @@ EmitAssignment(JSContext *cx, BytecodeEmitter *bce, ParseNode *lhs, JSOp op, Par
#endif
#if JS_HAS_XML_SUPPORT
case PNK_XMLUNARY:
JS_ASSERT(!bce->sc->strictMode);
JS_ASSERT(!bce->sc->strict);
if (Emit1(cx, bce, JSOP_SETXMLNAME) < 0)
return false;
break;
@ -4346,7 +4346,7 @@ EmitLet(JSContext *cx, BytecodeEmitter *bce, ParseNode *pnLet)
MOZ_NEVER_INLINE static bool
EmitXMLTag(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
{
JS_ASSERT(!bce->sc->strictMode);
JS_ASSERT(!bce->sc->strict);
if (Emit1(cx, bce, JSOP_STARTXML) < 0)
return false;
@ -4407,7 +4407,7 @@ EmitXMLTag(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
static bool
EmitXMLProcessingInstruction(JSContext *cx, BytecodeEmitter *bce, XMLProcessingInstruction &pi)
{
JS_ASSERT(!bce->sc->strictMode);
JS_ASSERT(!bce->sc->strict);
jsatomid index;
if (!bce->makeAtomIndex(pi.data(), &index))
@ -4852,7 +4852,7 @@ EmitFunc(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
if (outersc->isFunction && outersc->asFunbox()->mightAliasLocals())
funbox->setMightAliasLocals(); // inherit mightAliasLocals from parent
JS_ASSERT_IF(outersc->strictMode, funbox->strictMode);
JS_ASSERT_IF(outersc->strict, funbox->strict);
// Inherit most things (principals, version, etc) from the parent.
Rooted<JSScript*> parent(cx, bce->script);
@ -5277,7 +5277,7 @@ EmitDelete(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
break;
#if JS_HAS_XML_SUPPORT
case PNK_DBLDOT:
JS_ASSERT(!bce->sc->strictMode);
JS_ASSERT(!bce->sc->strict);
if (!EmitElemOp(cx, pn2, JSOP_DELDESC, bce))
return false;
break;
@ -5561,7 +5561,7 @@ EmitIncOrDec(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
break;
#if JS_HAS_XML_SUPPORT
case PNK_XMLUNARY:
JS_ASSERT(!bce->sc->strictMode);
JS_ASSERT(!bce->sc->strict);
JS_ASSERT(pn2->isOp(JSOP_SETXMLNAME));
if (!EmitTree(cx, bce, pn2->pn_kid))
return false;
@ -6376,7 +6376,7 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
#if JS_HAS_XML_SUPPORT
case PNK_FILTER:
{
JS_ASSERT(!bce->sc->strictMode);
JS_ASSERT(!bce->sc->strict);
if (!EmitTree(cx, bce, pn->pn_left))
return false;
@ -6408,7 +6408,7 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
#if JS_HAS_XML_SUPPORT
case PNK_DBLDOT:
JS_ASSERT(!bce->sc->strictMode);
JS_ASSERT(!bce->sc->strict);
/* FALL THROUGH */
#endif
@ -6481,7 +6481,7 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
case PNK_XMLTEXT:
case PNK_XMLCDATA:
case PNK_XMLCOMMENT:
JS_ASSERT(!bce->sc->strictMode);
JS_ASSERT(!bce->sc->strict);
/* FALL THROUGH */
#endif
case PNK_STRING:
@ -6516,7 +6516,7 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
#if JS_HAS_XML_SUPPORT
case PNK_XMLELEM:
case PNK_XMLLIST:
JS_ASSERT(!bce->sc->strictMode);
JS_ASSERT(!bce->sc->strict);
JS_ASSERT(pn->isKind(PNK_XMLLIST) || pn->pn_count != 0);
switch (pn->pn_head ? pn->pn_head->getKind() : PNK_XMLLIST) {
@ -6566,7 +6566,7 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
break;
case PNK_XMLNAME:
JS_ASSERT(!bce->sc->strictMode);
JS_ASSERT(!bce->sc->strict);
if (pn->isArity(PN_LIST)) {
JS_ASSERT(pn->pn_count != 0);

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

@ -434,7 +434,7 @@ CloneParseTree(ParseNode *opn, Parser *parser)
case PN_FUNC:
NULLCHECK(pn->pn_funbox =
parser->newFunctionBox(opn->pn_funbox->function(), pc, opn->pn_funbox->strictMode));
parser->newFunctionBox(opn->pn_funbox->function(), pc, opn->pn_funbox->strict));
NULLCHECK(pn->pn_body = CloneParseTree(opn->pn_body, parser));
pn->pn_cookie = opn->pn_cookie;
pn->pn_dflags = opn->pn_dflags;

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

@ -82,7 +82,7 @@ using namespace js::frontend;
bool
StrictModeGetter::get() const
{
return parser->pc->sc->strictMode;
return parser->pc->sc->strict;
}
bool
@ -1586,7 +1586,7 @@ Parser::functionDef(HandlePropertyName funName, const TokenStream::Position &sta
JS_ASSERT_IF(pc->sc->isFunction, !pn->pn_cookie.isFree());
JS_ASSERT_IF(!pc->sc->isFunction, pn->pn_cookie.isFree());
} else {
JS_ASSERT(!pc->sc->strictMode);
JS_ASSERT(!pc->sc->strict);
JS_ASSERT(pn->pn_cookie.isFree());
if (pc->sc->isFunction) {
FunctionBox *funbox = pc->sc->asFunbox();
@ -1625,7 +1625,7 @@ Parser::functionDef(HandlePropertyName funName, const TokenStream::Position &sta
// mode. Otherwise, we parse it normally. If we see a "use strict"
// directive, we backup and reparse it as strict.
pn->pn_body = NULL;
bool initiallyStrict = pc->sc->strictMode;
bool initiallyStrict = pc->sc->strict;
bool becameStrict;
if (!functionArgsAndBody(pn, fun, funName, type, kind, initiallyStrict, &becameStrict)) {
if (initiallyStrict || !becameStrict || tokenStream.hadError())
@ -1875,7 +1875,7 @@ Parser::maybeParseDirective(ParseNode *pn, bool *cont)
// We're going to be in strict mode. Note that this scope explicitly
// had "use strict";
pc->sc->setExplicitUseStrict();
if (!pc->sc->strictMode) {
if (!pc->sc->strict) {
if (pc->sc->isFunction) {
// Request that this function be reparsed as strict.
pc->funBecameStrict = true;
@ -1888,7 +1888,7 @@ Parser::maybeParseDirective(ParseNode *pn, bool *cont)
reportError(NULL, JSMSG_DEPRECATED_OCTAL);
return false;
}
pc->sc->strictMode = true;
pc->sc->strict = true;
}
}
}
@ -3501,7 +3501,7 @@ Parser::withStatement()
// construct that is forbidden in strict mode code, but doesn't even merit a
// warning under JSOPTION_STRICT. See
// https://bugzilla.mozilla.org/show_bug.cgi?id=514576#c1.
if (pc->sc->strictMode && !reportStrictModeError(NULL, JSMSG_STRICT_CODE_WITH))
if (pc->sc->strict && !reportStrictModeError(NULL, JSMSG_STRICT_CODE_WITH))
return NULL;
ParseNode *pn = BinaryNode::create(PNK_WITH, this);
@ -5322,7 +5322,7 @@ Parser::generatorExpr(ParseNode *kid)
return NULL;
/* Create box for fun->object early to protect against last-ditch GC. */
FunctionBox *genFunbox = newFunctionBox(fun, outerpc, outerpc->sc->strictMode);
FunctionBox *genFunbox = newFunctionBox(fun, outerpc, outerpc->sc->strict);
if (!genFunbox)
return NULL;
@ -5664,7 +5664,7 @@ Parser::memberExpr(bool allowCallSyntax)
* In non-strict mode code, direct calls to eval can add
* variables to the call object.
*/
if (pc->sc->isFunction && !pc->sc->strictMode)
if (pc->sc->isFunction && !pc->sc->strict)
pc->sc->asFunbox()->setHasExtensibleScope();
}
} else if (lhs->isOp(JSOP_GETPROP)) {

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

@ -19,14 +19,14 @@ SharedContext::SharedContext(JSContext *cx, bool isFun, bool strict)
: context(cx),
isFunction(isFun),
anyCxFlags(),
strictMode(strict)
strict(strict)
{
}
inline bool
SharedContext::needStrictChecks()
{
return context->hasStrictOption() || strictMode;
return context->hasStrictOption() || strict;
}
inline GlobalSharedContext *

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

@ -143,7 +143,7 @@ class SharedContext
global code */
AnyContextFlags anyCxFlags;
bool strictMode;
bool strict;
// If it's function code, funbox must be non-NULL and scopeChain must be NULL.
// If it's global code, funbox must be NULL.

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

@ -2709,7 +2709,7 @@ CodeGenerator::visitOutOfLineStoreElementHole(OutOfLineStoreElementHole *ool)
masm.bind(&callStub);
saveLive(ins);
pushArg(Imm32(current->mir()->strictModeCode()));
pushArg(Imm32(current->mir()->strict()));
pushArg(value);
if (index->isConstant())
pushArg(*index->toConstant());
@ -3350,7 +3350,7 @@ CodeGenerator::visitCallGetElement(LCallGetElement *lir)
bool
CodeGenerator::visitCallSetElement(LCallSetElement *lir)
{
pushArg(Imm32(current->mir()->strictModeCode()));
pushArg(Imm32(current->mir()->strict()));
pushArg(ToValue(lir, LCallSetElement::Value));
pushArg(ToValue(lir, LCallSetElement::Index));
pushArg(ToRegister(lir->getOperand(0)));
@ -3733,7 +3733,7 @@ CodeGenerator::visitCallDeleteProperty(LCallDeleteProperty *lir)
pushArg(ImmGCPtr(lir->mir()->name()));
pushArg(ToValue(lir, LCallDeleteProperty::Value));
if (lir->mir()->block()->info().script()->strictModeCode)
if (lir->mir()->block()->info().script()->strict)
return callVM(DeletePropertyStrictInfo, lir);
else
return callVM(DeletePropertyNonStrictInfo, lir);

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

@ -6558,7 +6558,7 @@ IonBuilder::jsop_setprop(HandlePropertyName name)
MSetPropertyInstruction *ins;
if (monitored) {
ins = MCallSetProperty::New(obj, value, name, script()->strictModeCode);
ins = MCallSetProperty::New(obj, value, name, script()->strict);
} else {
Shape *objShape;
if ((objShape = mjit::GetPICSingleShape(cx, script(), pc, info().constructing())) &&
@ -6583,7 +6583,7 @@ IonBuilder::jsop_setprop(HandlePropertyName name)
spew("SETPROP not monomorphic");
ins = MSetPropertyCache::New(obj, value, name, script()->strictModeCode);
ins = MSetPropertyCache::New(obj, value, name, script()->strict);
if (!binaryTypes.lhsTypes || binaryTypes.lhsTypes->propertyNeedsBarrier(cx, id))
ins->setNeedsBarrier();
@ -6686,7 +6686,7 @@ IonBuilder::jsop_this()
if (!info().fun())
return abort("JSOP_THIS outside of a JSFunction.");
if (script()->strictModeCode) {
if (script()->strict) {
current->pushSlot(info().thisSlot());
return true;
}

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

@ -390,8 +390,8 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock>
return loopDepth_;
}
bool strictModeCode() const {
return info_.script()->strictModeCode;
bool strict() const {
return info_.script()->strict;
}
void dumpStack(FILE *fp);

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

@ -517,7 +517,7 @@ checkReportFlags(JSContext *cx, unsigned *flags)
* the nearest scripted frame is strict, see bug 536306.
*/
JSScript *script = cx->stack.currentScript();
if (script && script->strictModeCode)
if (script && script->strict)
*flags &= ~JSREPORT_WARNING;
else if (cx->hasStrictOption())
*flags |= JSREPORT_WARNING;

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

@ -179,7 +179,7 @@ fun_getProperty(JSContext *cx, HandleObject obj_, HandleId id, MutableHandleValu
vp.setNull();
} else if (caller.isFunction()) {
JSFunction *callerFun = caller.toFunction();
if (callerFun->isInterpreted() && callerFun->inStrictMode()) {
if (callerFun->isInterpreted() && callerFun->strict()) {
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, NULL,
JSMSG_CALLER_IS_STRICT);
return false;
@ -344,7 +344,7 @@ fun_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
unsigned attrs = JSPROP_PERMANENT;
if (fun->isInterpretedLazy() && !fun->getOrCreateScript(cx))
return false;
if (fun->isInterpreted() ? fun->inStrictMode() : fun->isBoundFunction()) {
if (fun->isInterpreted() ? fun->strict() : fun->isBoundFunction()) {
JSObject *throwTypeError = fun->global().getThrowTypeError();
getter = CastAsPropertyOp(throwTypeError);
@ -660,7 +660,7 @@ js::FunctionToString(JSContext *cx, HandleFunction fun, bool bodyOnly, bool lamb
// have "use strict", we insert "use strict" into the body of the
// function. This ensures that if the result of toString is evaled, the
// resulting function will have the same semantics.
bool addUseStrict = script->strictModeCode && !script->explicitUseStrict;
bool addUseStrict = script->strict && !script->explicitUseStrict;
bool buildBody = funCon && !bodyOnly;
if (buildBody) {

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

@ -111,7 +111,7 @@ struct JSFunction : public JSObject
}
/* Returns the strictness of this function, which must be interpreted. */
inline bool inStrictMode() const;
inline bool strict() const;
// Can be called multiple times by the parser.
void setArgCount(uint16_t nargs) {

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

@ -17,9 +17,9 @@
#include "vm/String-inl.h"
inline bool
JSFunction::inStrictMode() const
JSFunction::strict() const
{
return nonLazyScript()->strictModeCode;
return nonLazyScript()->strict;
}
inline void

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

@ -1488,7 +1488,7 @@ TypeConstraintArith::newType(JSContext *cx, TypeSet *source, Type type)
void
TypeConstraintTransformThis::newType(JSContext *cx, TypeSet *source, Type type)
{
if (type.isUnknown() || type.isAnyObject() || type.isObject() || script_->strictModeCode) {
if (type.isUnknown() || type.isAnyObject() || type.isObject() || script_->strict) {
target->addType(cx, type);
return;
}

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

@ -151,7 +151,7 @@ js::BoxNonStrictThis(JSContext *cx, const CallReceiver &call)
#ifdef DEBUG
JSFunction *fun = call.callee().isFunction() ? call.callee().toFunction() : NULL;
JS_ASSERT_IF(fun && fun->isInterpreted(), !fun->inStrictMode());
JS_ASSERT_IF(fun && fun->isInterpreted(), !fun->strict());
#endif
bool modified;
@ -2089,7 +2089,7 @@ BEGIN_CASE(JSOP_DELNAME)
goto error;
/* Strict mode code should never contain JSOP_DELNAME opcodes. */
JS_ASSERT(!script->strictModeCode);
JS_ASSERT(!script->strict);
/* ECMA says to return true if name is undefined or inherited. */
PUSH_BOOLEAN(true);
@ -2110,7 +2110,7 @@ BEGIN_CASE(JSOP_DELPROP)
FETCH_OBJECT(cx, -1, obj);
MutableHandleValue res = MutableHandleValue::fromMarkedLocation(&regs.sp[-1]);
if (!JSObject::deleteProperty(cx, obj, name, res, script->strictModeCode))
if (!JSObject::deleteProperty(cx, obj, name, res, script->strict))
goto error;
}
END_CASE(JSOP_DELPROP)
@ -2125,7 +2125,7 @@ BEGIN_CASE(JSOP_DELELEM)
propval = regs.sp[-1];
MutableHandleValue res = MutableHandleValue::fromMarkedLocation(&regs.sp[-2]);
if (!JSObject::deleteByValue(cx, obj, propval, res, script->strictModeCode))
if (!JSObject::deleteByValue(cx, obj, propval, res, script->strict))
goto error;
regs.sp--;
@ -2284,7 +2284,7 @@ BEGIN_CASE(JSOP_SETELEM)
RootedId &id = rootId0;
FETCH_ELEMENT_ID(obj, -2, id);
Value &value = regs.sp[-1];
if (!SetObjectElementOperation(cx, obj, id, value, script->strictModeCode))
if (!SetObjectElementOperation(cx, obj, id, value, script->strict))
goto error;
regs.sp[-3] = value;
regs.sp -= 2;
@ -2301,7 +2301,7 @@ BEGIN_CASE(JSOP_ENUMELEM)
RootedId &id = rootId0;
FETCH_ELEMENT_ID(obj, -1, id);
rval = regs.sp[-3];
if (!JSObject::setGeneric(cx, obj, obj, id, &rval, script->strictModeCode))
if (!JSObject::setGeneric(cx, obj, obj, id, &rval, script->strict))
goto error;
regs.sp -= 3;
}
@ -2863,7 +2863,7 @@ BEGIN_CASE(JSOP_DEFFUN)
*/
/* Step 5f. */
if (!JSObject::setProperty(cx, parent, parent, name, &rval, script->strictModeCode))
if (!JSObject::setProperty(cx, parent, parent, name, &rval, script->strict))
goto error;
} while (false);
}
@ -3059,7 +3059,7 @@ BEGIN_CASE(JSOP_INITPROP)
id = NameToId(name);
if (JS_UNLIKELY(name == cx->names().proto)
? !baseops::SetPropertyHelper(cx, obj, obj, id, 0, &rval, script->strictModeCode)
? !baseops::SetPropertyHelper(cx, obj, obj, id, 0, &rval, script->strict)
: !DefineNativeProperty(cx, obj, id, rval, NULL, NULL,
JSPROP_ENUMERATE, 0, 0, 0)) {
goto error;
@ -3254,7 +3254,7 @@ END_CASE(JSOP_DEBUGGER)
#if JS_HAS_XML_SUPPORT
BEGIN_CASE(JSOP_DEFXMLNS)
{
JS_ASSERT(!script->strictModeCode);
JS_ASSERT(!script->strict);
if (!js_SetDefaultXMLNamespace(cx, regs.sp[-1]))
goto error;
@ -3264,7 +3264,7 @@ END_CASE(JSOP_DEFXMLNS)
BEGIN_CASE(JSOP_ANYNAME)
{
JS_ASSERT(!script->strictModeCode);
JS_ASSERT(!script->strict);
cx->runtime->gcExactScanningEnabled = false;
@ -3278,7 +3278,7 @@ END_CASE(JSOP_ANYNAME)
BEGIN_CASE(JSOP_QNAMEPART)
/*
* We do not JS_ASSERT(!script->strictModeCode) here because JSOP_QNAMEPART
* We do not JS_ASSERT(!script->strict) here because JSOP_QNAMEPART
* is used for __proto__ and (in contexts where we favor JSOP_*ELEM instead
* of JSOP_*PROP) obj.prop compiled as obj['prop'].
*/
@ -3288,7 +3288,7 @@ END_CASE(JSOP_QNAMEPART)
#if JS_HAS_XML_SUPPORT
BEGIN_CASE(JSOP_QNAMECONST)
{
JS_ASSERT(!script->strictModeCode);
JS_ASSERT(!script->strict);
Value rval = StringValue(script->getAtom(regs.pc));
Value lval = regs.sp[-1];
JSObject *obj = js_ConstructXMLQNameObject(cx, lval, rval);
@ -3300,7 +3300,7 @@ END_CASE(JSOP_QNAMECONST)
BEGIN_CASE(JSOP_QNAME)
{
JS_ASSERT(!script->strictModeCode);
JS_ASSERT(!script->strict);
Value rval = regs.sp[-1];
Value lval = regs.sp[-2];
@ -3314,7 +3314,7 @@ END_CASE(JSOP_QNAME)
BEGIN_CASE(JSOP_TOATTRNAME)
{
JS_ASSERT(!script->strictModeCode);
JS_ASSERT(!script->strict);
Value rval;
rval = regs.sp[-1];
@ -3326,7 +3326,7 @@ END_CASE(JSOP_TOATTRNAME)
BEGIN_CASE(JSOP_TOATTRVAL)
{
JS_ASSERT(!script->strictModeCode);
JS_ASSERT(!script->strict);
Value rval;
rval = regs.sp[-1];
@ -3341,7 +3341,7 @@ END_CASE(JSOP_TOATTRVAL)
BEGIN_CASE(JSOP_ADDATTRNAME)
BEGIN_CASE(JSOP_ADDATTRVAL)
{
JS_ASSERT(!script->strictModeCode);
JS_ASSERT(!script->strict);
Value rval = regs.sp[-1];
Value lval = regs.sp[-2];
@ -3357,7 +3357,7 @@ END_CASE(JSOP_ADDATTRNAME)
BEGIN_CASE(JSOP_BINDXMLNAME)
{
JS_ASSERT(!script->strictModeCode);
JS_ASSERT(!script->strict);
Value lval;
lval = regs.sp[-1];
@ -3372,14 +3372,14 @@ END_CASE(JSOP_BINDXMLNAME)
BEGIN_CASE(JSOP_SETXMLNAME)
{
JS_ASSERT(!script->strictModeCode);
JS_ASSERT(!script->strict);
Rooted<JSObject*> obj(cx, &regs.sp[-3].toObject());
RootedValue &rval = rootValue0;
rval = regs.sp[-1];
RootedId &id = rootId0;
FETCH_ELEMENT_ID(obj, -2, id);
if (!JSObject::setGeneric(cx, obj, obj, id, &rval, script->strictModeCode))
if (!JSObject::setGeneric(cx, obj, obj, id, &rval, script->strict))
goto error;
rval = regs.sp[-1];
regs.sp -= 2;
@ -3390,7 +3390,7 @@ END_CASE(JSOP_SETXMLNAME)
BEGIN_CASE(JSOP_CALLXMLNAME)
BEGIN_CASE(JSOP_XMLNAME)
{
JS_ASSERT(!script->strictModeCode);
JS_ASSERT(!script->strict);
Value lval = regs.sp[-1];
RootedObject &obj = rootObject0;
@ -3413,7 +3413,7 @@ END_CASE(JSOP_XMLNAME)
BEGIN_CASE(JSOP_DESCENDANTS)
BEGIN_CASE(JSOP_DELDESC)
{
JS_ASSERT(!script->strictModeCode);
JS_ASSERT(!script->strict);
JSObject *obj;
FETCH_OBJECT(cx, -2, obj);
@ -3435,7 +3435,7 @@ END_CASE(JSOP_DESCENDANTS)
BEGIN_CASE(JSOP_FILTER)
{
JS_ASSERT(!script->strictModeCode);
JS_ASSERT(!script->strict);
/*
* We push the hole value before jumping to [enditer] so we can detect the
@ -3450,7 +3450,7 @@ END_VARLEN_CASE
BEGIN_CASE(JSOP_ENDFILTER)
{
JS_ASSERT(!script->strictModeCode);
JS_ASSERT(!script->strict);
bool cond = !regs.sp[-1].isMagic();
if (cond) {
@ -3478,7 +3478,7 @@ END_CASE(JSOP_ENDFILTER);
BEGIN_CASE(JSOP_TOXML)
{
JS_ASSERT(!script->strictModeCode);
JS_ASSERT(!script->strict);
cx->runtime->gcExactScanningEnabled = false;
@ -3492,7 +3492,7 @@ END_CASE(JSOP_TOXML)
BEGIN_CASE(JSOP_TOXMLLIST)
{
JS_ASSERT(!script->strictModeCode);
JS_ASSERT(!script->strict);
Value rval = regs.sp[-1];
JSObject *obj = js_ValueToXMLListObject(cx, rval);
@ -3504,7 +3504,7 @@ END_CASE(JSOP_TOXMLLIST)
BEGIN_CASE(JSOP_XMLTAGEXPR)
{
JS_ASSERT(!script->strictModeCode);
JS_ASSERT(!script->strict);
Value rval = regs.sp[-1];
JSString *str = ToString(cx, rval);
@ -3516,7 +3516,7 @@ END_CASE(JSOP_XMLTAGEXPR)
BEGIN_CASE(JSOP_XMLELTEXPR)
{
JS_ASSERT(!script->strictModeCode);
JS_ASSERT(!script->strict);
Value rval = regs.sp[-1];
JSString *str;
@ -3535,7 +3535,7 @@ END_CASE(JSOP_XMLELTEXPR)
BEGIN_CASE(JSOP_XMLCDATA)
{
JS_ASSERT(!script->strictModeCode);
JS_ASSERT(!script->strict);
JSAtom *atom = script->getAtom(regs.pc);
JSObject *obj = js_NewXMLSpecialObject(cx, JSXML_CLASS_TEXT, NULL, atom);
@ -3547,7 +3547,7 @@ END_CASE(JSOP_XMLCDATA)
BEGIN_CASE(JSOP_XMLCOMMENT)
{
JS_ASSERT(!script->strictModeCode);
JS_ASSERT(!script->strict);
JSAtom *atom = script->getAtom(regs.pc);
JSObject *obj = js_NewXMLSpecialObject(cx, JSXML_CLASS_COMMENT, NULL, atom);
@ -3559,7 +3559,7 @@ END_CASE(JSOP_XMLCOMMENT)
BEGIN_CASE(JSOP_XMLPI)
{
JS_ASSERT(!script->strictModeCode);
JS_ASSERT(!script->strict);
JSAtom *atom = script->getAtom(regs.pc);
Value rval = regs.sp[-1];
@ -3573,7 +3573,7 @@ END_CASE(JSOP_XMLPI)
BEGIN_CASE(JSOP_GETFUNNS)
{
JS_ASSERT(!script->strictModeCode);
JS_ASSERT(!script->strict);
Value rval;
if (!cx->fp()->global().getFunctionNamespace(cx, &rval))

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

@ -87,7 +87,7 @@ ComputeThis(JSContext *cx, StackFrame *fp)
if (thisv.isObject())
return true;
if (fp->isFunctionFrame()) {
if (fp->fun()->inStrictMode() || fp->fun()->isSelfHostedBuiltin())
if (fp->fun()->strict() || fp->fun()->isSelfHostedBuiltin())
return true;
/*
* Eval function frames have their own |this| slot, which is a copy of the function's
@ -346,7 +346,7 @@ SetPropertyOperation(JSContext *cx, jsbytecode *pc, HandleValue lval, HandleValu
JSObject::nativeSetSlotWithType(cx, obj, shape, rval);
} else {
RootedValue rref(cx, rval);
bool strict = cx->stack.currentScript()->strictModeCode;
bool strict = cx->stack.currentScript()->strict;
if (!js_NativeSet(cx, obj, obj, shape, false, strict, rref.address()))
return false;
}
@ -356,7 +356,7 @@ SetPropertyOperation(JSContext *cx, jsbytecode *pc, HandleValue lval, HandleValu
GET_NAME_FROM_BYTECODE(cx->stack.currentScript(), pc, 0, name);
}
bool strict = cx->stack.currentScript()->strictModeCode;
bool strict = cx->stack.currentScript()->strict;
RootedValue rref(cx, rval);
RootedId id(cx, NameToId(name));
@ -446,7 +446,7 @@ SetNameOperation(JSContext *cx, JSScript *script, jsbytecode *pc, HandleObject s
JS_ASSERT(*pc == JSOP_SETNAME || *pc == JSOP_SETGNAME);
JS_ASSERT_IF(*pc == JSOP_SETGNAME, scope == cx->global());
bool strict = script->strictModeCode;
bool strict = script->strict;
RootedPropertyName name(cx, script->getName(pc));
RootedValue valCopy(cx, val);

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

@ -4433,7 +4433,7 @@ js::CheckUndeclaredVarAssignment(JSContext *cx, JSString *propname)
return true;
/* If neither cx nor the code is strict, then no check is needed. */
if (!script->strictModeCode && !cx->hasStrictOption())
if (!script->strict && !cx->hasStrictOption())
return true;
JSAutoByteString bytes(cx, propname);

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

@ -4952,7 +4952,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
* that checks for JSOP_LAMBDA.
*/
bool grouped = !fun->isExprClosure();
bool strict = jp->script->strictModeCode;
bool strict = jp->script->strict;
str = js_DecompileToString(cx, "lambda", fun, 0,
false, grouped, strict,
DecompileFunction);
@ -5630,7 +5630,7 @@ static JSBool
DecompileBody(JSPrinter *jp, JSScript *script, jsbytecode *pc)
{
/* Print a strict mode code directive, if needed. */
if (script->strictModeCode && !jp->strict) {
if (script->strict && !jp->strict) {
if (jp->fun && jp->fun->isExprClosure()) {
/*
* We have no syntax for strict function expressions;

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

@ -393,7 +393,7 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
enum ScriptBits {
NoScriptRval,
SavedCallerFun,
StrictModeCode,
Strict,
ContainsDynamicNameAccess,
FunHasExtensibleScope,
FunHasAnyAliasedFormal,
@ -470,8 +470,8 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
scriptBits |= (1 << NoScriptRval);
if (script->savedCallerFun)
scriptBits |= (1 << SavedCallerFun);
if (script->strictModeCode)
scriptBits |= (1 << StrictModeCode);
if (script->strict)
scriptBits |= (1 << Strict);
if (script->explicitUseStrict)
scriptBits |= (1 << ExplicitUseStrict);
if (script->bindingsAccessedDynamically)
@ -573,8 +573,8 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
notes = script->notes();
scriptp.set(script);
if (scriptBits & (1 << StrictModeCode))
script->strictModeCode = true;
if (scriptBits & (1 << Strict))
script->strict = true;
if (scriptBits & (1 << ExplicitUseStrict))
script->explicitUseStrict = true;
if (scriptBits & (1 << ContainsDynamicNameAccess))
@ -1770,7 +1770,7 @@ JSScript::fullyInitFromEmitter(JSContext *cx, Handle<JSScript*> script, Bytecode
bce->regexpList.finish(script->regexps());
if (bce->constList.length() != 0)
bce->constList.finish(script->consts());
script->strictModeCode = bce->sc->strictMode;
script->strict = bce->sc->strict;
script->explicitUseStrict = bce->sc->hasExplicitUseStrict();
script->bindingsAccessedDynamically = bce->sc->bindingsAccessedDynamically();
script->funHasExtensibleScope = funbox ? funbox->hasExtensibleScope() : false;
@ -2293,7 +2293,7 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun,
dst->setNeedsArgsObj(src->needsArgsObj());
}
dst->cloneHasArray(src);
dst->strictModeCode = src->strictModeCode;
dst->strict = src->strict;
dst->explicitUseStrict = src->explicitUseStrict;
dst->bindingsAccessedDynamically = src->bindingsAccessedDynamically;
dst->funHasExtensibleScope = src->funHasExtensibleScope;

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

@ -462,7 +462,7 @@ struct JSScript : public js::gc::Cell
bool noScriptRval:1; /* no need for result value of last
expression statement */
bool savedCallerFun:1; /* can call getCallerFunction() */
bool strictModeCode:1; /* code is in strict mode */
bool strict:1; /* code is in strict mode */
bool explicitUseStrict:1; /* code has "use strict"; explicitly */
bool compileAndGo:1; /* see Parser::compileAndGo */
bool bindingsAccessedDynamically:1; /* see ContextFlags' field of the same name */
@ -560,7 +560,7 @@ struct JSScript : public js::gc::Cell
* opcodes won't be emitted at all.
*/
bool argsObjAliasesFormals() const {
return needsArgsObj() && !strictModeCode;
return needsArgsObj() && !strict;
}
bool hasAnyIonScript() const {

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

@ -1503,7 +1503,7 @@ static const JSC::MacroAssembler::RegisterID JSParamReg_Argc = JSC::MIPSRegiste
/* Return f<true> if the script is strict mode code, f<false> otherwise. */
#define STRICT_VARIANT(script, f) \
(FunctionTemplateConditional(script->strictModeCode, \
(FunctionTemplateConditional(script->strict, \
f<true>, f<false>))
/* Save some typing. */

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

@ -321,7 +321,7 @@ mjit::Compiler::scanInlineCalls(uint32_t index, uint32_t depth)
*/
if (!globalObj ||
fun->getParent() != globalObj ||
outerScript->strictModeCode != script->strictModeCode) {
outerScript->strict != script->strict) {
okay = false;
break;
}
@ -1263,7 +1263,7 @@ mjit::Compiler::generatePrologue()
}
/* Inline StackFrame::prologue. */
if (script_->isActiveEval && script_->strictModeCode) {
if (script_->isActiveEval && script_->strict) {
prepareStubCall(Uses(0));
INLINE_STUBCALL(stubs::StrictEvalPrologue, REJOIN_EVAL_PROLOGUE);
} else if (script_->function()) {
@ -1797,7 +1797,7 @@ mjit::Compiler::finishThisUp()
new (&to) ic::SetElementIC();
from.copyTo(to, fullCode, stubCode);
to.strictMode = script_->strictModeCode;
to.strictMode = script_->strict;
to.vr = from.vr;
to.objReg = from.objReg;
to.objRemat = from.objRemat.toInt32();
@ -6124,7 +6124,7 @@ mjit::Compiler::jsop_this()
* In direct-call eval code, we wrapped 'this' before entering the eval.
* In global code, 'this' is always an object.
*/
if (script_->function() && !script_->strictModeCode &&
if (script_->function() && !script_->strict &&
!script_->function()->isSelfHostedBuiltin())
{
FrameEntry *thisFe = frame.peek(-1);

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

@ -1457,7 +1457,7 @@ stubs::DelName(VMFrame &f, PropertyName *name_)
THROW();
/* Strict mode code should never contain JSOP_DELNAME opcodes. */
JS_ASSERT(!f.script()->strictModeCode);
JS_ASSERT(!f.script()->strict);
/* ECMA says to return true if name is undefined or inherited. */
f.regs.sp++;

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

@ -129,7 +129,7 @@ ArgumentsObject::create(JSContext *cx, HandleScript script, HandleFunction calle
if (!type)
return NULL;
bool strict = callee->inStrictMode();
bool strict = callee->strict();
Class *clasp = strict ? &StrictArgumentsObjectClass : &NormalArgumentsObjectClass;
RootedShape shape(cx, EmptyShape::getInitialShape(cx, clasp, TaggedProto(proto),

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

@ -286,7 +286,7 @@ StackFrame::prologue(JSContext *cx, bool newType)
JS_ASSERT(cx->regs().pc == script->code);
if (isEvalFrame()) {
if (script->strictModeCode) {
if (script->strict) {
CallObject *callobj = CallObject::createForStrictEval(cx, this);
if (!callobj)
return false;

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

@ -434,11 +434,11 @@ class StackFrame
}
inline bool isStrictEvalFrame() const {
return isEvalFrame() && script()->strictModeCode;
return isEvalFrame() && script()->strict;
}
bool isNonStrictEvalFrame() const {
return isEvalFrame() && !script()->strictModeCode;
return isEvalFrame() && !script()->strict;
}
bool isDirectEvalFrame() const {