mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 1130811 - Handle pushing assignment and compound assignment nodes by kind when recycling. r=shu
--HG-- extra : rebase_source : b3490367763e6164ea01550fc1f4f9e80795b652
This commit is contained in:
parent
9346358f90
commit
de7258d766
@ -202,6 +202,17 @@ PushUnaryNodeNullableChild(ParseNode *node, NodeStack *stack)
|
||||
|
||||
static PushResult
|
||||
PushBinaryNodeChildren(ParseNode *node, NodeStack *stack)
|
||||
{
|
||||
MOZ_ASSERT(node->isArity(PN_BINARY));
|
||||
|
||||
stack->push(node->pn_left);
|
||||
stack->push(node->pn_right);
|
||||
|
||||
return PushResult::Recyclable;
|
||||
}
|
||||
|
||||
static PushResult
|
||||
PushBinaryNodeNullableChildren(ParseNode *node, NodeStack *stack)
|
||||
{
|
||||
MOZ_ASSERT(node->isArity(PN_BINARY) || node->isArity(PN_BINARY_OBJ));
|
||||
|
||||
@ -279,6 +290,21 @@ PushNodeChildren(ParseNode *pn, NodeStack *stack)
|
||||
case PNK_EXPORT:
|
||||
return PushUnaryNodeChild(pn, stack);
|
||||
|
||||
// Assignment nodes are binary with two non-null children.
|
||||
case PNK_ASSIGN:
|
||||
case PNK_ADDASSIGN:
|
||||
case PNK_SUBASSIGN:
|
||||
case PNK_BITORASSIGN:
|
||||
case PNK_BITXORASSIGN:
|
||||
case PNK_BITANDASSIGN:
|
||||
case PNK_LSHASSIGN:
|
||||
case PNK_RSHASSIGN:
|
||||
case PNK_URSHASSIGN:
|
||||
case PNK_MULASSIGN:
|
||||
case PNK_DIVASSIGN:
|
||||
case PNK_MODASSIGN:
|
||||
return PushBinaryNodeChildren(pn, stack);
|
||||
|
||||
// List nodes with all non-null children.
|
||||
case PNK_OR:
|
||||
case PNK_AND:
|
||||
@ -357,21 +383,6 @@ PushNodeChildren(ParseNode *pn, NodeStack *stack)
|
||||
case PNK_FOROF:
|
||||
case PNK_FORHEAD:
|
||||
case PNK_ARGSBODY:
|
||||
|
||||
/* Assignment operators (= += -= etc.). */
|
||||
/* ParseNode::isAssignment assumes all these are consecutive. */
|
||||
case PNK_ASSIGN:
|
||||
case PNK_ADDASSIGN:
|
||||
case PNK_SUBASSIGN:
|
||||
case PNK_BITORASSIGN:
|
||||
case PNK_BITXORASSIGN:
|
||||
case PNK_BITANDASSIGN:
|
||||
case PNK_LSHASSIGN:
|
||||
case PNK_RSHASSIGN:
|
||||
case PNK_URSHASSIGN:
|
||||
case PNK_MULASSIGN:
|
||||
case PNK_DIVASSIGN:
|
||||
case PNK_MODASSIGN:
|
||||
break; // for now
|
||||
|
||||
case PNK_LIMIT: // invalid sentinel value
|
||||
@ -394,7 +405,7 @@ PushNodeChildren(ParseNode *pn, NodeStack *stack)
|
||||
|
||||
case PN_BINARY:
|
||||
case PN_BINARY_OBJ:
|
||||
return PushBinaryNodeChildren(pn, stack);
|
||||
return PushBinaryNodeNullableChildren(pn, stack);
|
||||
|
||||
case PN_UNARY:
|
||||
return PushUnaryNodeNullableChild(pn, stack);
|
||||
|
Loading…
Reference in New Issue
Block a user