Reviewers: Kevin Millikin,

Description:
Check for negative 0 when deciding whether a constant has type Integer32.

[email protected],

Committed: http://code.google.com/p/v8/source/detail?r=4258

Please review this at http://codereview.chromium.org/1225005

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  M     src/number-info.h


Index: src/number-info.h
===================================================================
--- src/number-info.h   (revision 4257)
+++ src/number-info.h   (working copy)
@@ -115,8 +115,12 @@

   // Integer32 is an integer that can be represented as either a signed
   // 32-bit integer or as an unsigned 32-bit integer. It has to be
-  // in the range [-2^31, 2^32 - 1].
+  // in the range [-2^31, 2^32 - 1]. We also have to check for negative 0
+  // as it is not an Integer32.
   static inline bool IsInt32Double(double value) {
+    const DoubleRepresentation minus_zero(-0.0);
+    DoubleRepresentation rep(value);
+    if (rep.bits == minus_zero.bits) return false;
     if (value >= kMinInt && value <= kMaxUInt32) {
       if (value <= kMaxInt && value == static_cast<int32_t>(value)) {
         return true;


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

To unsubscribe from this group, send email to v8-dev+unsubscribegooglegroups.com or reply 
to this email with the words "REMOVE ME" as the subject.

Reply via email to