Bug 1601599 part 5 - Remove JSOP_LOOPHEAD source notes. r=tcampbell

IonBuilder no longer has to know the loop type.

Depends on D56701

Differential Revision: https://phabricator.services.mozilla.com/D56702

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jan de Mooij 2019-12-15 11:39:53 +00:00
parent 2b6ea9d26a
commit 8e7270c424
10 changed files with 13 additions and 23 deletions

View File

@ -66,8 +66,7 @@ bool LoopControl::emitSpecialBreakForDone(BytecodeEmitter* bce) {
}
bool LoopControl::emitLoopHead(BytecodeEmitter* bce,
const Maybe<uint32_t>& nextPos,
SrcNoteType type) {
const Maybe<uint32_t>& nextPos) {
// Insert a NOP if needed to ensure the script does not start with a
// JSOP_LOOPHEAD. This avoids JIT issues with prologue code + try notes
// or OSR. See bug 1602390 and bug 1602681.
@ -88,9 +87,6 @@ bool LoopControl::emitLoopHead(BytecodeEmitter* bce,
head_ = {bce->bytecodeSection().offset()};
BytecodeOffset off;
if (!bce->newSrcNote(type)) {
return false;
}
if (!bce->emitJumpTargetOp(JSOP_LOOPHEAD, &off)) {
return false;
}

View File

@ -136,8 +136,7 @@ class LoopControl : public BreakableControl {
// corresponds to the next instruction after JSOP_LOOPHEAD.
// Can be Nothing() if not available.
MOZ_MUST_USE bool emitLoopHead(BytecodeEmitter* bce,
const mozilla::Maybe<uint32_t>& nextPos,
SrcNoteType type);
const mozilla::Maybe<uint32_t>& nextPos);
MOZ_MUST_USE bool emitLoopEnd(BytecodeEmitter* bce, JSOp op,
JSTryNoteKind tryNoteKind);

View File

@ -5175,7 +5175,7 @@ bool BytecodeEmitter::emitAsyncIterator() {
bool BytecodeEmitter::emitSpread(bool allowSelfHosted) {
LoopControl loopInfo(this, StatementKind::Spread);
if (!loopInfo.emitLoopHead(this, Nothing(), SRC_FOR_OF)) {
if (!loopInfo.emitLoopHead(this, Nothing())) {
// [stack] NEXT ITER ARR I
return false;
}

View File

@ -67,7 +67,7 @@ bool CForEmitter::emitCond(const Maybe<uint32_t>& condPos) {
}
}
if (!loopInfo_->emitLoopHead(bce_, condPos, SRC_FOR)) {
if (!loopInfo_->emitLoopHead(bce_, condPos)) {
// [stack]
return false;
}

View File

@ -36,7 +36,7 @@ bool DoWhileEmitter::emitBody(const Maybe<uint32_t>& doPos,
loopInfo_.emplace(bce_, StatementKind::DoLoop);
if (!loopInfo_->emitLoopHead(bce_, bodyPos, SRC_DO_WHILE)) {
if (!loopInfo_->emitLoopHead(bce_, bodyPos)) {
return false;
}

View File

@ -43,7 +43,7 @@ bool ForInEmitter::emitInitialize() {
loopInfo_.emplace(bce_, StatementKind::ForInLoop);
if (!loopInfo_->emitLoopHead(bce_, Nothing(), SRC_FOR_IN)) {
if (!loopInfo_->emitLoopHead(bce_, Nothing())) {
// [stack] ITER
return false;
}

View File

@ -70,7 +70,7 @@ bool ForOfEmitter::emitInitialize(const Maybe<uint32_t>& forPos) {
loopInfo_.emplace(bce_, iterDepth, allowSelfHostedIter_, iterKind_);
if (!loopInfo_->emitLoopHead(bce_, Nothing(), SRC_FOR_OF)) {
if (!loopInfo_->emitLoopHead(bce_, Nothing())) {
// [stack] NEXT ITER UNDEF
return false;
}

View File

@ -72,11 +72,6 @@ class SrcNote {
// clang-format off
#define FOR_EACH_SRC_NOTE_TYPE(M) \
M(SRC_NULL, "null", 0) /* Terminates a note vector. */ \
M(SRC_FOR, "for", 0) /* JSOP_LOOPHEAD is for C-style for-loop. */ \
M(SRC_WHILE, "while", 0) /* JSOP_LOOPHEAD is for while loop. */ \
M(SRC_DO_WHILE, "do-while", 0) /* JSOP_LOOPHEAD is for do-while loop. */ \
M(SRC_FOR_IN, "for-in", 0) /* JSOP_LOOPHEAD is for for-in loop. */ \
M(SRC_FOR_OF, "for-of", 0) /* JSOP_LOOPHEAD is for for-of loop. */ \
M(SRC_ASSIGNOP, "assignop", 0) /* += or another assign-op follows. */ \
M(SRC_CLASS_SPAN, "class", 2) /* The starting and ending offsets for the class, used \
for toString correctness for default ctors. */ \
@ -87,6 +82,11 @@ class SrcNote {
M(SRC_SETLINE, "setline", SrcNote::SetLine::Count) \
M(SRC_BREAKPOINT, "breakpoint", 0) /* Bytecode is a recommended breakpoint. */ \
M(SRC_STEP_SEP, "step-sep", 0) /* Bytecode is the first in a new steppable area. */ \
M(SRC_UNUSED9, "unused", 0) \
M(SRC_UNUSED10, "unused", 0) \
M(SRC_UNUSED11, "unused", 0) \
M(SRC_UNUSED12, "unused", 0) \
M(SRC_UNUSED13, "unused", 0) \
M(SRC_UNUSED14, "unused", 0) \
M(SRC_UNUSED15, "unused", 0) \
M(SRC_UNUSED16, "unused", 0) \

View File

@ -42,7 +42,7 @@ bool WhileEmitter::emitCond(const Maybe<uint32_t>& whilePos,
loopInfo_.emplace(bce_, StatementKind::WhileLoop);
if (!loopInfo_->emitLoopHead(bce_, condPos, SRC_WHILE)) {
if (!loopInfo_->emitLoopHead(bce_, condPos)) {
return false;
}

View File

@ -3052,11 +3052,6 @@ static MOZ_MUST_USE bool SrcNotes(JSContext* cx, HandleScript script,
case SRC_BREAKPOINT:
case SRC_STEP_SEP:
case SRC_XDELTA:
case SRC_FOR:
case SRC_DO_WHILE:
case SRC_WHILE:
case SRC_FOR_IN:
case SRC_FOR_OF:
break;
case SRC_COLSPAN: