Skip to content

Commit

Permalink
Bug 1760989 part 7 - Remove JSOp::FunCall. r=iain
Browse files Browse the repository at this point in the history
  • Loading branch information
jandem committed Mar 24, 2022
1 parent ec73b64 commit 2e321d0
Show file tree
Hide file tree
Showing 14 changed files with 11 additions and 41 deletions.
1 change: 0 additions & 1 deletion js/src/debugger/Script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1484,7 +1484,6 @@ static bool BytecodeIsEffectful(JSOp op) {
case JSOp::InitHiddenElemGetter:
case JSOp::InitElemSetter:
case JSOp::InitHiddenElemSetter:
case JSOp::FunCall:
case JSOp::SpreadCall:
case JSOp::Call:
case JSOp::CallIgnoresRv:
Expand Down
2 changes: 1 addition & 1 deletion js/src/frontend/BytecodeEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8070,7 +8070,7 @@ ParseNode* BytecodeEmitter::getCoordNode(ParseNode* callNode,
ParseNode* calleeNode, JSOp op,
ListNode* argsList) {
ParseNode* coordNode = callNode;
if (op == JSOp::Call || op == JSOp::SpreadCall || op == JSOp::FunCall) {
if (op == JSOp::Call || op == JSOp::SpreadCall) {
// Default to using the location of the `(` itself.
// obj[expr]() // expression
// ^ // column coord
Expand Down
4 changes: 1 addition & 3 deletions js/src/frontend/CallOrNewEmitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class MOZ_STACK_CLASS CallOrNewEmitter {
private:
[[nodiscard]] bool isCall() const {
return op_ == JSOp::Call || op_ == JSOp::CallIgnoresRv ||
op_ == JSOp::SpreadCall || isEval() || isFunCall();
op_ == JSOp::SpreadCall || isEval();
}

[[nodiscard]] bool isNew() const {
Expand All @@ -296,8 +296,6 @@ class MOZ_STACK_CLASS CallOrNewEmitter {
op_ == JSOp::SpreadEval || op_ == JSOp::StrictSpreadEval;
}

[[nodiscard]] bool isFunCall() const { return op_ == JSOp::FunCall; }

[[nodiscard]] bool isSpread() const { return IsSpreadOp(op_); }

[[nodiscard]] bool isSingleSpread() const {
Expand Down
8 changes: 1 addition & 7 deletions js/src/frontend/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10730,13 +10730,7 @@ typename ParseHandler::Node GeneralParser<ParseHandler, Unit>::memberCall(

JSOp op = JSOp::Call;
bool maybeAsyncArrow = false;
if (auto prop = handler_.maybeDottedProperty(lhs)) {
// Use the JSOp::FunCall optimizations given the right syntax.
if (prop == TaggedParserAtomIndex::WellKnown::call()) {
op = JSOp::FunCall;
}
} else if (tt == TokenKind::LeftParen &&
optionalKind == OptionalKind::NonOptional) {
if (tt == TokenKind::LeftParen && optionalKind == OptionalKind::NonOptional) {
if (handler_.isAsyncKeyword(lhs)) {
// |async (| can be the start of an async arrow
// function, so we need to defer reporting possible
Expand Down
5 changes: 0 additions & 5 deletions js/src/jit/BaselineCodeGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4494,11 +4494,6 @@ bool BaselineCodeGen<Handler>::emit_SuperCall() {
return emitCall(JSOp::SuperCall);
}

template <typename Handler>
bool BaselineCodeGen<Handler>::emit_FunCall() {
return emitCall(JSOp::FunCall);
}

template <typename Handler>
bool BaselineCodeGen<Handler>::emit_Eval() {
return emitCall(JSOp::Eval);
Expand Down
5 changes: 2 additions & 3 deletions js/src/jit/BaselineIC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ class MOZ_STATIC_CLASS OpToFallbackKindTable {
setKind(JSOp::Call, BaselineICFallbackKind::Call);
setKind(JSOp::CallIgnoresRv, BaselineICFallbackKind::Call);
setKind(JSOp::CallIter, BaselineICFallbackKind::Call);
setKind(JSOp::FunCall, BaselineICFallbackKind::Call);
setKind(JSOp::Eval, BaselineICFallbackKind::Call);
setKind(JSOp::StrictEval, BaselineICFallbackKind::Call);

Expand Down Expand Up @@ -1582,8 +1581,8 @@ bool DoCallFallback(JSContext* cx, BaselineFrame* frame, ICFallbackStub* stub,
}
} else {
MOZ_ASSERT(op == JSOp::Call || op == JSOp::CallIgnoresRv ||
op == JSOp::CallIter || op == JSOp::FunCall ||
op == JSOp::Eval || op == JSOp::StrictEval);
op == JSOp::CallIter || op == JSOp::Eval ||
op == JSOp::StrictEval);
if (op == JSOp::CallIter && callee.isPrimitive()) {
MOZ_ASSERT(argc == 0, "thisv must be on top of the stack");
ReportValueError(cx, JSMSG_NOT_ITERABLE, -1, callArgs.thisv(), nullptr);
Expand Down
3 changes: 1 addition & 2 deletions js/src/jit/CacheIR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9843,7 +9843,6 @@ AttachDecision CallIRGenerator::tryAttachStub() {
case JSOp::SpreadNew:
case JSOp::SuperCall:
case JSOp::SpreadSuperCall:
case JSOp::FunCall:
break;
default:
return AttachDecision::NoAction;
Expand Down Expand Up @@ -9874,7 +9873,7 @@ AttachDecision CallIRGenerator::tryAttachStub() {
// Try inlining Function.prototype.{call,apply}. We don't use the
// InlinableNative mechanism for this because we want to optimize these more
// aggressively than other natives.
if (op_ == JSOp::FunCall || op_ == JSOp::Call || op_ == JSOp::CallIgnoresRv) {
if (op_ == JSOp::Call || op_ == JSOp::CallIgnoresRv) {
TRY_ATTACH(tryAttachFunCall(calleeFunc));
TRY_ATTACH(tryAttachFunApply(calleeFunc));
}
Expand Down
2 changes: 0 additions & 2 deletions js/src/jit/TrialInlining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ static uint32_t GetMaxCalleeNumActuals(BytecodeLocation loc) {
// Setters pass 1 argument.
return 1;

case JSOp::FunCall:
case JSOp::Call:
case JSOp::CallIgnoresRv:
case JSOp::CallIter:
Expand Down Expand Up @@ -744,7 +743,6 @@ bool TrialInliner::tryInlining() {
case JSOp::Call:
case JSOp::CallIgnoresRv:
case JSOp::CallIter:
case JSOp::FunCall:
case JSOp::New:
case JSOp::SuperCall:
if (!maybeInlineCall(entry, fallback, loc)) {
Expand Down
4 changes: 0 additions & 4 deletions js/src/jit/WarpBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1871,10 +1871,6 @@ bool WarpBuilder::build_CallIter(BytecodeLocation loc) {
return buildCallOp(loc);
}

bool WarpBuilder::build_FunCall(BytecodeLocation loc) {
return buildCallOp(loc);
}

bool WarpBuilder::build_New(BytecodeLocation loc) { return buildCallOp(loc); }

bool WarpBuilder::build_SuperCall(BytecodeLocation loc) {
Expand Down
1 change: 0 additions & 1 deletion js/src/jit/WarpOracle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,6 @@ AbortReasonOr<WarpScriptSnapshot*> WarpScriptOracle::createScriptSnapshot() {
case JSOp::Call:
case JSOp::CallIgnoresRv:
case JSOp::CallIter:
case JSOp::FunCall:
case JSOp::New:
case JSOp::SuperCall:
case JSOp::SpreadCall:
Expand Down
3 changes: 1 addition & 2 deletions js/src/vm/BytecodeUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1965,8 +1965,7 @@ bool ExpressionDecompiler::decompilePC(jsbytecode* pc, uint8_t defIndex) {
return write("new.target");
case JSOp::Call:
case JSOp::CallIgnoresRv:
case JSOp::CallIter:
case JSOp::FunCall: {
case JSOp::CallIter: {
uint16_t argc = GET_ARGC(pc);
return decompilePCForStackOperand(pc, -int32_t(argc + 2)) &&
write(argc ? "(...)" : "()");
Expand Down
2 changes: 1 addition & 1 deletion js/src/vm/BytecodeUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ MOZ_ALWAYS_INLINE unsigned StackUses(jsbytecode* pc) {
/* stack: fun, this, [argc arguments] */
MOZ_ASSERT(op == JSOp::Call || op == JSOp::CallIgnoresRv ||
op == JSOp::Eval || op == JSOp::CallIter ||
op == JSOp::StrictEval || op == JSOp::FunCall);
op == JSOp::StrictEval);
return 2 + GET_ARGC(pc);
}
}
Expand Down
5 changes: 1 addition & 4 deletions js/src/vm/Interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3255,8 +3255,7 @@ static MOZ_NEVER_INLINE JS_HAZ_JSNATIVE_CALLER bool Interpret(JSContext* cx,
CASE(Call)
CASE(CallIgnoresRv)
CASE(CallIter)
CASE(SuperCall)
CASE(FunCall) {
CASE(SuperCall) {
static_assert(JSOpLength_Call == JSOpLength_New,
"call and new must be the same size");
static_assert(JSOpLength_Call == JSOpLength_CallIgnoresRv,
Expand All @@ -3265,8 +3264,6 @@ static MOZ_NEVER_INLINE JS_HAZ_JSNATIVE_CALLER bool Interpret(JSContext* cx,
"call and calliter must be the same size");
static_assert(JSOpLength_Call == JSOpLength_SuperCall,
"call and supercall must be the same size");
static_assert(JSOpLength_Call == JSOpLength_FunCall,
"call and funcall must be the same size");

if (REGS.fp()->hasPushedGeckoProfilerFrame()) {
cx->geckoProfiler().updatePC(cx, script, REGS.pc);
Expand Down
7 changes: 2 additions & 5 deletions js/src/vm/Opcodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1739,9 +1739,6 @@
* iterable") rather than `JSMSG_NOT_FUNCTION` ("x[Symbol.iterator] is not
* a function"). The `argc` operand must be 0 for this variation.
*
* `JSOp::FunCall` hints to the VM that the callee is likely
* `Function.prototype.call`.
*
* `JSOp::CallIgnoresRv` hints to the VM that the return value is ignored.
* This allows alternate faster implementations to be used that avoid
* unnecesary allocations.
Expand All @@ -1757,7 +1754,6 @@
*/ \
MACRO(Call, call, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_IC) \
MACRO(CallIter, call_iter, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_IC) \
MACRO(FunCall, fun_call, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_IC) \
MACRO(CallIgnoresRv, call_ignores_rv, NULL, 3, -1, 1, JOF_ARGC|JOF_INVOKE|JOF_IC) \
/*
* Like `JSOp::Call`, but the arguments are provided in an array rather than
Expand Down Expand Up @@ -3541,13 +3537,14 @@
* a power of two. Use this macro to do so.
*/
#define FOR_EACH_TRAILING_UNUSED_OPCODE(MACRO) \
IF_RECORD_TUPLE(/* empty */, MACRO(225)) \
IF_RECORD_TUPLE(/* empty */, MACRO(226)) \
IF_RECORD_TUPLE(/* empty */, MACRO(227)) \
IF_RECORD_TUPLE(/* empty */, MACRO(228)) \
IF_RECORD_TUPLE(/* empty */, MACRO(229)) \
IF_RECORD_TUPLE(/* empty */, MACRO(230)) \
IF_RECORD_TUPLE(/* empty */, MACRO(231)) \
IF_RECORD_TUPLE(/* empty */, MACRO(232)) \
MACRO(232) \
MACRO(233) \
MACRO(234) \
MACRO(235) \
Expand Down

0 comments on commit 2e321d0

Please sign in to comment.