Commit 4409e98b authored by Tooru Fujisawa's avatar Tooru Fujisawa
Browse files

Bug 1477621 - Part 3: Add source note field constants for colspan. r=jandem

parent 4a76ab95
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -80,6 +80,16 @@ class SrcNote {
            Count
        };
    };
    // SRC_COLSPAN: Source note for arbitrary ops.
    class ColSpan {
      public:
        enum Fields {
            // The column span (the diff between the column corresponds to the
            // current op and last known column).
            Span,
            Count
        };
    };
};

#define FOR_EACH_SRC_NOTE_TYPE(M)                                                                  \
@@ -106,7 +116,7 @@ class SrcNote {
                                              for toString correctness for default ctors. */       \
    M(SRC_TRY,          "try",         SrcNote::Try::Count) \
    /* All notes above here are "gettable".  See SN_IS_GETTABLE below. */                          \
    M(SRC_COLSPAN,      "colspan",     1)  /* Number of columns this opcode spans. */              \
    M(SRC_COLSPAN,      "colspan",     SrcNote::ColSpan::Count) \
    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. */                                           \
+1 −1
Original line number Diff line number Diff line
@@ -2725,7 +2725,7 @@ SrcNotes(JSContext* cx, HandleScript script, Sprinter* sp)
            break;

          case SRC_COLSPAN:
            colspan = SN_OFFSET_TO_COLSPAN(GetSrcNoteOffset(sn, 0));
            colspan = SN_OFFSET_TO_COLSPAN(GetSrcNoteOffset(sn, SrcNote::ColSpan::Span));
            if (!sp->jsprintf("%d", colspan))
                return false;
            break;
+2 −1
Original line number Diff line number Diff line
@@ -178,7 +178,8 @@ class BytecodeRangeWithPosition : private BytecodeRange
        while (!SN_IS_TERMINATOR(sn) && snpc <= frontPC()) {
            SrcNoteType type = SN_TYPE(sn);
            if (type == SRC_COLSPAN) {
                ptrdiff_t colspan = SN_OFFSET_TO_COLSPAN(GetSrcNoteOffset(sn, 0));
                ptrdiff_t colspan =
                    SN_OFFSET_TO_COLSPAN(GetSrcNoteOffset(sn, SrcNote::ColSpan::Span));
                MOZ_ASSERT(ptrdiff_t(column) + colspan >= 0);
                column += colspan;
                lastLinePC = snpc;
+1 −1
Original line number Diff line number Diff line
@@ -3277,7 +3277,7 @@ js::PCToLineNumber(unsigned startLine, jssrcnote* notes, jsbytecode* code, jsbyt
            lineno++;
            column = 0;
        } else if (type == SRC_COLSPAN) {
            ptrdiff_t colspan = SN_OFFSET_TO_COLSPAN(GetSrcNoteOffset(sn, 0));
            ptrdiff_t colspan = SN_OFFSET_TO_COLSPAN(GetSrcNoteOffset(sn, SrcNote::ColSpan::Span));
            MOZ_ASSERT(ptrdiff_t(column) + colspan >= 0);
            column += colspan;
        }