From a2277a622365e7fe4b65fced723626b52809fe69 Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Tue, 10 Feb 2015 17:18:43 -0800 Subject: [PATCH] Bug 1130811 - Convert the last ParseNode recycling arity-check to deal *only* with PNK_NAME to give the right impression about what should be done. Fixing PNK_NAME to deal with multiple arities looks to be moderately tricky for various reasons, so punt on it for now until those other reasons are cleaned up. r=shu --HG-- extra : rebase_source : ee5d8e2e76dc8b1162cd7ba7ddf8b8321ec8d33a --- js/src/frontend/ParseNode.cpp | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/js/src/frontend/ParseNode.cpp b/js/src/frontend/ParseNode.cpp index 77c427817f3f..e622a54dfc17 100644 --- a/js/src/frontend/ParseNode.cpp +++ b/js/src/frontend/ParseNode.cpp @@ -534,34 +534,13 @@ PushNodeChildren(ParseNode *pn, NodeStack *stack) MOZ_CRASH("invalid node kind"); } - // Fallthrough for not-yet-handled kinds. - switch (pn->getArity()) { - case PN_CODE: - return PushCodeNodeChildren(pn, stack); + MOZ_ASSERT(pn->isKind(PNK_NAME), "missed a kind above"); - case PN_NAME: - return PushNameNodeChildren(pn, stack); + MOZ_ASSERT(pn->isArity(PN_NAME) || pn->isArity(PN_NULLARY)); - case PN_LIST: - return PushListNodeChildren(pn, stack); - - case PN_TERNARY: - return PushTernaryNodeNullableChildren(pn, stack); - - case PN_BINARY: - case PN_BINARY_OBJ: - return PushBinaryNodeNullableChildren(pn, stack); - - case PN_UNARY: - return PushUnaryNodeNullableChild(pn, stack); - - case PN_NULLARY: - return CanRecycleNullaryNode(pn, stack); - - default: - MOZ_CRASH("huh?"); - return PushResult::CleanUpLater; - } + return pn->isArity(PN_NAME) + ? PushNameNodeChildren(pn, stack) + : CanRecycleNullaryNode(pn, stack); } /*