Updates:
        Status: Assigned

Comment #5 on issue 2205 by [email protected]: MathFloorOfDiv optimization is very fragile
http://code.google.com/p/v8/issues/detail?id=2205

I just checked it for

function foo(x, y) {
  return Math.floor((x + y) / 2);
}

foo(1, 11);
foo(1, 11);
foo(1, 11);
%OptimizeFunctionOnNextCall(foo);
foo(1, 11);

and got:

                 ;;; <@18,#25> tagged-to-i
0x3d32cdcb    43  f6c101         test_b cl,0x1
0x3d32cdce    46  0f8566000000   jnz 154  (0x3d32ce3a)
0x3d32cdd4    52  d1f9           sar ecx,1
                  ;;; <@19,#25> gap
0x3d32cdd6    54  8b5508         mov edx,[ebp+0x8]
                  ;;; <@20,#26> tagged-to-i
0x3d32cdd9    57  f6c201         test_b dl,0x1
0x3d32cddc    60  0f8587000000   jnz 201  (0x3d32ce69)
0x3d32cde2    66  d1fa           sar edx,1
                  ;;; <@22,#14> add-i
0x3d32cde4    68  03d1           add edx,ecx
0x3d32cde6    70  0f8013010000   jo 351  (0x3d32ceff)
                  ;;; <@24,#17> div-i
0x3d32cdec    76  f6c201         test_b dl,0x1
0x3d32cdef    79  0f850f010000   jnz 356  (0x3d32cf04)
0x3d32cdf5    85  d1fa           sar edx,1
                  ;;; <@26,#19> check-non-smi
0x3d32cdf7    87  f7c001000000   test eax,0x1
0x3d32cdfd    93  0f8406010000   jz 361  (0x3d32cf09)
                  ;;; <@28,#20> check-maps
0x3d32ce03 99 8178ff49db6025 cmp [eax+0xff],0x2560db49 ;; object: 0x2560db49 <Map(elements=3)>
0x3d32ce0a   106  0f85fe000000   jnz 366  (0x3d32cf0e)
                  ;;; <@30,#27> int32-to-double
0x3d32ce10   112  f20f2aca       cvtsi2sd xmm1,edx
                  ;;; <@32,#21> math-floor
0x3d32ce14   116  660f3a0bc109   roundsd xmm0,xmm1,9
0x3d32ce1a   122  f20f2cc8       cvttsd2si ecx,xmm0
0x3d32ce1e   126  81f900000080   cmp ecx,0x80000000
0x3d32ce24   132  0f84e9000000   jz 371  (0x3d32cf13)
                  ;;; <@34,#28> number-tag-i
0x3d32ce2a   138  03c9           add ecx,ecx
0x3d32ce2c   140  0f8066000000   jo 248  (0x3d32ce98)

so it was either not fixed or regressed since June.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to