Issue #2173 - Remove unused case/code from function node ops

CodeNodes only ever use 3 JSOPs at this point in time.

Based-on: 1518391/1
This commit is contained in:
Martok 2023-04-02 15:41:51 +02:00 • committed by roytam1
commit f21340f1a8
2 changed files with 5 additions and 13 deletions

View file

@ -5755,15 +5755,11 @@ BytecodeEmitter::emitFunction(CodeNode* funNode, bool needsProto)
if (needsProto) {
MOZ_ASSERT(funNode->getOp() == JSOP_LAMBDA);
funNode->setOp(JSOP_FUNWITHPROTO);
}
if (funNode->getOp() == JSOP_DEFFUN) {
if (!emitIndex32(JSOP_LAMBDA, index))
return false;
return emit1(JSOP_DEFFUN);
return emitIndex32(JSOP_FUNWITHPROTO, index);
}
// This is a FunctionExpression, ArrowFunctionExpression, or class
// constructor. Emit the single instruction (without location info).
return emitIndex32(funNode->getOp(), index);
}

View file

@ -1468,12 +1468,8 @@ class CodeNode : public ParseNode
MOZ_ASSERT(isKind(PNK_FUNCTION));
MOZ_ASSERT(isOp(JSOP_LAMBDA) || // lambda
isOp(JSOP_LAMBDA_ARROW) || // arrow function
isOp(JSOP_DEFFUN) || // non-body-level function statement
isOp(JSOP_NOP) || // body-level function stmt in global code
isOp(JSOP_GETLOCAL) || // body-level function stmt in function code
isOp(JSOP_GETARG) || // body-level function redeclaring formal
isOp(JSOP_INITLEXICAL)); // block-level function stmt
return !isOp(JSOP_LAMBDA) && !isOp(JSOP_LAMBDA_ARROW) && !isOp(JSOP_DEFFUN);
isOp(JSOP_NOP)); // body-level function stmt in global code
return isOp(JSOP_NOP);
}
};