It appears that the v8::Value::IsInt32() test (and presumably isUint32(),
but I haven't verified) is returning true for -0 (negative zero).
This was noticed in serialization code like this:
... if (value->IsInt32()) {
write_optimized_int32(value->Int32Value());
} else if (value->IsNumber())
write_unoptimized_double(value.As<v8::Number()->Value());
} ...
Negative zero doesn't round-trip - it needs the double path.
(In the following, assume "egal" in the
http://wiki.ecmascript.org/doku.php?id=harmony:egal sense)
Three obvious fixes are (1) change v8's IsInt32 to return false for -0,
(2) introduce a "is this egal to its int32 representation?" test in v8,
(3) change the calling code to verify that the Int32 value is egal to its
double value (or just special case -0)
I assume that #1 is undesirable as a breaking change (and I agree) and
adding #2 is undesirable as an unimportant API to maintain (and I agree),
and plan to proceed with #3. Any disagreement?
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users