Bug 695546 - fix ARM build bustage and warnings. (r=mjrosenb)
authorChris Leary <cdleary@mozilla.com>
Tue, 18 Oct 2011 16:13:10 -0700
changeset 79331 c07d4ebf6e6aca69533d13e8b9d71de0b3d8c673
parent 79330 09eb10371024b95623c40538a2bb3140cc2cded8
child 79332 7a002b39d8be0d141c6b67b6a9474145ca78d42a
push id258
push usercleary@mozilla.com
push dateTue, 18 Oct 2011 23:13:41 +0000
reviewersmjrosenb
bugs695546
milestone10.0a1
Bug 695546 - fix ARM build bustage and warnings. (r=mjrosenb)
js/src/assembler/assembler/ARMAssembler.cpp
js/src/assembler/wtf/Platform.h
js/src/ion/arm/Assembler-arm.h
js/src/ion/arm/CodeGenerator-arm.cpp
--- a/js/src/assembler/assembler/ARMAssembler.cpp
+++ b/js/src/assembler/assembler/ARMAssembler.cpp
@@ -99,17 +99,17 @@ ARMWord ARMAssembler::getOp2RegScale(Reg
     // [ 6:5]   Shift type. Only LSL ("00") is used here.
     // [ 4:4]   0.
     // [ 3:0]   The register to shift.
 
     ARMWord shift;  // Shift field. This is log2(scale).
     ARMWord lz;     // Leading zeroes.
 
     // Calculate shift=log2(scale).
-#if WTF_ARM_ARCH_AT_LEAST(5)
+#if WTF_ARM_ARCH_AT_LEAST_5
     asm (
     "   clz     %[lz], %[scale]\n"
     : [lz]      "=r"  (lz)
     : [scale]   "r"   (scale)
     : // No clobbers.
     );
 #else
     ARMWord lz = 0; // Accumulate leading zeroes.
--- a/js/src/assembler/wtf/Platform.h
+++ b/js/src/assembler/wtf/Platform.h
@@ -240,16 +240,17 @@
     && !defined(__VFP_FP__) \
     && !defined(_WIN32_WCE) \
     && !defined(ANDROID)
 #define WTF_CPU_MIDDLE_ENDIAN 1
 
 #endif
 
 #define WTF_ARM_ARCH_AT_LEAST(N) (CPU(ARM) && WTF_ARM_ARCH_VERSION >= N)
+#define WTF_ARM_ARCH_AT_LEAST_5 (WTF_CPU_ARM && WTF_ARM_ARCH_VERSION >= 5)
 
 /* Set WTF_ARM_ARCH_VERSION */
 #if   defined(__ARM_ARCH_4__) \
     || defined(__ARM_ARCH_4T__) \
     || defined(__MARM_ARMV4__) \
     || defined(_ARMV4I_)
 #define WTF_ARM_ARCH_VERSION 4
 
--- a/js/src/ion/arm/Assembler-arm.h
+++ b/js/src/ion/arm/Assembler-arm.h
@@ -139,17 +139,17 @@ class VFPRegister
     bool _isInvalid:1;
     bool _isMissing:1;
     VFPRegister(int  r, RegType k)
         : kind(k), _code (r), _isInvalid(false), _isMissing(false) {}
   public:
     VFPRegister()
         : _isInvalid(true), _isMissing(false) {}
     VFPRegister(bool b)
-        : _isMissing(b), _isInvalid(false) {}
+        : _isInvalid(false), _isMissing(b) {}
     VFPRegister(FloatRegister fr)
         : kind(Double), _code(fr.code()), _isInvalid(false), _isMissing(false)
     {
         JS_ASSERT(_code == fr.code());
     }
     VFPRegister(FloatRegister fr, RegType k)
         : kind(k), _code (fr.code())
     {
@@ -446,17 +446,17 @@ struct Imm8VFPImmData
     uint32 imm4H : 4;
     int32 isInvalid : 12;
   public:
     uint32 encode() {
         if (isInvalid != 0)
             return -1;
         return imm4L | (imm4H << 16);
     };
-    Imm8VFPImmData() : imm4L(-1), imm4H(-1), isInvalid(-1) {}
+    Imm8VFPImmData() : imm4L(-1U & 0xf), imm4H(-1U & 0xf), isInvalid(-1) {}
     Imm8VFPImmData(uint32 imm) : imm4L(imm&0xf), imm4H(imm>>4), isInvalid(0) {
         JS_ASSERT(imm <= 0xff);
     }
 };
 
 struct Imm12Data
 {
     uint32 data : 12;
@@ -716,17 +716,17 @@ class VFPAddr
     uint32 encode() { return data; }
 };
 
 class VFPImm {
     uint32 data;
   public:
     VFPImm(uint32 top);
     uint32 encode() { return data; }
-    bool isValid() { return data != -1; }
+    bool isValid() { return data != -1U; }
 };
 
 class BOffImm
 {
     uint32 data;
   public:
     uint32 encode() {
         return data;
@@ -1184,17 +1184,18 @@ public:
         dtmCond = c;
         dtmLastReg = -1;
     }
     void transferFloatReg(VFPRegister rn)
     {
         if (dtmLastReg == -1) {
             vdtmFirstReg = rn;
         } else {
-            JS_ASSERT(rn.code() == dtmLastReg + 1);
+            JS_ASSERT(dtmLastReg > 0);
+            JS_ASSERT(rn.code() == unsigned(dtmLastReg) + 1);
         }
         dtmLastReg = rn.code();
     }
     void finishFloatTransfer() {
         JS_ASSERT(dtmActive);
         dtmActive = false;
         JS_ASSERT(dtmLastReg != -1);
         // fencepost problem.
@@ -1234,17 +1235,17 @@ GetArgReg(uint32 arg, Register *out)
       default:
         return false;
     }
 }
 
 class DoubleEncoder {
     uint32 rep(bool b, uint32 count) {
         uint ret = 0;
-        for (int i = 0; i < count; i++)
+        for (uint32 i = 0; i < count; i++)
             ret = (ret << 1) | b;
         return ret;
     }
     uint32 encode(uint8 value) {
         //ARM ARM "VFP modified immediate constants"
         // aBbbbbbb bbcdefgh 000...
         // we want to return the top 32 bits of the double
         // the rest are 0.
--- a/js/src/ion/arm/CodeGenerator-arm.cpp
+++ b/js/src/ion/arm/CodeGenerator-arm.cpp
@@ -840,21 +840,22 @@ CodeGeneratorARM::visitReturn(LReturn *r
     if (current->mir() != *gen->graph().poBegin())
         masm.ma_b(returnLabel_);
     return true;
 }
 
 void
 CodeGeneratorARM::linkAbsoluteLabels()
 {
-    IonCode *method = gen->script->ion->method();
+    JSScript *script = gen->info().script();
+    IonCode *method = script->ion->method();
 
     for (size_t i = 0; i < deferredDoubles_.length(); i++) {
         DeferredDouble *d = deferredDoubles_[i];
-        const Value &v = gen->script->ion->getConstant(d->index());
+        const Value &v = script->ion->getConstant(d->index());
         MacroAssembler::Bind(method, d->label(), &v);
     }
 }
 
 bool
 CodeGeneratorARM::visitDouble(LDouble *ins)
 {
 
@@ -939,34 +940,33 @@ CodeGeneratorARM::visitStackArg(LStackAr
     masm.ma_str(val.typeReg(), DTRAddr(StackPointer, DtrOffImm(stack_offset)));
     masm.ma_str(val.payloadReg(), DTRAddr(StackPointer, DtrOffImm(stack_offset+4)));
     return true;
 }
 
 bool
 CodeGeneratorARM::visitCallGeneric(LCallGeneric *call)
 {
-
+#if 0
     // Holds the function object.
     const LAllocation *obj = call->getFunction();
     Register objreg  = ToRegister(obj);
 
     // Holds the callee token. Initially undefined.
     const LAllocation *tok = call->getToken();
     Register tokreg  = ToRegister(tok);
 
     // Holds the function nargs. Initially undefined.
     const LAllocation *nargs = call->getNargsReg();
     Register nargsreg = ToRegister(nargs);
 
     uint32 callargslot  = call->argslot();
     uint32 unused_stack = StackOffsetOfPassedArg(callargslot);
 
 
-#if 0
     // Guard that objreg is actually a function object.
     masm.ma_ldr(DTRAddr(objreg, DtrOffImm(JSObject::offsetOfClassPointer())), tokreg);
     masm.ma_ldr(DTRAddr(tokreg, DtrOffImm(0)), tokreg);
 
     masm.cmpPtr(tokreg, ImmWord(&js::FunctionClass));
     if (!bailoutIf(Assembler::NotEqual, call->snapshot()))
         return false;