[INFER] Use AnyRegisterID::fromRaw in peekReg instead of casting to RegisterID, bug 655810. r=bhackett
authorJan de Mooij <jandemooij@gmail.com>
Thu, 12 May 2011 15:31:17 +0200
changeset 75040 3f089c0d63f84d0e7602ce8a8772d4d8203d26b7
parent 75039 5bcf457d942c631e7be0a1d95e93d2e413e16145
child 75041 09461ee644367f357a0481492c4bdf1d2894d29a
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersbhackett
bugs655810
milestone6.0a1
[INFER] Use AnyRegisterID::fromRaw in peekReg instead of casting to RegisterID, bug 655810. r=bhackett
js/src/jit-test/tests/jaeger/bug655810.js
js/src/methodjit/MachineRegs.h
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/jaeger/bug655810.js
@@ -0,0 +1,6 @@
+function f(arr) {
+    var x = arr[0];
+    if (typeof x) {};
+    Math.abs(x);
+}
+f([1.2]);
--- a/js/src/methodjit/MachineRegs.h
+++ b/js/src/methodjit/MachineRegs.h
@@ -429,20 +429,19 @@ struct Registers {
     }
 
     bool empty() const {
         return !freeMask;
     }
 
     AnyRegisterID peekReg(uint32 mask) {
         JS_ASSERT(!empty(mask));
-        int ireg;
+        unsigned ireg;
         JS_FLOOR_LOG2(ireg, freeMask & mask);
-        RegisterID reg = (RegisterID)ireg;
-        return reg;
+        return AnyRegisterID::fromRaw(ireg);
     }
 
     AnyRegisterID peekReg() {
         return peekReg(freeMask);
     }
 
     AnyRegisterID takeAnyReg(uint32 mask) {
         AnyRegisterID reg = peekReg(mask);