On Mon, 2011-08-01 at 12:21 +0200, Andy Wingo wrote:

> The numbers do fluctuate a bit; the only real constant here is that with
> my patch we get minus zero bailouts being set for some unary math ops.
> I'm going to see if I can whittle this down to one test in particular.

Got one :)

On bleeding_edge:

        d8> function roundsum(i,n) { var ret = Math.round(n); while (--i > 0) 
ret += Math.round(n); return ret; }
        d8> roundsum (1000000, 2.2) // warm up
        2000000
        d8> 1/roundsum (1000000, -0.0)
        Infinity
        d8> 
        Change::MinusZeroBailoutCounter = 2
        HValue::InferRange::RangeAllocCounter[0] = 0
        HValue::InferRange::RangeAllocCounter[1] = 44
        HValue::InferRange::RangeAllocCounter[2] = 5
        HValue::InferRange::RangeAllocCounter[3] = 2
        HValue::InferRange::RangeAllocCounter[4] = 0
        
With the patch from r8753:

        d8> function roundsum(i,n) { var ret = Math.round(n); while (--i > 0) 
ret += Math.round(n); return ret; }
        d8> roundsum (1000000, 2.2) // warm up
        2000000
        d8> 1/roundsum (1000000, -0.0)
        -Infinity
        d8> 
        UnaryMathOp::MinusZeroBailoutCounter = 10
        Change::MinusZeroBailoutCounter = 2
        HValue::InferRange::RangeAllocCounter[0] = 0
        HValue::InferRange::RangeAllocCounter[1] = 257
        HValue::InferRange::RangeAllocCounter[2] = 41
        HValue::InferRange::RangeAllocCounter[3] = 11
        HValue::InferRange::RangeAllocCounter[4] = 0

As you can see bleeding_edge produces the wrong result for this
calculation.  The reason is that it doesn't deoptimize on -0.0, because
the default HValue::InferRange returns an empty range for double values,
but one which assumes that -0.0 is not in the range -- and thus `floor'
does not do a deopt on -0.0.

You can see this in the MinusZeroBailoutCounter, occurring for the
`round'.

Good one, no? :)  I'll submit another patch to the code review, with a
regression test.

Andy

-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to