Quick follow-up to bug 1251225 to fix a possibly overflowing left shift (found by Coverity, rs=h4writer on irc)
authorJason Orendorff <jorendorff@mozilla.com>
Fri, 04 Mar 2016 11:26:36 -0600
changeset 324971 3861ebac90e69ca083c577a4623800521a655402
parent 324970 05cef11d91beeb0a2f270497ec1a4ee409972db1
child 324972 4c57c2afe55b4952454821fea813ddc1d829cd8d
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersh4writer
bugs1251225
milestone47.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
Quick follow-up to bug 1251225 to fix a possibly overflowing left shift (found by Coverity, rs=h4writer on irc)
js/src/jit/x64/CodeGenerator-x64.cpp
--- a/js/src/jit/x64/CodeGenerator-x64.cpp
+++ b/js/src/jit/x64/CodeGenerator-x64.cpp
@@ -373,17 +373,17 @@ CodeGeneratorX64::visitMulI64(LMulI64* l
             return;
           case 2:
             masm.addq(lhs, lhs);
             return;
           default:
             if (constant > 0) {
                 // Use shift if constant is power of 2.
                 int32_t shift = mozilla::FloorLog2(constant);
-                if (int64_t(1 << shift) == constant) {
+                if (int64_t(1) << shift == constant) {
                     masm.shlq(Imm32(shift), lhs);
                     return;
                 }
             }
             masm.mul64(Imm64(constant), Register64(lhs));
         }
     } else {
         masm.imulq(ToOperand(rhs), lhs);