Bug 1383155 - remove redundant casts of SN_TYPE; r?jimb
MozReview-Commit-ID: 8hwj36YwAxz
--- a/js/src/jsopcode.h
+++ b/js/src/jsopcode.h
@@ -499,17 +499,17 @@ class SrcNoteLineScanner
lineHeader = (offset == 0);
if (SN_IS_TERMINATOR(sn))
return;
ptrdiff_t nextOffset;
while ((nextOffset = offset + SN_DELTA(sn)) <= relpc && !SN_IS_TERMINATOR(sn)) {
offset = nextOffset;
- SrcNoteType type = (SrcNoteType) SN_TYPE(sn);
+ SrcNoteType type = SN_TYPE(sn);
if (type == SRC_SETLINE || type == SRC_NEWLINE) {
if (type == SRC_SETLINE)
lineno = GetSrcNoteOffset(sn, 0);
else
lineno++;
if (offset == relpc)
lineHeader = true;
--- a/js/src/jsscript.cpp
+++ b/js/src/jsscript.cpp
@@ -3281,17 +3281,17 @@ js::PCToLineNumber(unsigned startLine, j
*/
ptrdiff_t offset = 0;
ptrdiff_t target = pc - code;
for (jssrcnote* sn = notes; !SN_IS_TERMINATOR(sn); sn = SN_NEXT(sn)) {
offset += SN_DELTA(sn);
if (offset > target)
break;
- SrcNoteType type = (SrcNoteType) SN_TYPE(sn);
+ SrcNoteType type = SN_TYPE(sn);
if (type == SRC_SETLINE) {
lineno = unsigned(GetSrcNoteOffset(sn, 0));
column = 0;
} else if (type == SRC_NEWLINE) {
lineno++;
column = 0;
} else if (type == SRC_COLSPAN) {
ptrdiff_t colspan = SN_OFFSET_TO_COLSPAN(GetSrcNoteOffset(sn, 0));
@@ -3333,17 +3333,17 @@ js::LineNumberToPC(JSScript* script, uns
if (lineno >= target) {
unsigned diff = lineno - target;
if (diff < bestdiff) {
bestdiff = diff;
best = offset;
}
}
offset += SN_DELTA(sn);
- SrcNoteType type = (SrcNoteType) SN_TYPE(sn);
+ SrcNoteType type = SN_TYPE(sn);
if (type == SRC_SETLINE) {
lineno = unsigned(GetSrcNoteOffset(sn, 0));
} else if (type == SRC_NEWLINE) {
lineno++;
}
}
if (best >= 0)
offset = best;
@@ -3352,17 +3352,17 @@ out:
}
JS_FRIEND_API(unsigned)
js::GetScriptLineExtent(JSScript* script)
{
unsigned lineno = script->lineno();
unsigned maxLineNo = lineno;
for (jssrcnote* sn = script->notes(); !SN_IS_TERMINATOR(sn); sn = SN_NEXT(sn)) {
- SrcNoteType type = (SrcNoteType) SN_TYPE(sn);
+ SrcNoteType type = SN_TYPE(sn);
if (type == SRC_SETLINE)
lineno = unsigned(GetSrcNoteOffset(sn, 0));
else if (type == SRC_NEWLINE)
lineno++;
if (maxLineNo < lineno)
maxLineNo = lineno;
}
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -2374,17 +2374,17 @@ SrcNotes(JSContext* cx, HandleScript scr
unsigned offset = 0;
unsigned colspan = 0;
unsigned lineno = script->lineno();
jssrcnote* notes = script->notes();
unsigned switchTableEnd = 0, switchTableStart = 0;
for (jssrcnote* sn = notes; !SN_IS_TERMINATOR(sn); sn = SN_NEXT(sn)) {
unsigned delta = SN_DELTA(sn);
offset += delta;
- SrcNoteType type = (SrcNoteType) SN_TYPE(sn);
+ SrcNoteType type = SN_TYPE(sn);
const char* name = js_SrcNoteSpec[type].name;
if (!sp->jsprintf("%3u: %4u %5u [%4u] %-8s",
unsigned(sn - notes), lineno, offset, delta, name))
{
return false;
}
switch (type) {
--- a/js/src/vm/CodeCoverage.cpp
+++ b/js/src/vm/CodeCoverage.cpp
@@ -183,17 +183,17 @@ LCovSource::writeScript(JSScript* script
hits = counts->numExec();
}
// If we have additional source notes, walk all the source notes of the
// current pc.
if (snpc <= pc) {
size_t oldLine = lineno;
while (!SN_IS_TERMINATOR(sn) && snpc <= pc) {
- SrcNoteType type = (SrcNoteType) SN_TYPE(sn);
+ SrcNoteType type = SN_TYPE(sn);
if (type == SRC_SETLINE)
lineno = size_t(GetSrcNoteOffset(sn, 0));
else if (type == SRC_NEWLINE)
lineno++;
else if (type == SRC_TABLESWITCH)
tableswitchExitOffset = GetSrcNoteOffset(sn, 0);
sn = SN_NEXT(sn);
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -5932,17 +5932,17 @@ class BytecodeRangeWithPosition : privat
private:
void updatePosition() {
/*
* Determine the current line number by reading all source notes up to
* and including the current offset.
*/
jsbytecode *lastLinePC = nullptr;
while (!SN_IS_TERMINATOR(sn) && snpc <= frontPC()) {
- SrcNoteType type = (SrcNoteType) SN_TYPE(sn);
+ SrcNoteType type = SN_TYPE(sn);
if (type == SRC_COLSPAN) {
ptrdiff_t colspan = SN_OFFSET_TO_COLSPAN(GetSrcNoteOffset(sn, 0));
MOZ_ASSERT(ptrdiff_t(column) + colspan >= 0);
column += colspan;
lastLinePC = snpc;
} else if (type == SRC_SETLINE) {
lineno = size_t(GetSrcNoteOffset(sn, 0));
column = 0;