diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp index f192220e30..5699c74603 100644 --- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -9644,126 +9644,6 @@ BytecodeEmitter::emitCalleeAndThis( return true; } -// NOTE: Equivalent to CallOrNewEmitter::emitThis -bool -BytecodeEmitter::emitCallOrNewThis( - ParseNode* callNode, - bool isCall) -{ - // Emit room for |this|. - if (!isCall) { - JSOp opForEmit; - if (IsNewOp(callNode->getOp())) { - opForEmit = JSOP_IS_CONSTRUCTING; - } else { - opForEmit = JSOP_UNDEFINED; - } - if (!emit1(opForEmit)) { - return false; - } - } - - return true; -} - -// NOTE: The following function is equivalent to CallOrNewEmitter::emitEnd -// and BytecodeEmitter::emitArguments in a future refactor -bool -BytecodeEmitter::emitCallOrNewArgumentsAndEnd( - ParseNode* callNode, - ParseNode* calleeNode, - bool isCall, - ValueUsage valueUsage) -{ - uint32_t argumentCount = callNode->pn_count - 1; - if (argumentCount >= ARGC_LIMIT) { - parser->tokenStream.reportError(isCall - ? JSMSG_TOO_MANY_FUN_ARGS - : JSMSG_TOO_MANY_CON_ARGS); - return false; - } - - JSOp op = callNode->getOp(); - bool isSpread = IsSpreadOp(op); - - /* - * Emit code for each argument in order, then emit the JSOP_*CALL or - * JSOP_NEW bytecode with a two-byte immediate telling how many args - * were pushed on the operand stack. - */ - ParseNode* argumentNode = calleeNode->pn_next; - if (!isSpread) { - while (argumentNode) { - if (!emitTree(argumentNode)) { - return false; - } - argumentNode = argumentNode->pn_next; - } - } else { - JumpList jmp; - bool optCodeEmitted = false; - if (argumentCount == 1) { - if (!emitOptimizeSpread(argumentNode->pn_kid, &jmp, - &optCodeEmitted)) { - return false; - } - } - - if (!emitArray(argumentNode, argumentCount, JSOP_SPREADCALLARRAY)) { - return false; - } - - if (optCodeEmitted) { - if (!emitJumpTargetAndPatch(jmp)) { - return false; - } - } - } - - if (IsNewOp(op)) { - if (callNode->isKind(PNK_SUPERCALL)) { - if (!emit1(JSOP_NEWTARGET)) { - return false; - } - } else { - // Repush the callee as new.target - uint32_t finalArgumentCount = argumentCount + 1; - if (isSpread) { - finalArgumentCount = 2; - } - if (!emitDupAt(finalArgumentCount)) { - return false; - } - } - } - - if (!isSpread) { - JSOp callOp = op; - if (callOp == JSOP_CALL && valueUsage == ValueUsage::IgnoreValue) { - callOp = JSOP_CALL_IGNORES_RV; - } - if (!emitCall(callOp, argumentCount, callNode)) { - return false; - } - checkTypeSet(callOp); - } else { - if (!emit1(op)) { - return false; - } - checkTypeSet(op); - } - - if (IsEvalOp(op)) { - uint32_t lineNum = - parser->tokenStream.srcCoords.lineNum(callNode->pn_pos.begin); - if (!emitUint32Operand(JSOP_LINENO, lineNum)) { - return false; - } - } - - return true; -} - bool BytecodeEmitter::emitRightAssociative(ParseNode* pn) { diff --git a/js/src/frontend/BytecodeEmitter.h b/js/src/frontend/BytecodeEmitter.h index 956ade1545..47400658dc 100644 --- a/js/src/frontend/BytecodeEmitter.h +++ b/js/src/frontend/BytecodeEmitter.h @@ -766,12 +766,6 @@ struct MOZ_STACK_CLASS BytecodeEmitter ParseNode* calleeNode, CallOrNewEmitter& cone, OptionalEmitter& oe); - MOZ_MUST_USE bool emitCallOrNewThis(ParseNode* callNode, - bool isCall); - MOZ_MUST_USE bool emitCallOrNewArgumentsAndEnd(ParseNode* callNode, - ParseNode* calleeNode, - bool isCall, - ValueUsage valueUsage); MOZ_MUST_USE bool emitSelfHostedCallFunction(ParseNode* pn); MOZ_MUST_USE bool emitSelfHostedResumeGenerator(ParseNode* pn);