High-level comment:
As discussed offline, this approach doesn't work for all cases. Example:
assume
some operation returns a NaN that happens to be TheHoleNan. Store it into a
packed double array -> no canonicalization. Load it again and store it into
an
unpacked double array -> no canonicalization, and upon the next load it
will be
treated as the hole even though it should be just a NaN.
Even more difficult to work around is when we have stored such a
non-canonicalized NaN to a packed array and then transition that to an
unpacked
array. Currently this transition is a simple map change; if we'd have to
canonicalize all elements it would become quite expensive.
In short, I think our best option is to keep the invariant that *all* double
arrays contain only canonicalized NaNs.
https://chromiumcodereview.appspot.com/10538002/diff/1/src/hydrogen-instructions.h
File src/hydrogen-instructions.h (right):
https://chromiumcodereview.appspot.com/10538002/diff/1/src/hydrogen-instructions.h#newcode4306
src/hydrogen-instructions.h:4306: ElementsKind element_kind)
nit: for consistency, "elements_kind" (with 's') please.
https://chromiumcodereview.appspot.com/10538002/diff/1/src/hydrogen-instructions.h#newcode4350
src/hydrogen-instructions.h:4350: class SkipCanonicalization: public
BitField<bool, 1, 2> {};
not that it matters, but why use two bits to store this bool?
(the syntax is Bitfield<type, shift, size>)
https://chromiumcodereview.appspot.com/10538002/
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev