From 369d0d0f4163376fc22c1ec4d41e101a8a0432b2 Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Thu, 21 Nov 2019 12:59:19 +0000 Subject: [PATCH] Bug 1597943 part 2 - Remove For::UpdateOffset and DoWhile::CondOffset source notes. r=arai Depends on D54087 Differential Revision: https://phabricator.services.mozilla.com/D54088 --HG-- extra : moz-landing-system : lando --- js/src/frontend/BytecodeControlStructures.h | 6 ------ js/src/frontend/CForEmitter.cpp | 4 ---- js/src/frontend/DoWhileEmitter.cpp | 9 ++------- js/src/frontend/SourceNotes.h | 6 ------ js/src/shell/js.cpp | 11 ++++------- 5 files changed, 6 insertions(+), 30 deletions(-) diff --git a/js/src/frontend/BytecodeControlStructures.h b/js/src/frontend/BytecodeControlStructures.h index 4c6c66dc29f0..478f37a1fa4f 100644 --- a/js/src/frontend/BytecodeControlStructures.h +++ b/js/src/frontend/BytecodeControlStructures.h @@ -163,12 +163,6 @@ class LoopControl : public BreakableControl { return loopEndOffset_ - head_.offset; } - // The offset of the continue target from the loop's top, in case there was - // no entry jump. - BytecodeOffsetDiff continueTargetOffsetFromLoopHead() const { - return continueTarget_.offset - head_.offset; - } - // A continue target can be specified by the following 2 ways: // * Use the existing JUMPTARGET by calling `setContinueTarget` with // the offset of the JUMPTARGET diff --git a/js/src/frontend/CForEmitter.cpp b/js/src/frontend/CForEmitter.cpp index 017c75649000..e5b4178d478c 100644 --- a/js/src/frontend/CForEmitter.cpp +++ b/js/src/frontend/CForEmitter.cpp @@ -209,10 +209,6 @@ bool CForEmitter::emitEnd() { condOffset_ - biasedTop_)) { return false; } - if (!bce_->setSrcNoteOffset(noteIndex_, SrcNote::For::UpdateOffset, - loopInfo_->continueTargetOffset() - biasedTop_)) { - return false; - } // If no loop condition, just emit a loop-closing jump. if (!loopInfo_->emitLoopEnd(bce_, diff --git a/js/src/frontend/DoWhileEmitter.cpp b/js/src/frontend/DoWhileEmitter.cpp index 35d86b312f4d..3a934b013ff3 100644 --- a/js/src/frontend/DoWhileEmitter.cpp +++ b/js/src/frontend/DoWhileEmitter.cpp @@ -35,7 +35,7 @@ bool DoWhileEmitter::emitBody(const Maybe& doPos, } // Emit an annotated nop so IonBuilder can recognize the 'do' loop. - if (!bce_->newSrcNote3(SRC_DO_WHILE, 0, 0, ¬eIndex_)) { + if (!bce_->newSrcNote(SRC_DO_WHILE, ¬eIndex_)) { return false; } @@ -81,12 +81,7 @@ bool DoWhileEmitter::emitEnd() { return false; } - // Update the annotations with the update and back edge positions, for - // IonBuilder. - if (!bce_->setSrcNoteOffset(noteIndex_, SrcNote::DoWhile::CondOffset, - loopInfo_->continueTargetOffsetFromLoopHead())) { - return false; - } + // Update the annotation with the back edge position, for IonBuilder. if (!bce_->setSrcNoteOffset(noteIndex_, SrcNote::DoWhile::BackJumpOffset, loopInfo_->loopEndOffsetFromLoopHead())) { return false; diff --git a/js/src/frontend/SourceNotes.h b/js/src/frontend/SourceNotes.h index ffaf3a85f2c0..8d1dc6ae3e9c 100644 --- a/js/src/frontend/SourceNotes.h +++ b/js/src/frontend/SourceNotes.h @@ -46,9 +46,6 @@ class SrcNote { // The offset of the condition expression ops from JSOP_NOP. CondOffset, - // The offset of the update expression ops from JSOP_NOP. - UpdateOffset, - // The offset of JSOP_GOTO/JSOP_IFNE at the end of the loop from // JSOP_NOP. BackJumpOffset, @@ -69,9 +66,6 @@ class SrcNote { class DoWhile { public: enum Fields { - // The offset of the condition ops from JSOP_LOOPHEAD. - CondOffset, - // The offset of JSOP_IFNE at the end of the loop from // JSOP_LOOPHEAD. BackJumpOffset, diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 58f6bb3b32ef..0c5fab1a8108 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -3073,9 +3073,8 @@ static MOZ_MUST_USE bool SrcNotes(JSContext* cx, HandleScript script, case SRC_FOR: if (!sp->jsprintf( - " cond %u update %u backjump %u", + " cond %u backjump %u", unsigned(GetSrcNoteOffset(sn, SrcNote::For::CondOffset)), - unsigned(GetSrcNoteOffset(sn, SrcNote::For::UpdateOffset)), unsigned(GetSrcNoteOffset(sn, SrcNote::For::BackJumpOffset)))) { return false; } @@ -3100,11 +3099,9 @@ static MOZ_MUST_USE bool SrcNotes(JSContext* cx, HandleScript script, break; case SRC_DO_WHILE: - if (!sp->jsprintf( - " cond %u backjump %u", - unsigned(GetSrcNoteOffset(sn, SrcNote::DoWhile::CondOffset)), - unsigned( - GetSrcNoteOffset(sn, SrcNote::DoWhile::BackJumpOffset)))) { + if (!sp->jsprintf(" backjump %u", + unsigned(GetSrcNoteOffset( + sn, SrcNote::DoWhile::BackJumpOffset)))) { return false; } break;