mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 07:48:38 +09:00
Issue #1658 - Part 6: Break and return no control flow for jumps emitted by optional chains under IonBuilder
IIUC, we want to process the GOTO in the case of optional chains, and we do not satisfy the requirements mentioned in the comment of snoopControlFlow's caller. Optional chains are not loops, we (probably) don't have a loop in the instruction following the GOTO, and in the GOTO destination, we're either returning an undefined/null value or the actual value.
This commit is contained in:
parent
4c35296690
commit
cb9809634a
3 changed files with 15 additions and 1 deletions
|
|
@ -12172,6 +12172,10 @@ OptionalEmitter::emitJumpShortCircuit() {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!bce_->newSrcNote(SRC_OPTCHAIN)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!bce_->emitJump(JSOP_GOTO, &jumpShortCircuit_)) {
|
||||
// [stack] UNDEFINED-OR-NULL
|
||||
return false;
|
||||
|
|
@ -12218,6 +12222,10 @@ OptionalEmitter::emitJumpShortCircuitForCall() {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!bce_->newSrcNote(SRC_OPTCHAIN)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!bce_->emitJump(JSOP_GOTO, &jumpShortCircuit_)) {
|
||||
// [stack] UNDEFINED-OR-NULL
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ namespace js {
|
|||
M(SRC_BREAK, "break", 0) /* JSOP_GOTO is a break. */ \
|
||||
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_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. */ \
|
||||
|
|
@ -63,7 +64,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_UNUSED21, "unused21", 0) /* Unused. */ \
|
||||
M(SRC_UNUSED22, "unused22", 0) /* Unused. */ \
|
||||
M(SRC_UNUSED23, "unused23", 0) /* Unused. */ \
|
||||
M(SRC_XDELTA, "xdelta", 0) /* 24-31 are for extended delta notes. */
|
||||
|
|
|
|||
|
|
@ -1649,6 +1649,12 @@ IonBuilder::snoopControlFlow(JSOp op)
|
|||
// while (cond) { }
|
||||
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.
|
||||
break;
|
||||
|
||||
default:
|
||||
// Hard assert for now - make an error later.
|
||||
MOZ_CRASH("unknown goto case");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue