Commit 3ef732aa authored by Jan de Mooij's avatar Jan de Mooij
Browse files

Bug 1598548 part 11 - Remove source note offset for loop backjump. r=arai,tcampbell

For now we still need the source note itself to determine the
stackPhiCount in IonBuilder. Hopefully we can fix that later.

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

--HG--
extra : moz-landing-system : lando
parent 0ac3a6e8
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -140,11 +140,6 @@ class LoopControl : public BreakableControl {
  BytecodeOffset breakTargetOffset() const { return breakTarget_.offset; }
  BytecodeOffset continueTargetOffset() const { return continueTarget_.offset; }

  // The offset of the backward jump at the loop end from the JSOP_LOOPHEAD.
  BytecodeOffsetDiff loopEndOffsetFromLoopHead() const {
    return loopEndOffset_ - head_.offset;
  }

  MOZ_MUST_USE bool emitContinueTarget(BytecodeEmitter* bce);

  // Emit a jump to break target from the top level of the loop.
+1 −11
Original line number Diff line number Diff line
@@ -5178,11 +5178,7 @@ bool BytecodeEmitter::emitAsyncIterator() {
bool BytecodeEmitter::emitSpread(bool allowSelfHosted) {
  LoopControl loopInfo(this, StatementKind::Spread);

  // Jump down to the loop condition to minimize overhead assuming at least
  // one iteration, as the other loop forms do.  Annotate so IonMonkey can
  // find the loop-closing jump.
  unsigned noteIndex;
  if (!newSrcNote(SRC_FOR_OF, &noteIndex)) {
  if (!newSrcNote(SRC_FOR_OF)) {
    return false;
  }

@@ -5243,12 +5239,6 @@ bool BytecodeEmitter::emitSpread(bool allowSelfHosted) {
  // manually.
  bytecodeSection().setStackDepth(bytecodeSection().stackDepth() + 1);

  // Let Ion know where the closing jump of this loop is.
  if (!setSrcNoteOffset(noteIndex, SrcNote::Loop::BackJumpOffset,
                        loopInfo.loopEndOffsetFromLoopHead())) {
    return false;
  }

  // No continues should occur in spreads.
  MOZ_ASSERT(!loopInfo.continues.offset.valid());

+1 −9
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ bool CForEmitter::emitCond(const Maybe<uint32_t>& condPos) {
    }
  }

  if (!bce_->newSrcNote(SRC_FOR, &noteIndex_)) {
  if (!bce_->newSrcNote(SRC_FOR)) {
    return false;
  }

@@ -175,14 +175,6 @@ bool CForEmitter::emitEnd(const Maybe<uint32_t>& forPos) {
    return false;
  }

  // The note offset helps us find the loop-closing jump.
  if (!bce_->setSrcNoteOffset(noteIndex_, SrcNote::Loop::BackJumpOffset,
                              loopInfo_->loopEndOffsetFromLoopHead()))

  {
    return false;
  }

  if (!bce_->addTryNote(JSTRY_LOOP, bce_->bytecodeSection().stackDepth(),
                        loopInfo_->headOffset(),
                        loopInfo_->breakTargetOffset())) {
+0 −3
Original line number Diff line number Diff line
@@ -79,9 +79,6 @@ class MOZ_STACK_CLASS CForEmitter {
 private:
  BytecodeEmitter* bce_;

  // The source note index for SRC_FOR.
  unsigned noteIndex_ = 0;

  // Whether the c-style for loop has `cond` and `update`.
  Cond cond_ = Cond::Missing;
  Update update_ = Update::Missing;
+1 −8
Original line number Diff line number Diff line
@@ -34,8 +34,7 @@ bool DoWhileEmitter::emitBody(const Maybe<uint32_t>& doPos,
    return false;
  }

  // Emit an annotated nop so IonBuilder can recognize the 'do' loop.
  if (!bce_->newSrcNote(SRC_DO_WHILE, &noteIndex_)) {
  if (!bce_->newSrcNote(SRC_DO_WHILE)) {
    return false;
  }

@@ -77,12 +76,6 @@ bool DoWhileEmitter::emitEnd() {
    return false;
  }

  // Update the annotation with the back edge position, for IonBuilder.
  if (!bce_->setSrcNoteOffset(noteIndex_, SrcNote::Loop::BackJumpOffset,
                              loopInfo_->loopEndOffsetFromLoopHead())) {
    return false;
  }

  if (!loopInfo_->patchBreaksAndContinues(bce_)) {
    return false;
  }
Loading