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 && if (length > 2 &&
((chars[0] == '[' && chars[length - 1] == ']') || ((chars[0] == '[' && chars[length - 1] == ']') ||
(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: // Remarkably, JavaScript syntax is not a superset of JSON syntax:
// strings in JavaScript cannot contain the Unicode line and paragraph // strings in JavaScript cannot contain the Unicode line and paragraph

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

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

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

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

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

@ -434,7 +434,7 @@ CloneParseTree(ParseNode *opn, Parser *parser)
case PN_FUNC: case PN_FUNC:
NULLCHECK(pn->pn_funbox = 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)); NULLCHECK(pn->pn_body = CloneParseTree(opn->pn_body, parser));
pn->pn_cookie = opn->pn_cookie; pn->pn_cookie = opn->pn_cookie;
pn->pn_dflags = opn->pn_dflags; pn->pn_dflags = opn->pn_dflags;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -111,7 +111,7 @@ struct JSFunction : public JSObject
} }
/* Returns the strictness of this function, which must be interpreted. */ /* 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. // Can be called multiple times by the parser.
void setArgCount(uint16_t nargs) { void setArgCount(uint16_t nargs) {

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

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

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

@ -1488,7 +1488,7 @@ TypeConstraintArith::newType(JSContext *cx, TypeSet *source, Type type)
void void
TypeConstraintTransformThis::newType(JSContext *cx, TypeSet *source, Type type) 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); target->addType(cx, type);
return; return;
} }

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

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

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

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

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

@ -4433,7 +4433,7 @@ js::CheckUndeclaredVarAssignment(JSContext *cx, JSString *propname)
return true; return true;
/* If neither cx nor the code is strict, then no check is needed. */ /* 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; return true;
JSAutoByteString bytes(cx, propname); JSAutoByteString bytes(cx, propname);

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

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

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

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

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

@ -462,7 +462,7 @@ struct JSScript : public js::gc::Cell
bool noScriptRval:1; /* no need for result value of last bool noScriptRval:1; /* no need for result value of last
expression statement */ expression statement */
bool savedCallerFun:1; /* can call getCallerFunction() */ 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 explicitUseStrict:1; /* code has "use strict"; explicitly */
bool compileAndGo:1; /* see Parser::compileAndGo */ bool compileAndGo:1; /* see Parser::compileAndGo */
bool bindingsAccessedDynamically:1; /* see ContextFlags' field of the same name */ 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. * opcodes won't be emitted at all.
*/ */
bool argsObjAliasesFormals() const { bool argsObjAliasesFormals() const {
return needsArgsObj() && !strictModeCode; return needsArgsObj() && !strict;
} }
bool hasAnyIonScript() const { 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. */ /* Return f<true> if the script is strict mode code, f<false> otherwise. */
#define STRICT_VARIANT(script, f) \ #define STRICT_VARIANT(script, f) \
(FunctionTemplateConditional(script->strictModeCode, \ (FunctionTemplateConditional(script->strict, \
f<true>, f<false>)) f<true>, f<false>))
/* Save some typing. */ /* Save some typing. */

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

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

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

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

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

@ -129,7 +129,7 @@ ArgumentsObject::create(JSContext *cx, HandleScript script, HandleFunction calle
if (!type) if (!type)
return NULL; return NULL;
bool strict = callee->inStrictMode(); bool strict = callee->strict();
Class *clasp = strict ? &StrictArgumentsObjectClass : &NormalArgumentsObjectClass; Class *clasp = strict ? &StrictArgumentsObjectClass : &NormalArgumentsObjectClass;
RootedShape shape(cx, EmptyShape::getInitialShape(cx, clasp, TaggedProto(proto), 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); JS_ASSERT(cx->regs().pc == script->code);
if (isEvalFrame()) { if (isEvalFrame()) {
if (script->strictModeCode) { if (script->strict) {
CallObject *callobj = CallObject::createForStrictEval(cx, this); CallObject *callobj = CallObject::createForStrictEval(cx, this);
if (!callobj) if (!callobj)
return false; return false;

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

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