Bug 1333018 - Change argument type from reference to pointer in popConstI32, popConstI64, popConstPositivePowerOfTwoI32, and popConstPositivePowerOfTwoI64 to adhere to the API coding style. r=bbouvier
authorCrispin <chb2ab@virginia.edu>
Thu, 02 Mar 2017 18:01:49 -0500
changeset 394970 c6ffd6d73ab820c2e8a00874e08b3d524878b63a
parent 394969 30c1e64495a9930f3b69b9dbdf6b43d24509c886
child 394971 e818ea427a08740381fc55276b83cd1d4aebe87d
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs1333018
milestone54.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 1333018 - Change argument type from reference to pointer in popConstI32, popConstI64, popConstPositivePowerOfTwoI32, and popConstPositivePowerOfTwoI64 to adhere to the API coding style. r=bbouvier
js/src/wasm/WasmBaselineCompile.cpp
--- a/js/src/wasm/WasmBaselineCompile.cpp
+++ b/js/src/wasm/WasmBaselineCompile.cpp
@@ -1770,30 +1770,30 @@ class BaseCompiler
             if (v.kind() == Stk::RegisterF32)
                 freeF32(v.f32reg());
         }
 
         stk_.popBack();
         return specific;
     }
 
-    MOZ_MUST_USE bool popConstI32(int32_t& c) {
+    MOZ_MUST_USE bool popConstI32(int32_t* c) {
         Stk& v = stk_.back();
         if (v.kind() != Stk::ConstI32)
             return false;
-        c = v.i32val();
+        *c = v.i32val();
         stk_.popBack();
         return true;
     }
 
-    MOZ_MUST_USE bool popConstI64(int64_t& c) {
+    MOZ_MUST_USE bool popConstI64(int64_t* c) {
         Stk& v = stk_.back();
         if (v.kind() != Stk::ConstI64)
             return false;
-        c = v.i64val();
+        *c = v.i64val();
         stk_.popBack();
         return true;
     }
 
     MOZ_MUST_USE bool peekConstI32(int32_t* c) {
         Stk& v = stk_.back();
         if (v.kind() != Stk::ConstI32)
             return false;
@@ -1804,42 +1804,42 @@ class BaseCompiler
     MOZ_MUST_USE bool peekConstI64(int64_t* c) {
         Stk& v = stk_.back();
         if (v.kind() != Stk::ConstI64)
             return false;
         *c = v.i64val();
         return true;
     }
 
-    MOZ_MUST_USE bool popConstPositivePowerOfTwoI32(int32_t& c,
-                                                    uint_fast8_t& power,
+    MOZ_MUST_USE bool popConstPositivePowerOfTwoI32(int32_t* c,
+                                                    uint_fast8_t* power,
                                                     int32_t cutoff)
     {
         Stk& v = stk_.back();
         if (v.kind() != Stk::ConstI32)
             return false;
-        c = v.i32val();
-        if (c <= cutoff || !IsPowerOfTwo(static_cast<uint32_t>(c)))
+        *c = v.i32val();
+        if (*c <= cutoff || !IsPowerOfTwo(static_cast<uint32_t>(*c)))
             return false;
-        power = FloorLog2(c);
+        *power = FloorLog2(*c);
         stk_.popBack();
         return true;
     }
 
-    MOZ_MUST_USE bool popConstPositivePowerOfTwoI64(int64_t& c,
-                                                    uint_fast8_t& power,
+    MOZ_MUST_USE bool popConstPositivePowerOfTwoI64(int64_t* c,
+                                                    uint_fast8_t* power,
                                                     int64_t cutoff)
     {
         Stk& v = stk_.back();
         if (v.kind() != Stk::ConstI64)
             return false;
-        c = v.i64val();
-        if (c <= cutoff || !IsPowerOfTwo(static_cast<uint64_t>(c)))
+        *c = v.i64val();
+        if (*c <= cutoff || !IsPowerOfTwo(static_cast<uint64_t>(*c)))
             return false;
-        power = FloorLog2(c);
+        *power = FloorLog2(*c);
         stk_.popBack();
         return true;
     }
 
     MOZ_MUST_USE bool peekLocalI32(uint32_t* local) {
         Stk& v = stk_.back();
         if (v.kind() != Stk::LocalI32)
             return false;
@@ -3907,34 +3907,34 @@ class BaseCompiler
     MOZ_MUST_USE bool emitGrowMemory();
     MOZ_MUST_USE bool emitCurrentMemory();
 };
 
 void
 BaseCompiler::emitAddI32()
 {
     int32_t c;
-    if (popConstI32(c)) {
+    if (popConstI32(&c)) {
         RegI32 r = popI32();
         masm.add32(Imm32(c), r);
         pushI32(r);
     } else {
         RegI32 r0, r1;
         pop2xI32(&r0, &r1);
         masm.add32(r1, r0);
         freeI32(r1);
         pushI32(r0);
     }
 }
 
 void
 BaseCompiler::emitAddI64()
 {
     int64_t c;
-    if (popConstI64(c)) {
+    if (popConstI64(&c)) {
         RegI64 r = popI64();
         masm.add64(Imm64(c), r);
         pushI64(r);
     } else {
         RegI64 r0, r1;
         pop2xI64(&r0, &r1);
         masm.add64(r1, r0);
         freeI64(r1);
@@ -3961,34 +3961,34 @@ BaseCompiler::emitAddF32()
     freeF32(r1);
     pushF32(r0);
 }
 
 void
 BaseCompiler::emitSubtractI32()
 {
     int32_t c;
-    if (popConstI32(c)) {
+    if (popConstI32(&c)) {
         RegI32 r = popI32();
         masm.sub32(Imm32(c), r);
         pushI32(r);
     } else {
         RegI32 r0, r1;
         pop2xI32(&r0, &r1);
         masm.sub32(r1, r0);
         freeI32(r1);
         pushI32(r0);
     }
 }
 
 void
 BaseCompiler::emitSubtractI64()
 {
     int64_t c;
-    if (popConstI64(c)) {
+    if (popConstI64(&c)) {
         RegI64 r = popI64();
         masm.sub64(Imm64(c), r);
         pushI64(r);
     } else {
         RegI64 r0, r1;
         pop2xI64(&r0, &r1);
         masm.sub64(r1, r0);
         freeI64(r1);
@@ -4073,17 +4073,17 @@ BaseCompiler::emitMultiplyF64()
     pushF64(r0);
 }
 
 void
 BaseCompiler::emitQuotientI32()
 {
     int32_t c;
     uint_fast8_t power;
-    if (popConstPositivePowerOfTwoI32(c, power, 0)) {
+    if (popConstPositivePowerOfTwoI32(&c, &power, 0)) {
         if (power != 0) {
             RegI32 r = popI32();
             Label positive;
             masm.branchTest32(Assembler::NotSigned, r, r, &positive);
             masm.add32(Imm32(c-1), r);
             masm.bind(&positive);
 
             masm.rshift32Arithmetic(Imm32(power & 31), r);
@@ -4107,17 +4107,17 @@ BaseCompiler::emitQuotientI32()
     }
 }
 
 void
 BaseCompiler::emitQuotientU32()
 {
     int32_t c;
     uint_fast8_t power;
-    if (popConstPositivePowerOfTwoI32(c, power, 0)) {
+    if (popConstPositivePowerOfTwoI32(&c, &power, 0)) {
         if (power != 0) {
             RegI32 r = popI32();
             masm.rshift32(Imm32(power & 31), r);
             pushI32(r);
         }
     } else {
         bool isConst = peekConstI32(&c);
         RegI32 r0, r1;
@@ -4134,17 +4134,17 @@ BaseCompiler::emitQuotientU32()
     }
 }
 
 void
 BaseCompiler::emitRemainderI32()
 {
     int32_t c;
     uint_fast8_t power;
-    if (popConstPositivePowerOfTwoI32(c, power, 1)) {
+    if (popConstPositivePowerOfTwoI32(&c, &power, 1)) {
         RegI32 r = popI32();
         RegI32 temp = needI32();
         moveI32(r, temp);
 
         Label positive;
         masm.branchTest32(Assembler::NotSigned, temp, temp, &positive);
         masm.add32(Imm32(c-1), temp);
         masm.bind(&positive);
@@ -4173,17 +4173,17 @@ BaseCompiler::emitRemainderI32()
     }
 }
 
 void
 BaseCompiler::emitRemainderU32()
 {
     int32_t c;
     uint_fast8_t power;
-    if (popConstPositivePowerOfTwoI32(c, power, 1)) {
+    if (popConstPositivePowerOfTwoI32(&c, &power, 1)) {
         RegI32 r = popI32();
         masm.and32(Imm32(c-1), r);
         pushI32(r);
     } else {
         bool isConst = peekConstI32(&c);
         RegI32 r0, r1;
         pop2xI32ForIntMulDiv(&r0, &r1);
 
@@ -4200,17 +4200,17 @@ BaseCompiler::emitRemainderU32()
 
 #ifndef INT_DIV_I64_CALLOUT
 void
 BaseCompiler::emitQuotientI64()
 {
 # ifdef JS_PUNBOX64
     int64_t c;
     uint_fast8_t power;
-    if (popConstPositivePowerOfTwoI64(c, power, 0)) {
+    if (popConstPositivePowerOfTwoI64(&c, &power, 0)) {
         if (power != 0) {
             RegI64 r = popI64();
             Label positive;
             masm.branchTest64(Assembler::NotSigned, r, r, Register::Invalid(),
                               &positive);
             masm.add64(Imm32(c-1), r);
             masm.bind(&positive);
 
@@ -4231,17 +4231,17 @@ BaseCompiler::emitQuotientI64()
 }
 
 void
 BaseCompiler::emitQuotientU64()
 {
 # ifdef JS_PUNBOX64
     int64_t c;
     uint_fast8_t power;
-    if (popConstPositivePowerOfTwoI64(c, power, 0)) {
+    if (popConstPositivePowerOfTwoI64(&c, &power, 0)) {
         if (power != 0) {
             RegI64 r = popI64();
             masm.rshift64(Imm32(power & 63), r);
             pushI64(r);
         }
     } else {
         bool isConst = peekConstI64(&c);
         RegI64 r0, r1;
@@ -4256,17 +4256,17 @@ BaseCompiler::emitQuotientU64()
 }
 
 void
 BaseCompiler::emitRemainderI64()
 {
 # ifdef JS_PUNBOX64
     int64_t c;
     uint_fast8_t power;
-    if (popConstPositivePowerOfTwoI64(c, power, 1)) {
+    if (popConstPositivePowerOfTwoI64(&c, &power, 1)) {
         RegI64 r = popI64();
         RegI64 temp = needI64();
         moveI64(r, temp);
 
         Label positive;
         masm.branchTest64(Assembler::NotSigned, temp, temp,
                           Register::Invalid(), &positive);
         masm.add64(Imm64(c-1), temp);
@@ -4292,17 +4292,17 @@ BaseCompiler::emitRemainderI64()
 }
 
 void
 BaseCompiler::emitRemainderU64()
 {
 # ifdef JS_PUNBOX64
     int64_t c;
     uint_fast8_t power;
-    if (popConstPositivePowerOfTwoI64(c, power, 1)) {
+    if (popConstPositivePowerOfTwoI64(&c, &power, 1)) {
         RegI64 r = popI64();
         masm.and64(Imm64(c-1), r);
         pushI64(r);
     } else {
         bool isConst = peekConstI64(&c);
         RegI64 r0, r1;
         pop2xI64ForIntDiv(&r0, &r1);
         remainderI64(r1, r0, IsUnsigned(true), isConst, c);
@@ -4441,119 +4441,119 @@ BaseCompiler::emitCopysignF64()
     freeF64(r1);
     pushF64(r0);
 }
 
 void
 BaseCompiler::emitOrI32()
 {
     int32_t c;
-    if (popConstI32(c)) {
+    if (popConstI32(&c)) {
         RegI32 r = popI32();
         masm.or32(Imm32(c), r);
         pushI32(r);
     } else {
         RegI32 r0, r1;
         pop2xI32(&r0, &r1);
         masm.or32(r1, r0);
         freeI32(r1);
         pushI32(r0);
     }
 }
 
 void
 BaseCompiler::emitOrI64()
 {
     int64_t c;
-    if (popConstI64(c)) {
+    if (popConstI64(&c)) {
         RegI64 r = popI64();
         masm.or64(Imm64(c), r);
         pushI64(r);
     } else {
         RegI64 r0, r1;
         pop2xI64(&r0, &r1);
         masm.or64(r1, r0);
         freeI64(r1);
         pushI64(r0);
     }
 }
 
 void
 BaseCompiler::emitAndI32()
 {
     int32_t c;
-    if (popConstI32(c)) {
+    if (popConstI32(&c)) {
         RegI32 r = popI32();
         masm.and32(Imm32(c), r);
         pushI32(r);
     } else {
         RegI32 r0, r1;
         pop2xI32(&r0, &r1);
         masm.and32(r1, r0);
         freeI32(r1);
         pushI32(r0);
     }
 }
 
 void
 BaseCompiler::emitAndI64()
 {
     int64_t c;
-    if (popConstI64(c)) {
+    if (popConstI64(&c)) {
         RegI64 r = popI64();
         masm.and64(Imm64(c), r);
         pushI64(r);
     } else {
         RegI64 r0, r1;
         pop2xI64(&r0, &r1);
         masm.and64(r1, r0);
         freeI64(r1);
         pushI64(r0);
     }
 }
 
 void
 BaseCompiler::emitXorI32()
 {
     int32_t c;
-    if (popConstI32(c)) {
+    if (popConstI32(&c)) {
         RegI32 r = popI32();
         masm.xor32(Imm32(c), r);
         pushI32(r);
     } else {
         RegI32 r0, r1;
         pop2xI32(&r0, &r1);
         masm.xor32(r1, r0);
         freeI32(r1);
         pushI32(r0);
     }
 }
 
 void
 BaseCompiler::emitXorI64()
 {
     int64_t c;
-    if (popConstI64(c)) {
+    if (popConstI64(&c)) {
         RegI64 r = popI64();
         masm.xor64(Imm64(c), r);
         pushI64(r);
     } else {
         RegI64 r0, r1;
         pop2xI64(&r0, &r1);
         masm.xor64(r1, r0);
         freeI64(r1);
         pushI64(r0);
     }
 }
 
 void
 BaseCompiler::emitShlI32()
 {
     int32_t c;
-    if (popConstI32(c)) {
+    if (popConstI32(&c)) {
         RegI32 r = popI32();
         masm.lshift32(Imm32(c & 31), r);
         pushI32(r);
     } else {
         RegI32 r0, r1;
         pop2xI32ForShiftOrRotate(&r0, &r1);
         maskShiftCount32(r1);
         masm.lshift32(r1, r0);
@@ -4561,34 +4561,34 @@ BaseCompiler::emitShlI32()
         pushI32(r0);
     }
 }
 
 void
 BaseCompiler::emitShlI64()
 {
     int64_t c;
-    if (popConstI64(c)) {
+    if (popConstI64(&c)) {
         RegI64 r = popI64();
         masm.lshift64(Imm32(c & 63), r);
         pushI64(r);
     } else {
         RegI64 r0, r1;
         pop2xI64ForShiftOrRotate(&r0, &r1);
         masm.lshift64(lowPart(r1), r0);
         freeI64(r1);
         pushI64(r0);
     }
 }
 
 void
 BaseCompiler::emitShrI32()
 {
     int32_t c;
-    if (popConstI32(c)) {
+    if (popConstI32(&c)) {
         RegI32 r = popI32();
         masm.rshift32Arithmetic(Imm32(c & 31), r);
         pushI32(r);
     } else {
         RegI32 r0, r1;
         pop2xI32ForShiftOrRotate(&r0, &r1);
         maskShiftCount32(r1);
         masm.rshift32Arithmetic(r1, r0);
@@ -4596,34 +4596,34 @@ BaseCompiler::emitShrI32()
         pushI32(r0);
     }
 }
 
 void
 BaseCompiler::emitShrI64()
 {
     int64_t c;
-    if (popConstI64(c)) {
+    if (popConstI64(&c)) {
         RegI64 r = popI64();
         masm.rshift64Arithmetic(Imm32(c & 63), r);
         pushI64(r);
     } else {
         RegI64 r0, r1;
         pop2xI64ForShiftOrRotate(&r0, &r1);
         masm.rshift64Arithmetic(lowPart(r1), r0);
         freeI64(r1);
         pushI64(r0);
     }
 }
 
 void
 BaseCompiler::emitShrU32()
 {
     int32_t c;
-    if (popConstI32(c)) {
+    if (popConstI32(&c)) {
         RegI32 r = popI32();
         masm.rshift32(Imm32(c & 31), r);
         pushI32(r);
     } else {
         RegI32 r0, r1;
         pop2xI32ForShiftOrRotate(&r0, &r1);
         maskShiftCount32(r1);
         masm.rshift32(r1, r0);
@@ -4631,51 +4631,51 @@ BaseCompiler::emitShrU32()
         pushI32(r0);
     }
 }
 
 void
 BaseCompiler::emitShrU64()
 {
     int64_t c;
-    if (popConstI64(c)) {
+    if (popConstI64(&c)) {
         RegI64 r = popI64();
         masm.rshift64(Imm32(c & 63), r);
         pushI64(r);
     } else {
         RegI64 r0, r1;
         pop2xI64ForShiftOrRotate(&r0, &r1);
         masm.rshift64(lowPart(r1), r0);
         freeI64(r1);
         pushI64(r0);
     }
 }
 
 void
 BaseCompiler::emitRotrI32()
 {
     int32_t c;
-    if (popConstI32(c)) {
+    if (popConstI32(&c)) {
         RegI32 r = popI32();
         masm.rotateRight(Imm32(c & 31), r, r);
         pushI32(r);
     } else {
         RegI32 r0, r1;
         pop2xI32ForShiftOrRotate(&r0, &r1);
         masm.rotateRight(r1, r0, r0);
         freeI32(r1);
         pushI32(r0);
     }
 }
 
 void
 BaseCompiler::emitRotrI64()
 {
     int64_t c;
-    if (popConstI64(c)) {
+    if (popConstI64(&c)) {
         RegI64 r = popI64();
         RegI32 temp;
         if (rotate64NeedsTemp())
             temp = needI32();
         masm.rotateRight64(Imm32(c & 63), r, r, temp);
         if (temp != Register::Invalid())
             freeI32(temp);
         pushI64(r);
@@ -4687,34 +4687,34 @@ BaseCompiler::emitRotrI64()
         pushI64(r0);
     }
 }
 
 void
 BaseCompiler::emitRotlI32()
 {
     int32_t c;
-    if (popConstI32(c)) {
+    if (popConstI32(&c)) {
         RegI32 r = popI32();
         masm.rotateLeft(Imm32(c & 31), r, r);
         pushI32(r);
     } else {
         RegI32 r0, r1;
         pop2xI32ForShiftOrRotate(&r0, &r1);
         masm.rotateLeft(r1, r0, r0);
         freeI32(r1);
         pushI32(r0);
     }
 }
 
 void
 BaseCompiler::emitRotlI64()
 {
     int64_t c;
-    if (popConstI64(c)) {
+    if (popConstI64(&c)) {
         RegI64 r = popI64();
         RegI32 temp;
         if (rotate64NeedsTemp())
             temp = needI32();
         masm.rotateLeft64(Imm32(c & 63), r, r, temp);
         if (temp != Register::Invalid())
             freeI32(temp);
         pushI64(r);
@@ -5159,17 +5159,17 @@ BaseCompiler::emitBranchSetup(BranchStat
         b->i32.lhs = popI32();
         b->i32.rhsImm = true;
         b->i32.imm = 0;
         break;
       }
       case LatentOp::Compare: {
         switch (latentType_) {
           case ValType::I32: {
-            if (popConstI32(b->i32.imm)) {
+            if (popConstI32(&b->i32.imm)) {
                 b->i32.lhs = popI32();
                 b->i32.rhsImm = true;
             } else {
                 pop2xI32(&b->i32.lhs, &b->i32.rhs);
                 b->i32.rhsImm = false;
             }
             break;
           }
@@ -6321,17 +6321,17 @@ BaseCompiler::emitSetGlobal()
 
 BaseCompiler::RegI32
 BaseCompiler::popMemoryAccess(MemoryAccessDesc* access, bool* omitBoundsCheck)
 {
     // Caller must initialize.
     MOZ_ASSERT(!*omitBoundsCheck);
 
     int32_t addrTmp;
-    if (popConstI32(addrTmp)) {
+    if (popConstI32(&addrTmp)) {
         uint32_t addr = addrTmp;
 
         uint64_t ea = uint64_t(addr) + uint64_t(access->offset());
         uint64_t limit = uint64_t(env_.minMemoryLength) + uint64_t(wasm::OffsetGuardLimit);
 
         *omitBoundsCheck = ea < limit;
 
         // Fold the offset into the pointer if we can, as this is always
@@ -6606,17 +6606,17 @@ void
 BaseCompiler::emitCompareI32(Assembler::Condition compareOp, ValType compareType)
 {
     MOZ_ASSERT(compareType == ValType::I32);
 
     if (sniffConditionalControlCmp(compareOp, compareType))
         return;
 
     int32_t c;
-    if (popConstI32(c)) {
+    if (popConstI32(&c)) {
         RegI32 r0 = popI32();
         masm.cmp32Set(compareOp, r0, Imm32(c), r0);
         pushI32(r0);
     } else {
         RegI32 r0, r1;
         pop2xI32(&r0, &r1);
         masm.cmp32Set(compareOp, r0, r1, r0);
         freeI32(r1);