In Math.random, we use __ push(Immediate(Smi::FromInt(0))); __ CallRuntime(Runtime::kNumberUnaryMinus, 1); to get a newly allocated HeapNumber if our fast allocation fails. So returning the same HeapNumber object for -0 is definitely unsafe, since we modify these objects.
On Wed, Apr 28, 2010 at 9:06 AM, <[email protected]> wrote: > > http://codereview.chromium.org/1694004/diff/17001/18001 > > File src/heap.cc (right): > > http://codereview.chromium.org/1694004/diff/17001/18001#newcode1830 > src/heap.cc:1830: return minus_zero_value(); > This means that we will never allocate a new heap number for minus zero > in this function. This seems dangerous in combination with our > heap-number overwriting for nested binary ops. > > If you cannot measure any performance gain by avoiding allocation in > certain situations, you should return a new heap number for minus zero. > > http://codereview.chromium.org/1694004/diff/17001/18001#newcode1833 > src/heap.cc:1833: int int_value = static_cast<int>(value); > Do you have a good reason for not using FastD2I and FastI2D as we do in > the old code and in the rest of the system? > > > http://codereview.chromium.org/1694004/show > > -- > v8-dev mailing list > [email protected] > http://groups.google.com/group/v8-dev > -- William Hesse Software Engineer [email protected] Google Denmark ApS Frederiksborggade 20B, 1 sal 1360 København K Denmark CVR nr. 28 86 69 84 If you received this communication by mistake, please don't forward it to anyone else (it may contain confidential or privileged information), please erase all copies of it, including all attachments, and please let the sender know it went to the wrong person. Thanks. -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
