summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/src/frontend/BytecodeEmitter.cpp8
-rw-r--r--js/src/frontend/SourceNotes.h2
-rw-r--r--js/src/jit/IonBuilder.cpp6
3 files changed, 15 insertions, 1 deletions
diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp
index 0c6b1c9263..b5a96f32d9 100644
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -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;
diff --git a/js/src/frontend/SourceNotes.h b/js/src/frontend/SourceNotes.h
index 3d2a1bc1f7..3951f55649 100644
--- a/js/src/frontend/SourceNotes.h
+++ b/js/src/frontend/SourceNotes.h
@@ -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. */
diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp
index dae86fd92a..dbecec2a7e 100644
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -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");