Issue #2097 - Handle Logical Assignment in Ion CFG

This commit is contained in:
Martok 2023-05-01 16:17:20 +02:00 committed by roytam1
commit a7d8cecdb9
3 changed files with 9 additions and 4 deletions

View file

@ -4169,6 +4169,10 @@ BytecodeEmitter::emitShortCircuitAssignment(ParseNodeKind kind, JSOp op,
// Join with the short-circuit jump and pop anything left on the stack.
if (numPushed > 0) {
if (!newSrcNote(SRC_LOGICASSIGN)) {
return false;
}
JumpList jumpAroundPop;
if (!emitJump(JSOP_GOTO, &jumpAroundPop)) {
// [stack] RHS

View file

@ -50,6 +50,7 @@ namespace js {
M(SRC_BREAK2LABEL, "break2label", 0) /* JSOP_GOTO for 'break label'. */ \
M(SRC_SWITCHBREAK, "switchbreak", 0) /* JSOP_GOTO is a break in a switch. */ \
M(SRC_OPTCHAIN, "optchain", 0) /* JSOP_GOTO for optional chains. */ \
M(SRC_LOGICASSIGN, "logicassign", 0) /* JSOP_GOTO for logical assignment. */ \
M(SRC_TABLESWITCH, "tableswitch", 1) /* JSOP_TABLESWITCH; offset points to end of switch. */ \
M(SRC_CONDSWITCH, "condswitch", 2) /* JSOP_CONDSWITCH; 1st offset points to end of switch, \
2nd points to first JSOP_CASE. */ \
@ -64,7 +65,6 @@ namespace js {
M(SRC_COLSPAN, "colspan", 1) /* Number of columns this opcode spans. */ \
M(SRC_NEWLINE, "newline", 0) /* Bytecode follows a source newline. */ \
M(SRC_SETLINE, "setline", 1) /* A file-absolute source line number note. */ \
M(SRC_UNUSED22, "unused22", 0) /* Unused. */ \
M(SRC_UNUSED23, "unused23", 0) /* Unused. */ \
M(SRC_XDELTA, "xdelta", 0) /* 24-31 are for extended delta notes. */

View file

@ -1651,9 +1651,10 @@ IonBuilder::snoopControlFlow(JSOp op)
return whileOrForInLoop(sn);
case SRC_OPTCHAIN:
// XXX Instead of aborting early, breaking at this point works.
// However, I'm not sure if we still need to further process
// optional chains under IonBuilder.
case SRC_LOGICASSIGN:
// These notes exist only for the benefit of CFG (ie. this function) and
// don't need any special handling. The associated GOTOs are all simple
// unconditional near jumps, not loops etc.
break;
default: