Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 67e508f02d438ec7c49473370d9ba5043c7e97ba..87aa471e34b99e7ed575a61764caa4e0ce02bef4 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -1701,22 +1701,7 @@ void HeapObject::IterateBody(InstanceType type, int object_size, |
bool HeapNumber::HeapNumberBooleanValue() { |
- // NaN, +0, and -0 should return the false object |
-#if __BYTE_ORDER == __LITTLE_ENDIAN |
- union IeeeDoubleLittleEndianArchType u; |
-#elif __BYTE_ORDER == __BIG_ENDIAN |
- union IeeeDoubleBigEndianArchType u; |
-#endif |
- u.d = value(); |
- if (u.bits.exp == 2047) { |
- // Detect NaN for IEEE double precision floating point. |
- if ((u.bits.man_low | u.bits.man_high) != 0) return false; |
- } |
- if (u.bits.exp == 0) { |
- // Detect +0, and -0 for IEEE double precision floating point. |
- if ((u.bits.man_low | u.bits.man_high) == 0) return false; |
- } |
- return true; |
+ return DoubleToBoolean(value()); |
} |
@@ -9362,29 +9347,7 @@ bool String::ComputeArrayIndex(uint32_t* index) { |
if (length == 0 || length > kMaxArrayIndexSize) return false; |
ConsStringIteratorOp op; |
StringCharacterStream stream(this, &op); |
- uint16_t ch = stream.GetNext(); |
- |
- // If the string begins with a '0' character, it must only consist |
- // of it to be a legal array index. |
- if (ch == '0') { |
- *index = 0; |
- return length == 1; |
- } |
- |
- // Convert string to uint32 array index; character by character. |
- int d = ch - '0'; |
- if (d < 0 || d > 9) return false; |
- uint32_t result = d; |
- while (stream.HasMore()) { |
- d = stream.GetNext() - '0'; |
- if (d < 0 || d > 9) return false; |
- // Check that the new result is below the 32 bit limit. |
- if (result > 429496729U - ((d > 5) ? 1 : 0)) return false; |
- result = (result * 10) + d; |
- } |
- |
- *index = result; |
- return true; |
+ return StringToArrayIndex(&stream, index); |
} |