Bug 1383155 - remove redundant casts of SN_TYPE; r=jimb
authorTom Tromey <tom@tromey.com>
Fri, 21 Jul 2017 08:13:19 -0600
changeset 419276 40b0b14356e190be8fac53b56369426d7b7f55f6
parent 419275 495c6b6e45a784ee1fd39aab0a02eff3d526e1b0
child 419277 f6528783c52507e29d5be409cc8fbf9a394a5ac8
child 419321 33154264e3d9e232ef0bab0cd271ba63f296775c
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimb
bugs1383155
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1383155 - remove redundant casts of SN_TYPE; r=jimb MozReview-Commit-ID: 8hwj36YwAxz
js/src/jsopcode.h
js/src/jsscript.cpp
js/src/shell/js.cpp
js/src/vm/CodeCoverage.cpp
js/src/vm/Debugger.cpp
--- 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
@@ -184,17 +184,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
@@ -5930,17 +5930,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;