Style cleanup and eliminate redundant f2u(i2f|u2f) chains.
authorAndreas Gal <gal@mozilla.com>
Sun, 20 Jul 2008 17:36:11 -0700
changeset 17783 d98ca5faa22c158273bfa845ad7767c860fc1c58
parent 17777 85e5e3504108d7947e4d959c70fcf54e8e99f3de
child 17784 82844c30d64cfedc63c4a945330e90fe45ee3cd4
push id1452
push usershaver@mozilla.com
push dateFri, 22 Aug 2008 00:08:22 +0000
treeherderautoland@d13bb0868596 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone1.9.1a1pre
Style cleanup and eliminate redundant f2u(i2f|u2f) chains.
js/src/jstracer.cpp
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -207,38 +207,38 @@ static LIns* demote(LirWriter *out, LIns
     if (i->isop(LIR_i2f) || i->isop(LIR_u2f))
         return i->oprnd1();
     AvmAssert(i->isconstq());
     double cf = i->constvalf();
     int32_t ci = cf > 0x7fffffff ? uint32_t(cf) : int32_t(cf);
     return out->insImm(ci);
 }
 
-static bool isPromoteInt(LIns *i)
+static bool isPromoteInt(LIns* i)
 {
     jsdouble d;
     return i->isop(LIR_i2f) || (i->isconstq() && ((d = i->constvalf()) == (jsdouble)(jsint)d));
 }
 
-static bool isPromoteUint(LIns *i)
+static bool isPromoteUint(LIns* i)
 {
     jsdouble d;
     return i->isop(LIR_u2f) || (i->isconstq() && ((d = i->constvalf()) == (jsdouble)(jsuint)d));
 }
 
-static bool isPromote(LIns *i)
+static bool isPromote(LIns* i)
 {
     return isPromoteInt(i) || isPromoteUint(i);
 }
 
 class FuncFilter: public LirWriter
 {
     TraceRecorder& recorder;
 public:
-    FuncFilter(LirWriter *out, TraceRecorder& _recorder):
+    FuncFilter(LirWriter* out, TraceRecorder& _recorder):
         LirWriter(out), recorder(_recorder)
     {
     }
 
     LInsp ins1(LOpcode v, LInsp s0)
     {
         switch (v) {
           case LIR_fneg:
@@ -293,16 +293,23 @@ public:
         }
         return out->ins2(v, s1, s0);
     }
 
     LInsp insCall(uint32_t fid, LInsp args[])
     {
         LInsp s0 = args[0];
         switch (fid) {
+          case F_doubleToUint32:
+            if (s0->isconstq())
+                return out->insImm(js_DoubleToECMAUint32(s0->constvalf()));
+            if (s0->isop(LIR_i2f) || s0->isop(LIR_u2f)) {
+                return s0->oprnd1();
+            }
+            break;
           case F_doubleToInt32:
             if (s0->isconstq())
                 return out->insImm(js_DoubleToECMAInt32(s0->constvalf()));
             if (s0->isop(LIR_fadd) || s0->isop(LIR_fsub) || s0->isop(LIR_fmul)) {
                 LInsp lhs = s0->oprnd1();
                 LInsp rhs = s0->oprnd2();
                 if (isPromote(lhs) && isPromote(rhs)) {
                     LOpcode op = LOpcode(s0->opcode() & ~LIR64);