summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorMartok <martok@martoks-place.de>2023-05-01 16:17:20 +0200
committerMartok <martok@martoks-place.de>2023-05-01 17:16:22 +0200
commit63a00fdd250f1cc592f6eec937adf22a8e856f00 (patch)
treed080dff5b04b8a6d3fc95e65fd639d1648b476d9 /js
parent3d38507c23f3dc7b0cb8b69d54d41752fb8be08c (diff)
downloaduxp-63a00fdd250f1cc592f6eec937adf22a8e856f00.tar.gz
Issue #2097 - Handle Logical Assignment in Ion CFG
Diffstat (limited to 'js')
-rw-r--r--js/src/frontend/BytecodeEmitter.cpp4
-rw-r--r--js/src/frontend/SourceNotes.h2
-rw-r--r--js/src/jit/IonBuilder.cpp7
3 files changed, 9 insertions, 4 deletions
diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp
index 1e6390f5f1..e5a47c496a 100644
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -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
diff --git a/js/src/frontend/SourceNotes.h b/js/src/frontend/SourceNotes.h
index 3951f55649..5490957cae 100644
--- a/js/src/frontend/SourceNotes.h
+++ b/js/src/frontend/SourceNotes.h
@@ -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. */
diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp
index a6dcdf001a..0a9734a335 100644
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -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: