зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1477621 - Part 3: Add source note field constants for colspan. r=jandem
This commit is contained in:
Родитель
4a76ab952b
Коммит
4409e98bd2
|
@ -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. */ \
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче