mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 775684 - rm PND_TOPLEVEL (r=ejpbruel)
--HG-- extra : rebase_source : 90fed1498fc1e34d721afa5a3a4ba518ad0cf3c9
This commit is contained in:
parent
4bc4a22cd9
commit
6a7eb2d947
@ -1178,7 +1178,6 @@ TryConvertToGname(BytecodeEmitter *bce, ParseNode *pn, JSOp *op)
|
|||||||
case JSOP_DECNAME: *op = JSOP_DECGNAME; break;
|
case JSOP_DECNAME: *op = JSOP_DECGNAME; break;
|
||||||
case JSOP_NAMEDEC: *op = JSOP_GNAMEDEC; break;
|
case JSOP_NAMEDEC: *op = JSOP_GNAMEDEC; break;
|
||||||
case JSOP_SETCONST:
|
case JSOP_SETCONST:
|
||||||
case JSOP_DELNAME:
|
|
||||||
/* Not supported. */
|
/* Not supported. */
|
||||||
return false;
|
return false;
|
||||||
default: JS_NOT_REACHED("gname");
|
default: JS_NOT_REACHED("gname");
|
||||||
@ -1210,12 +1209,14 @@ BindNameToSlot(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
|||||||
{
|
{
|
||||||
JS_ASSERT(pn->isKind(PNK_NAME));
|
JS_ASSERT(pn->isKind(PNK_NAME));
|
||||||
|
|
||||||
/* Don't attempt if 'pn' is already bound, deoptimized, or a nop. */
|
/* Don't attempt if 'pn' is already bound or deoptimized or a nop. */
|
||||||
if ((pn->pn_dflags & PND_BOUND) || pn->isDeoptimized() || pn->getOp() == JSOP_NOP)
|
JSOp op = pn->getOp();
|
||||||
|
if (pn->isBound() || pn->isDeoptimized() || op == JSOP_NOP)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* JSOP_CALLEE is pre-bound by definition. */
|
/* JSOP_CALLEE is pre-bound by definition. */
|
||||||
JS_ASSERT(!pn->isOp(JSOP_CALLEE));
|
JS_ASSERT(op != JSOP_CALLEE);
|
||||||
|
JS_ASSERT(JOF_OPTYPE(op) == JOF_ATOM);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The parser already linked name uses to definitions when (where not
|
* The parser already linked name uses to definitions when (where not
|
||||||
@ -1233,8 +1234,6 @@ BindNameToSlot(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSOp op = pn->getOp();
|
|
||||||
JS_ASSERT(JOF_OPTYPE(op) == JOF_ATOM);
|
|
||||||
JS_ASSERT_IF(dn->kind() == Definition::CONST, pn->pn_dflags & PND_CONST);
|
JS_ASSERT_IF(dn->kind() == Definition::CONST, pn->pn_dflags & PND_CONST);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1250,16 +1249,6 @@ BindNameToSlot(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
|||||||
case JSOP_NAME:
|
case JSOP_NAME:
|
||||||
case JSOP_SETCONST:
|
case JSOP_SETCONST:
|
||||||
break;
|
break;
|
||||||
case JSOP_DELNAME:
|
|
||||||
if (dn->kind() != Definition::UNKNOWN) {
|
|
||||||
if (bce->callerFrame && dn->isTopLevel())
|
|
||||||
JS_ASSERT(bce->script->compileAndGo);
|
|
||||||
else
|
|
||||||
pn->setOp(JSOP_FALSE);
|
|
||||||
pn->pn_dflags |= PND_BOUND;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
if (pn->isConst()) {
|
if (pn->isConst()) {
|
||||||
if (bce->sc->needStrictChecks()) {
|
if (bce->sc->needStrictChecks()) {
|
||||||
@ -1394,7 +1383,6 @@ BindNameToSlot(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
|||||||
* heavyweight, ensuring that the function name is represented in
|
* heavyweight, ensuring that the function name is represented in
|
||||||
* the scope chain so that assignment will throw a TypeError.
|
* the scope chain so that assignment will throw a TypeError.
|
||||||
*/
|
*/
|
||||||
JS_ASSERT(op != JSOP_DELNAME);
|
|
||||||
if (!bce->sc->funIsHeavyweight()) {
|
if (!bce->sc->funIsHeavyweight()) {
|
||||||
op = JSOP_CALLEE;
|
op = JSOP_CALLEE;
|
||||||
pn->pn_dflags |= PND_CONST;
|
pn->pn_dflags |= PND_CONST;
|
||||||
|
@ -727,16 +727,15 @@ struct ParseNode {
|
|||||||
#define PND_LET 0x01 /* let (block-scoped) binding */
|
#define PND_LET 0x01 /* let (block-scoped) binding */
|
||||||
#define PND_CONST 0x02 /* const binding (orthogonal to let) */
|
#define PND_CONST 0x02 /* const binding (orthogonal to let) */
|
||||||
#define PND_ASSIGNED 0x04 /* set if ever LHS of assignment */
|
#define PND_ASSIGNED 0x04 /* set if ever LHS of assignment */
|
||||||
#define PND_TOPLEVEL 0x08 /* see isTopLevel() below */
|
#define PND_BLOCKCHILD 0x08 /* use or def is direct block child */
|
||||||
#define PND_BLOCKCHILD 0x10 /* use or def is direct block child */
|
#define PND_PLACEHOLDER 0x10 /* placeholder definition for lexdep */
|
||||||
#define PND_PLACEHOLDER 0x20 /* placeholder definition for lexdep */
|
#define PND_BOUND 0x20 /* bound to a stack or global slot */
|
||||||
#define PND_BOUND 0x40 /* bound to a stack or global slot */
|
#define PND_DEOPTIMIZED 0x40 /* former pn_used name node, pn_lexdef
|
||||||
#define PND_DEOPTIMIZED 0x80 /* former pn_used name node, pn_lexdef
|
|
||||||
still valid, but this use no longer
|
still valid, but this use no longer
|
||||||
optimizable via an upvar opcode */
|
optimizable via an upvar opcode */
|
||||||
#define PND_CLOSED 0x100 /* variable is closed over */
|
#define PND_CLOSED 0x80 /* variable is closed over */
|
||||||
#define PND_DEFAULT 0x200 /* definition is an arg with a default */
|
#define PND_DEFAULT 0x100 /* definition is an arg with a default */
|
||||||
#define PND_IMPLICITARGUMENTS 0x400 /* the definition is a placeholder for
|
#define PND_IMPLICITARGUMENTS 0x200 /* the definition is a placeholder for
|
||||||
'arguments' that has been converted
|
'arguments' that has been converted
|
||||||
into a definition after the function
|
into a definition after the function
|
||||||
body has been parsed. */
|
body has been parsed. */
|
||||||
@ -785,22 +784,9 @@ struct ParseNode {
|
|||||||
bool isDeoptimized() const { return test(PND_DEOPTIMIZED); }
|
bool isDeoptimized() const { return test(PND_DEOPTIMIZED); }
|
||||||
bool isAssigned() const { return test(PND_ASSIGNED); }
|
bool isAssigned() const { return test(PND_ASSIGNED); }
|
||||||
bool isClosed() const { return test(PND_CLOSED); }
|
bool isClosed() const { return test(PND_CLOSED); }
|
||||||
|
bool isBound() const { return test(PND_BOUND); }
|
||||||
bool isImplicitArguments() const { return test(PND_IMPLICITARGUMENTS); }
|
bool isImplicitArguments() const { return test(PND_IMPLICITARGUMENTS); }
|
||||||
|
|
||||||
/*
|
|
||||||
* True iff this definition creates a top-level binding in the overall
|
|
||||||
* script being compiled -- that is, it affects the whole program's
|
|
||||||
* bindings, not bindings for a specific function (unless this definition
|
|
||||||
* is in the outermost scope in eval code, executed within a function) or
|
|
||||||
* the properties of a specific object (through the with statement).
|
|
||||||
*
|
|
||||||
* NB: Function sub-statements found in overall program code and not nested
|
|
||||||
* within other functions are not currently top level, even though (if
|
|
||||||
* executed) they do create top-level bindings; there is no particular
|
|
||||||
* rationale for this behavior.
|
|
||||||
*/
|
|
||||||
bool isTopLevel() const { return test(PND_TOPLEVEL); }
|
|
||||||
|
|
||||||
void become(ParseNode *pn2);
|
void become(ParseNode *pn2);
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
@ -801,8 +801,6 @@ Define(ParseNode *pn, JSAtom *atom, TreeContext *tc, bool let = false)
|
|||||||
return false;
|
return false;
|
||||||
pn->setDefn(true);
|
pn->setDefn(true);
|
||||||
pn->pn_dflags &= ~PND_PLACEHOLDER;
|
pn->pn_dflags &= ~PND_PLACEHOLDER;
|
||||||
if (!tc->parent)
|
|
||||||
pn->pn_dflags |= PND_TOPLEVEL;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4797,6 +4795,9 @@ Parser::unaryExpr()
|
|||||||
case PNK_NAME:
|
case PNK_NAME:
|
||||||
if (!reportStrictModeError(pn, JSMSG_DEPRECATED_DELETE_OPERAND))
|
if (!reportStrictModeError(pn, JSMSG_DEPRECATED_DELETE_OPERAND))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
tc->sc->setBindingsAccessedDynamically();
|
||||||
|
tc->sc->setFunIsHeavyweight();
|
||||||
|
pn2->pn_dflags |= PND_DEOPTIMIZED;
|
||||||
pn2->setOp(JSOP_DELNAME);
|
pn2->setOp(JSOP_DELNAME);
|
||||||
break;
|
break;
|
||||||
default:;
|
default:;
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
// |reftest| skip-if(xulRuntime.shell)
|
||||||
|
// skip in the shell because 'arguments' is defined as a shell utility function
|
||||||
|
|
||||||
/* Check we can delete arguments in the global space. */
|
/* Check we can delete arguments in the global space. */
|
||||||
arguments = 42;
|
arguments = 42;
|
||||||
reportCompare(delete arguments, true, "arguments defined as global");
|
reportCompare(delete arguments, true, "arguments defined as global");
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
// |reftest| skip-if(xulRuntime.shell)
|
||||||
|
// skip in the shell because 'arguments' is defined as a shell utility function
|
||||||
|
|
||||||
/* Check we can't delete a var-declared arguments in global space. */
|
/* Check we can't delete a var-declared arguments in global space. */
|
||||||
var arguments = 42;
|
var arguments = 42;
|
||||||
reportCompare(delete arguments, false, "arguments defined as global variable");
|
reportCompare(delete arguments, false, "arguments defined as global variable");
|
||||||
|
Loading…
Reference in New Issue
Block a user