|
@@ -1,7 +1,7 @@
|
|
|
# HG changeset patch
|
|
|
# User Dmitry Butskoy <buc@buc.me>
|
|
|
# Date 1649886657 -7200
|
|
|
-# Parent a172a95aba2b752161964f848c75ec4716eb8969
|
|
|
+# Parent 565f6c571105c0398fa19cd402e653723bf8eb64
|
|
|
Bug 1378808 - Optional chaining prerequsites.
|
|
|
|
|
|
Backport of Mozilla's bug 1378808 and others, mostly to prepare code for
|
|
@@ -13,7 +13,7 @@ backporting of optional chaining support.
|
|
|
diff --git a/js/src/builtin/ReflectParse.cpp b/js/src/builtin/ReflectParse.cpp
|
|
|
--- a/js/src/builtin/ReflectParse.cpp
|
|
|
+++ b/js/src/builtin/ReflectParse.cpp
|
|
|
-@@ -2727,34 +2727,35 @@ ASTSerializer::expression(ParseNode* pn,
|
|
|
+@@ -2721,34 +2721,35 @@ ASTSerializer::expression(ParseNode* pn,
|
|
|
builder.unaryExpression(op, expr, &pn->pn_pos, dst);
|
|
|
}
|
|
|
|
|
@@ -56,7 +56,7 @@ diff --git a/js/src/builtin/ReflectParse.cpp b/js/src/builtin/ReflectParse.cpp
|
|
|
args.infallibleAppend(arg);
|
|
|
}
|
|
|
|
|
|
-@@ -2765,27 +2766,27 @@ ASTSerializer::expression(ParseNode* pn,
|
|
|
+@@ -2759,27 +2760,27 @@ ASTSerializer::expression(ParseNode* pn,
|
|
|
return pn->isKind(ParseNodeKind::New)
|
|
|
? builder.newExpression(callee, args, &pn->pn_pos, dst)
|
|
|
|
|
@@ -91,7 +91,7 @@ diff --git a/js/src/builtin/ReflectParse.cpp b/js/src/builtin/ReflectParse.cpp
|
|
|
diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp
|
|
|
--- a/js/src/frontend/BytecodeEmitter.cpp
|
|
|
+++ b/js/src/frontend/BytecodeEmitter.cpp
|
|
|
-@@ -3330,17 +3330,17 @@ BytecodeEmitter::checkSideEffects(ParseN
|
|
|
+@@ -3483,17 +3483,17 @@ BytecodeEmitter::checkSideEffects(ParseN
|
|
|
case ParseNodeKind::Continue:
|
|
|
case ParseNodeKind::Debugger:
|
|
|
MOZ_ASSERT(pn->isArity(PN_NULLARY));
|
|
@@ -110,7 +110,7 @@ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitt
|
|
|
case ParseNodeKind::Void:
|
|
|
case ParseNodeKind::Not:
|
|
|
MOZ_ASSERT(pn->isArity(PN_UNARY));
|
|
|
-@@ -3569,16 +3569,24 @@ BytecodeEmitter::checkSideEffects(ParseN
|
|
|
+@@ -3722,16 +3722,24 @@ BytecodeEmitter::checkSideEffects(ParseN
|
|
|
goto restart;
|
|
|
return true;
|
|
|
|
|
@@ -135,7 +135,7 @@ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitt
|
|
|
MOZ_ASSERT(pn->isArity(PN_LIST));
|
|
|
MOZ_ASSERT(pn->pn_count >= 2);
|
|
|
*answer = true;
|
|
|
-@@ -3703,16 +3711,17 @@ BytecodeEmitter::checkSideEffects(ParseN
|
|
|
+@@ -3856,16 +3864,17 @@ BytecodeEmitter::checkSideEffects(ParseN
|
|
|
case ParseNodeKind::ImportSpecList: // byParseNodeKind::Import
|
|
|
case ParseNodeKind::ImportSpec: // byParseNodeKind::Import
|
|
|
case ParseNodeKind::ExportBatchSpec: // byParseNodeKind::Export
|
|
@@ -153,7 +153,7 @@ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitt
|
|
|
|
|
|
MOZ_CRASH("invalid, unenumerated ParseNodeKind value encountered in "
|
|
|
"BytecodeEmitter::checkSideEffects");
|
|
|
-@@ -4144,49 +4153,49 @@ BytecodeEmitter::emitTDZCheckIfNeeded(JS
|
|
|
+@@ -4297,49 +4306,49 @@ BytecodeEmitter::emitTDZCheckIfNeeded(JS
|
|
|
}
|
|
|
|
|
|
bool
|
|
@@ -214,7 +214,7 @@ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitt
|
|
|
// The non-optimized case.
|
|
|
return emitTree(pn2);
|
|
|
}
|
|
|
-@@ -4201,41 +4210,41 @@ BytecodeEmitter::emitSuperPropLHS(ParseN
|
|
|
+@@ -4354,41 +4363,41 @@ BytecodeEmitter::emitSuperPropLHS(ParseN
|
|
|
if (!emit1(JSOP_SUPERBASE))
|
|
|
return false;
|
|
|
return true;
|
|
@@ -259,7 +259,7 @@ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitt
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-@@ -4255,17 +4264,17 @@ BytecodeEmitter::emitPropIncDec(ParseNod
|
|
|
+@@ -4408,17 +4417,17 @@ BytecodeEmitter::emitPropIncDec(ParseNod
|
|
|
if (!emit1(JSOP_DUP2)) // THIS OBJ THIS OBJ
|
|
|
return false;
|
|
|
} else {
|
|
@@ -278,7 +278,7 @@ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitt
|
|
|
if (!emit1(JSOP_ONE)) // OBJ N? N 1
|
|
|
return false;
|
|
|
if (!emit1(binop)) // OBJ N? N+1
|
|
|
-@@ -4281,17 +4290,17 @@ BytecodeEmitter::emitPropIncDec(ParseNod
|
|
|
+@@ -4434,17 +4443,17 @@ BytecodeEmitter::emitPropIncDec(ParseNod
|
|
|
return false;
|
|
|
if (!emit1(JSOP_SWAP)) // N THIS OBJ N+1
|
|
|
return false;
|
|
@@ -297,7 +297,7 @@ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitt
|
|
|
}
|
|
|
|
|
|
bool
|
|
|
-@@ -5247,17 +5256,17 @@ BytecodeEmitter::emitDestructuringLHSRef
|
|
|
+@@ -5356,17 +5365,17 @@ BytecodeEmitter::emitDestructuringLHSRef
|
|
|
|
|
|
switch (target->getKind()) {
|
|
|
case ParseNodeKind::Dot: {
|
|
@@ -316,7 +316,7 @@ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitt
|
|
|
|
|
|
case ParseNodeKind::Elem: {
|
|
|
if (target->as<PropertyByValue>().isSuper()) {
|
|
|
-@@ -5365,17 +5374,17 @@ BytecodeEmitter::emitSetOrInitializeDest
|
|
|
+@@ -5474,17 +5483,17 @@ BytecodeEmitter::emitSetOrInitializeDest
|
|
|
|
|
|
case ParseNodeKind::Dot: {
|
|
|
// The reference is already pushed by emitDestructuringLHSRef.
|
|
@@ -335,7 +335,7 @@ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitt
|
|
|
// The reference is already pushed by emitDestructuringLHSRef.
|
|
|
if (target->as<PropertyByValue>().isSuper()) {
|
|
|
JSOp setOp = sc->strict() ? JSOP_STRICTSETELEM_SUPER : JSOP_SETELEM_SUPER;
|
|
|
-@@ -6478,21 +6487,21 @@ BytecodeEmitter::emitAssignment(ParseNod
|
|
|
+@@ -6586,21 +6595,21 @@ BytecodeEmitter::emitAssignment(ParseNod
|
|
|
|
|
|
switch (lhs->getKind()) {
|
|
|
case ParseNodeKind::Dot:
|
|
@@ -359,7 +359,7 @@ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitt
|
|
|
if (lhs->as<PropertyByValue>().isSuper()) {
|
|
|
if (!emitSuperElemOperands(lhs, opt))
|
|
|
return false;
|
|
|
-@@ -6531,17 +6540,17 @@ BytecodeEmitter::emitAssignment(ParseNod
|
|
|
+@@ -6639,17 +6648,17 @@ BytecodeEmitter::emitAssignment(ParseNod
|
|
|
JSOp getOp;
|
|
|
if (lhs->as<PropertyAccess>().isSuper()) {
|
|
|
if (!emit1(JSOP_DUP2))
|
|
@@ -378,7 +378,7 @@ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitt
|
|
|
}
|
|
|
case ParseNodeKind::Elem: {
|
|
|
JSOp elemOp;
|
|
|
-@@ -7364,17 +7373,17 @@ BytecodeEmitter::emitForOf(ParseNode* fo
|
|
|
+@@ -7477,17 +7486,17 @@ BytecodeEmitter::emitForOf(ParseNode* fo
|
|
|
|
|
|
ParseNode* forHeadExpr = forOfHead->pn_kid3;
|
|
|
|
|
@@ -397,7 +397,7 @@ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitt
|
|
|
// distinct TDZCheckCache to evaluate since (abstractly) it runs in its own
|
|
|
// LexicalEnvironment.
|
|
|
if (!emitTreeInBranch(forHeadExpr)) // ITERABLE
|
|
|
-@@ -9063,45 +9072,47 @@ BytecodeEmitter::emitSelfHostedCallFunct
|
|
|
+@@ -9175,45 +9184,47 @@ BytecodeEmitter::emitSelfHostedCallFunct
|
|
|
// invokes the callee with the correct |this| object and arguments.
|
|
|
// callFunction(fun, thisArg, arg0, arg1) thus becomes:
|
|
|
// - emit lookup for fun
|
|
@@ -452,7 +452,7 @@ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitt
|
|
|
|
|
|
ParseNode* thisOrNewTarget = funNode->pn_next;
|
|
|
if (constructing) {
|
|
|
-@@ -9120,36 +9131,36 @@ BytecodeEmitter::emitSelfHostedCallFunct
|
|
|
+@@ -9232,36 +9243,36 @@ BytecodeEmitter::emitSelfHostedCallFunct
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -494,7 +494,7 @@ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitt
|
|
|
return false;
|
|
|
|
|
|
ParseNode* kindNode = valNode->pn_next;
|
|
|
-@@ -9171,34 +9182,36 @@ BytecodeEmitter::emitSelfHostedForceInte
|
|
|
+@@ -9283,34 +9294,36 @@ BytecodeEmitter::emitSelfHostedForceInte
|
|
|
if (!emit1(JSOP_UNDEFINED))
|
|
|
return false;
|
|
|
return true;
|
|
@@ -539,7 +539,7 @@ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitt
|
|
|
return false;
|
|
|
|
|
|
ParseNode* valNode = idNode->pn_next;
|
|
|
-@@ -9209,24 +9222,24 @@ BytecodeEmitter::emitSelfHostedDefineDat
|
|
|
+@@ -9321,24 +9334,24 @@ BytecodeEmitter::emitSelfHostedDefineDat
|
|
|
// but that's fine because the self-hosted code doesn't use the return
|
|
|
// value.
|
|
|
return emit1(JSOP_INITELEM);
|
|
@@ -568,7 +568,7 @@ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitt
|
|
|
return false;
|
|
|
|
|
|
return emit1(JSOP_HASOWN);
|
|
|
-@@ -9266,21 +9279,21 @@ BytecodeEmitter::isRestParameter(ParseNo
|
|
|
+@@ -9378,21 +9391,21 @@ BytecodeEmitter::isRestParameter(ParseNo
|
|
|
|
|
|
FunctionBox* funbox = sc->asFunctionBox();
|
|
|
RootedFunction fun(cx, funbox->function());
|
|
@@ -594,7 +594,7 @@ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitt
|
|
|
JSAtom* name = pn->name();
|
|
|
Maybe<NameLocation> paramLoc = locationOfNameBoundInFunctionScope(name);
|
|
|
if (paramLoc && lookupName(name) == *paramLoc) {
|
|
|
-@@ -9399,114 +9412,34 @@ BytecodeEmitter::emitPipeline(ParseNode*
|
|
|
+@@ -9512,114 +9525,34 @@ BytecodeEmitter::emitPipeline(ParseNode*
|
|
|
|
|
|
checkTypeSet(JSOP_CALL);
|
|
|
} while ((callee = callee->pn_next));
|
|
@@ -623,11 +623,10 @@ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitt
|
|
|
- * will box into the global object).
|
|
|
- */
|
|
|
- uint32_t argc = pn->pn_count - 1;
|
|
|
--
|
|
|
+BytecodeEmitter::emitArguments(ParseNode* pn, bool callop, bool spread)
|
|
|
+{
|
|
|
+ uint32_t argc = pn->pn_count;
|
|
|
-+
|
|
|
+
|
|
|
if (argc >= ARGC_LIMIT) {
|
|
|
reportError(pn, callop ? JSMSG_TOO_MANY_FUN_ARGS : JSMSG_TOO_MANY_CON_ARGS);
|
|
|
return false;
|
|
@@ -705,7 +704,7 @@ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitt
|
|
|
- ParseNode* args = pn2->pn_next;
|
|
|
+ ParseNode* args = pn->pn_head;
|
|
|
bool emitOptCode = (argc == 1) && isRestParameter(args->pn_kid);
|
|
|
- IfThenElseEmitter ifNotOptimizable(this);
|
|
|
+ InternalIfEmitter ifNotOptimizable(this);
|
|
|
-
|
|
|
if (emitOptCode) {
|
|
|
// Emit a preparation code to optimize the spread call with a rest
|
|
@@ -715,7 +714,7 @@ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitt
|
|
|
// g(...args);
|
|
|
// }
|
|
|
//
|
|
|
-@@ -9533,39 +9466,160 @@ BytecodeEmitter::emitCallOrNew(ParseNode
|
|
|
+@@ -9646,39 +9579,160 @@ BytecodeEmitter::emitCallOrNew(ParseNode
|
|
|
|
|
|
if (!emitArray(args, argc))
|
|
|
return false;
|
|
@@ -886,7 +885,7 @@ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitt
|
|
|
pn->isOp(JSOP_STRICTEVAL) ||
|
|
|
pn->isOp(JSOP_SPREADEVAL) ||
|
|
|
pn->isOp(JSOP_STRICTSPREADEVAL))
|
|
|
-@@ -10152,17 +10206,17 @@ BytecodeEmitter::emitArray(ParseNode* pn
|
|
|
+@@ -10265,17 +10319,17 @@ BytecodeEmitter::emitArray(ParseNode* pn
|
|
|
return false;
|
|
|
} else {
|
|
|
ParseNode* expr;
|
|
@@ -905,7 +904,7 @@ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitt
|
|
|
}
|
|
|
if (!emitTree(expr)) // ARRAY INDEX? VALUE
|
|
|
return false;
|
|
|
-@@ -11188,18 +11242,19 @@ BytecodeEmitter::emitTree(ParseNode* pn,
|
|
|
+@@ -11306,18 +11360,19 @@ BytecodeEmitter::emitTree(ParseNode* pn,
|
|
|
return false;
|
|
|
break;
|
|
|
|
|
@@ -929,7 +928,7 @@ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitt
|
|
|
diff --git a/js/src/frontend/BytecodeEmitter.h b/js/src/frontend/BytecodeEmitter.h
|
|
|
--- a/js/src/frontend/BytecodeEmitter.h
|
|
|
+++ b/js/src/frontend/BytecodeEmitter.h
|
|
|
-@@ -854,16 +854,17 @@ struct MOZ_STACK_CLASS BytecodeEmitter
|
|
|
+@@ -849,16 +849,17 @@ struct MOZ_STACK_CLASS BytecodeEmitter
|
|
|
|
|
|
MOZ_NEVER_INLINE MOZ_MUST_USE bool emitIncOrDec(ParseNode* pn);
|
|
|
|
|
@@ -971,7 +970,7 @@ diff --git a/js/src/frontend/FoldConstants.cpp b/js/src/frontend/FoldConstants.c
|
|
|
case ParseNodeKind::CallSiteObj:
|
|
|
case ParseNodeKind::String:
|
|
|
case ParseNodeKind::RegExp:
|
|
|
-@@ -1257,17 +1259,20 @@ FoldElement(JSContext* cx, ParseNode** n
|
|
|
+@@ -1258,17 +1260,20 @@ FoldElement(JSContext* cx, ParseNode** n
|
|
|
}
|
|
|
|
|
|
// If we don't have a name, we can't optimize to getprop.
|
|
@@ -993,7 +992,7 @@ diff --git a/js/src/frontend/FoldConstants.cpp b/js/src/frontend/FoldConstants.c
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-@@ -1413,34 +1418,51 @@ FoldAdd(JSContext* cx, ParseNode** nodeP
|
|
|
+@@ -1414,34 +1419,51 @@ FoldAdd(JSContext* cx, ParseNode** nodeP
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -1049,7 +1048,7 @@ diff --git a/js/src/frontend/FoldConstants.cpp b/js/src/frontend/FoldConstants.c
|
|
|
// If the last node in the list was replaced, pn_tail points into the wrong node.
|
|
|
node->pn_tail = listp;
|
|
|
|
|
|
-@@ -1486,24 +1508,24 @@ FoldForHead(JSContext* cx, ParseNode* no
|
|
|
+@@ -1487,24 +1509,24 @@ FoldForHead(JSContext* cx, ParseNode* no
|
|
|
|
|
|
return true;
|
|
|
}
|
|
@@ -1078,7 +1077,7 @@ diff --git a/js/src/frontend/FoldConstants.cpp b/js/src/frontend/FoldConstants.c
|
|
|
static bool
|
|
|
FoldName(JSContext* cx, ParseNode* node, PerHandlerParser<FullParseHandler>& parser)
|
|
|
{
|
|
|
-@@ -1647,17 +1669,16 @@ Fold(JSContext* cx, ParseNode** pnp, Per
|
|
|
+@@ -1648,17 +1670,16 @@ Fold(JSContext* cx, ParseNode** pnp, Per
|
|
|
case ParseNodeKind::Ne:
|
|
|
case ParseNodeKind::Lt:
|
|
|
case ParseNodeKind::Le:
|
|
@@ -1096,7 +1095,7 @@ diff --git a/js/src/frontend/FoldConstants.cpp b/js/src/frontend/FoldConstants.c
|
|
|
case ParseNodeKind::Var:
|
|
|
case ParseNodeKind::Const:
|
|
|
case ParseNodeKind::Let:
|
|
|
-@@ -1699,20 +1720,24 @@ Fold(JSContext* cx, ParseNode** pnp, Per
|
|
|
+@@ -1700,20 +1721,24 @@ Fold(JSContext* cx, ParseNode** pnp, Per
|
|
|
|
|
|
case ParseNodeKind::Elem:
|
|
|
return FoldElement(cx, pnp, parser);
|
|
@@ -1121,7 +1120,7 @@ diff --git a/js/src/frontend/FoldConstants.cpp b/js/src/frontend/FoldConstants.c
|
|
|
case ParseNodeKind::BitOrAssign:
|
|
|
case ParseNodeKind::BitAndAssign:
|
|
|
case ParseNodeKind::BitXorAssign:
|
|
|
-@@ -1781,16 +1806,19 @@ Fold(JSContext* cx, ParseNode** pnp, Per
|
|
|
+@@ -1783,16 +1808,19 @@ Fold(JSContext* cx, ParseNode** pnp, Per
|
|
|
|
|
|
case ParseNodeKind::ForHead:
|
|
|
return FoldForHead(cx, pn, parser);
|
|
@@ -1181,7 +1180,7 @@ diff --git a/js/src/frontend/FullParseHandler.h b/js/src/frontend/FullParseHandl
|
|
|
|
|
|
ParseNode* newClass(ParseNode* name, ParseNode* heritage, ParseNode* methodBlock,
|
|
|
const TokenPos& pos)
|
|
|
-@@ -657,20 +661,24 @@ class FullParseHandler
|
|
|
+@@ -654,20 +658,24 @@ class FullParseHandler
|
|
|
TokenPos pos(begin, (finallyBlock ? finallyBlock : catchScope)->pn_pos.end);
|
|
|
return new_<TernaryNode>(ParseNodeKind::Try, body, catchScope, finallyBlock, pos);
|
|
|
}
|
|
@@ -1208,7 +1207,7 @@ diff --git a/js/src/frontend/FullParseHandler.h b/js/src/frontend/FullParseHandl
|
|
|
ParseNode* catchpn;
|
|
|
if (catchName) {
|
|
|
catchpn = new_<BinaryNode>(ParseNodeKind::Catch, JSOP_NOP, catchName, catchBody);
|
|
|
-@@ -732,23 +740,18 @@ class FullParseHandler
|
|
|
+@@ -729,23 +737,18 @@ class FullParseHandler
|
|
|
ParseNode* newModule(const TokenPos& pos) {
|
|
|
return new_<CodeNode>(ParseNodeKind::Module, JSOP_NOP, pos);
|
|
|
}
|
|
@@ -1294,7 +1293,7 @@ diff --git a/js/src/frontend/NameFunctions.cpp b/js/src/frontend/NameFunctions.c
|
|
|
for (ParseNode* kid = array->pn_head; kid; kid = kid->pn_next)
|
|
|
MOZ_ASSERT(kid->isKind(ParseNodeKind::TemplateString));
|
|
|
for (ParseNode* next = array->pn_next; next; next = next->pn_next) {
|
|
|
-@@ -691,19 +691,16 @@ class NameResolver
|
|
|
+@@ -692,19 +692,16 @@ class NameResolver
|
|
|
case ParseNodeKind::Add:
|
|
|
case ParseNodeKind::Sub:
|
|
|
case ParseNodeKind::Star:
|
|
@@ -1314,7 +1313,7 @@ diff --git a/js/src/frontend/NameFunctions.cpp b/js/src/frontend/NameFunctions.c
|
|
|
case ParseNodeKind::Var:
|
|
|
case ParseNodeKind::Const:
|
|
|
case ParseNodeKind::Let:
|
|
|
-@@ -727,21 +724,42 @@ class NameResolver
|
|
|
+@@ -728,21 +725,42 @@ class NameResolver
|
|
|
// contents with expressions interpolated into the overall literal.
|
|
|
case ParseNodeKind::TemplateStringList:
|
|
|
MOZ_ASSERT(cur->isArity(PN_LIST));
|
|
@@ -1358,7 +1357,7 @@ diff --git a/js/src/frontend/NameFunctions.cpp b/js/src/frontend/NameFunctions.c
|
|
|
MOZ_ASSERT(cur->isArity(PN_LIST));
|
|
|
#ifdef DEBUG
|
|
|
bool isImport = cur->isKind(ParseNodeKind::ImportSpecList);
|
|
|
-@@ -760,22 +778,22 @@ class NameResolver
|
|
|
+@@ -761,22 +779,22 @@ class NameResolver
|
|
|
MOZ_ASSERT(item->pn_right->isKind(ParseNodeKind::Name));
|
|
|
MOZ_ASSERT(!item->pn_right->expr());
|
|
|
}
|
|
@@ -1383,7 +1382,7 @@ diff --git a/js/src/frontend/NameFunctions.cpp b/js/src/frontend/NameFunctions.c
|
|
|
if (!resolve(cur->expr(), prefix))
|
|
|
return false;
|
|
|
break;
|
|
|
-@@ -804,16 +822,17 @@ class NameResolver
|
|
|
+@@ -805,16 +823,17 @@ class NameResolver
|
|
|
break;
|
|
|
|
|
|
// Kinds that should be handled by parent node resolution.
|
|
@@ -1511,7 +1510,7 @@ diff --git a/js/src/frontend/ParseNode.h b/js/src/frontend/ParseNode.h
|
|
|
F(TemplateStringList) \
|
|
|
F(TemplateString) \
|
|
|
F(TaggedTemplate) \
|
|
|
-@@ -378,34 +380,35 @@ IsTypeofKind(ParseNodeKind kind)
|
|
|
+@@ -379,34 +381,35 @@ IsTypeofKind(ParseNodeKind kind)
|
|
|
* Not,
|
|
|
* BitNot
|
|
|
* TypeOfName, unary pn_kid: UNARY expr
|
|
@@ -1555,7 +1554,7 @@ diff --git a/js/src/frontend/ParseNode.h b/js/src/frontend/ParseNode.h
|
|
|
* destructuring lhs
|
|
|
* pn_left: property id, pn_right: value
|
|
|
* Shorthand binary Same fields as Colon. This is used for object
|
|
|
-@@ -415,30 +418,31 @@ IsTypeofKind(ParseNodeKind kind)
|
|
|
+@@ -416,30 +419,31 @@ IsTypeofKind(ParseNodeKind kind)
|
|
|
* Name, name pn_atom: name, string, or object atom
|
|
|
* String pn_op: JSOP_GETNAME, JSOP_STRING, or JSOP_OBJECT
|
|
|
* If JSOP_GETNAME, pn_op may be JSOP_*ARG or JSOP_*VAR
|
|
@@ -1590,7 +1589,7 @@ diff --git a/js/src/frontend/ParseNode.h b/js/src/frontend/ParseNode.h
|
|
|
* InitialYield unary pn_kid: generator object
|
|
|
* Yield, unary pn_kid: expr or null
|
|
|
* YieldStar,
|
|
|
-@@ -578,18 +582,17 @@ class ParseNode
|
|
|
+@@ -579,18 +583,17 @@ class ParseNode
|
|
|
} unary;
|
|
|
struct { /* name, labeled statement, etc. */
|
|
|
union {
|
|
@@ -1665,7 +1664,7 @@ diff --git a/js/src/frontend/ParseNode.h b/js/src/frontend/ParseNode.h
|
|
|
diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp
|
|
|
--- a/js/src/frontend/Parser.cpp
|
|
|
+++ b/js/src/frontend/Parser.cpp
|
|
|
-@@ -3371,34 +3371,34 @@ GeneralParser<ParseHandler, CharT>::addE
|
|
|
+@@ -3369,34 +3369,34 @@ GeneralParser<ParseHandler, CharT>::addE
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -1704,7 +1703,7 @@ diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp
|
|
|
GeneralParser<ParseHandler, CharT>::templateLiteral(YieldHandling yieldHandling)
|
|
|
{
|
|
|
Node pn = noSubstitutionUntaggedTemplate();
|
|
|
-@@ -8622,68 +8622,71 @@ GeneralParser<ParseHandler, CharT>::assi
|
|
|
+@@ -8643,68 +8643,71 @@ GeneralParser<ParseHandler, CharT>::assi
|
|
|
errorAt(pc->lastAwaitOffset, JSMSG_AWAIT_IN_DEFAULT);
|
|
|
return null();
|
|
|
}
|
|
@@ -1791,7 +1790,7 @@ diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp
|
|
|
if (!pc->sc()->allowSuperProperty())
|
|
|
return false;
|
|
|
|
|
|
-@@ -8719,30 +8722,37 @@ GeneralParser<ParseHandler, CharT>::memb
|
|
|
+@@ -8740,30 +8743,37 @@ GeneralParser<ParseHandler, CharT>::memb
|
|
|
// Gotten by tryNewTarget
|
|
|
tt = anyChars.currentToken().type;
|
|
|
Node ctorExpr = memberExpr(yieldHandling, TripledotProhibited, tt,
|
|
@@ -1838,7 +1837,7 @@ diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp
|
|
|
lhs = handler.newSuperBase(thisName, pos());
|
|
|
if (!lhs)
|
|
|
return null();
|
|
|
-@@ -8765,17 +8775,22 @@ GeneralParser<ParseHandler, CharT>::memb
|
|
|
+@@ -8790,17 +8800,22 @@ GeneralParser<ParseHandler, CharT>::memb
|
|
|
if (!tokenStream.getToken(&tt))
|
|
|
return null();
|
|
|
if (TokenKindIsPossibleIdentifierName(tt)) {
|
|
@@ -1862,7 +1861,7 @@ diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp
|
|
|
}
|
|
|
} else if (tt == TokenKind::LeftBracket) {
|
|
|
Node propExpr = expr(InAllowed, yieldHandling, TripledotProhibited);
|
|
|
-@@ -8801,25 +8816,26 @@ GeneralParser<ParseHandler, CharT>::memb
|
|
|
+@@ -8826,25 +8841,26 @@ GeneralParser<ParseHandler, CharT>::memb
|
|
|
return null();
|
|
|
}
|
|
|
|
|
@@ -1894,7 +1893,7 @@ diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp
|
|
|
Node thisName = newThisName();
|
|
|
if (!thisName)
|
|
|
return null();
|
|
|
-@@ -8828,23 +8844,16 @@ GeneralParser<ParseHandler, CharT>::memb
|
|
|
+@@ -8853,23 +8869,16 @@ GeneralParser<ParseHandler, CharT>::memb
|
|
|
if (!nextMember)
|
|
|
return null();
|
|
|
} else {
|
|
@@ -1918,7 +1917,7 @@ diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp
|
|
|
if (prop == context->names().apply) {
|
|
|
op = JSOP_FUNAPPLY;
|
|
|
if (pc->isFunctionBox())
|
|
|
-@@ -8876,34 +8885,44 @@ GeneralParser<ParseHandler, CharT>::memb
|
|
|
+@@ -8901,34 +8910,44 @@ GeneralParser<ParseHandler, CharT>::memb
|
|
|
// If we're in a method, mark the method as requiring
|
|
|
// support for 'super', since direct eval code can use
|
|
|
// it. (If we're not in a method, that's fine, so
|
|
@@ -1971,7 +1970,7 @@ diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp
|
|
|
diff --git a/js/src/frontend/Parser.h b/js/src/frontend/Parser.h
|
|
|
--- a/js/src/frontend/Parser.h
|
|
|
+++ b/js/src/frontend/Parser.h
|
|
|
-@@ -536,18 +536,22 @@ class PerHandlerParser
|
|
|
+@@ -562,18 +562,22 @@ class MOZ_STACK_CLASS PerHandlerParser
|
|
|
// If ParseHandler is FullParseHandler:
|
|
|
// Do nothing.
|
|
|
inline void clearAbortedSyntaxParse();
|
|
@@ -1996,7 +1995,7 @@ diff --git a/js/src/frontend/Parser.h b/js/src/frontend/Parser.h
|
|
|
};
|
|
|
|
|
|
#define ABORTED_SYNTAX_PARSE_SENTINEL reinterpret_cast<void*>(0x1)
|
|
|
-@@ -1125,17 +1129,17 @@ class GeneralParser
|
|
|
+@@ -1148,17 +1152,17 @@ class MOZ_STACK_CLASS GeneralParser
|
|
|
enum FunctionBodyType { StatementListBody, ExpressionBody };
|
|
|
Node functionBody(InHandling inHandling, YieldHandling yieldHandling, FunctionSyntaxKind kind,
|
|
|
FunctionBodyType type);
|
|
@@ -2043,7 +2042,7 @@ diff --git a/js/src/frontend/SyntaxParseHandler.h b/js/src/frontend/SyntaxParseH
|
|
|
|
|
|
Node newNewTarget(Node newHolder, Node targetHolder) { return NodeGeneric; }
|
|
|
Node newPosHolder(const TokenPos& pos) { return NodeGeneric; }
|
|
|
-@@ -320,18 +322,22 @@ class SyntaxParseHandler
|
|
|
+@@ -323,18 +325,22 @@ class SyntaxParseHandler
|
|
|
}
|
|
|
|
|
|
Node newThrowStatement(Node expr, const TokenPos& pos) { return NodeThrow; }
|
|
@@ -2068,7 +2067,7 @@ diff --git a/js/src/frontend/SyntaxParseHandler.h b/js/src/frontend/SyntaxParseH
|
|
|
MOZ_MUST_USE bool setupCatchScope(Node letBlock, Node catchName, Node catchBody) {
|
|
|
return true;
|
|
|
}
|
|
|
-@@ -416,17 +422,17 @@ class SyntaxParseHandler
|
|
|
+@@ -419,17 +425,17 @@ class SyntaxParseHandler
|
|
|
MOZ_ASSERT(list == NodeGeneric ||
|
|
|
list == NodeUnparenthesizedArray ||
|
|
|
list == NodeUnparenthesizedObject ||
|
|
@@ -2090,7 +2089,7 @@ diff --git a/js/src/frontend/SyntaxParseHandler.h b/js/src/frontend/SyntaxParseH
|
|
|
diff --git a/js/src/wasm/AsmJS.cpp b/js/src/wasm/AsmJS.cpp
|
|
|
--- a/js/src/wasm/AsmJS.cpp
|
|
|
+++ b/js/src/wasm/AsmJS.cpp
|
|
|
-@@ -448,32 +448,31 @@ ListLength(ParseNode* pn)
|
|
|
+@@ -451,32 +451,31 @@ ListLength(ParseNode* pn)
|
|
|
MOZ_ASSERT(pn->isArity(PN_LIST));
|
|
|
return pn->pn_count;
|
|
|
}
|
|
@@ -2126,7 +2125,7 @@ diff --git a/js/src/wasm/AsmJS.cpp b/js/src/wasm/AsmJS.cpp
|
|
|
MOZ_ASSERT(pn->isKind(ParseNodeKind::Var) || pn->isKind(ParseNodeKind::Const));
|
|
|
return ListHead(pn);
|
|
|
}
|
|
|
-@@ -626,26 +625,26 @@ NumberNodeHasFrac(ParseNode* pn)
|
|
|
+@@ -629,26 +628,26 @@ NumberNodeHasFrac(ParseNode* pn)
|
|
|
MOZ_ASSERT(pn->isKind(ParseNodeKind::Number));
|
|
|
return pn->pn_u.number.decimalPoint == HasDecimal;
|
|
|
}
|
|
@@ -2157,7 +2156,7 @@ diff --git a/js/src/wasm/AsmJS.cpp b/js/src/wasm/AsmJS.cpp
|
|
|
MOZ_ASSERT(pn->isKind(ParseNodeKind::Elem));
|
|
|
return BinaryLeft(pn);
|
|
|
}
|
|
|
-@@ -3553,19 +3552,21 @@ IsArrayViewCtorName(ModuleValidator& m,
|
|
|
+@@ -3556,19 +3555,21 @@ IsArrayViewCtorName(ModuleValidator& m,
|
|
|
*type = Scalar::Float64;
|
|
|
} else {
|
|
|
return false;
|
|
@@ -2182,7 +2181,7 @@ diff --git a/js/src/wasm/AsmJS.cpp b/js/src/wasm/AsmJS.cpp
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
-@@ -3576,17 +3577,17 @@ CheckNewArrayView(ModuleValidator& m, Pr
|
|
|
+@@ -3579,17 +3580,17 @@ CheckNewArrayView(ModuleValidator& m, Pr
|
|
|
PropertyName* globalName = m.globalArgumentName();
|
|
|
if (!globalName)
|
|
|
return m.fail(newExpr, "cannot create array view without an asm.js global parameter");
|
|
@@ -2201,7 +2200,7 @@ diff --git a/js/src/wasm/AsmJS.cpp b/js/src/wasm/AsmJS.cpp
|
|
|
|
|
|
if (!IsUseOfName(base, globalName))
|
|
|
return m.failName(base, "expecting '%s.*Array", globalName);
|
|
|
-@@ -3605,17 +3606,17 @@ CheckNewArrayView(ModuleValidator& m, Pr
|
|
|
+@@ -3608,17 +3609,17 @@ CheckNewArrayView(ModuleValidator& m, Pr
|
|
|
|
|
|
if (global->which() != ModuleValidator::Global::ArrayViewCtor)
|
|
|
return m.failName(ctorExpr, "%s must be an imported array view constructor", globalName);
|