Revision: 2557
Author: [email protected]
Date: Tue Jul 28 05:50:58 2009
Log: Change custom NaN check to use isnan to fix pixel array
failures on ARM hardware.
Review URL: http://codereview.chromium.org/160269
http://code.google.com/p/v8/source/detail?r=2557
Modified:
/branches/bleeding_edge/src/objects.cc
=======================================
--- /branches/bleeding_edge/src/objects.cc Tue Jul 28 02:05:05 2009
+++ /branches/bleeding_edge/src/objects.cc Tue Jul 28 05:50:58 2009
@@ -7060,20 +7060,16 @@
if (value->IsSmi()) {
int_value = Smi::cast(value)->value();
} else if (value->IsHeapNumber()) {
- static const DoubleRepresentation nan(OS::nan_value());
- DoubleRepresentation double_value = HeapNumber::cast(value)->value();
- if (nan.bits != double_value.bits) {
- int_value = static_cast<int>(double_value.value + 0.5);
- } else {
- // NaN clamps to zero.
- int_value = 0;
- }
- } else if (value->IsUndefined()) {
- int_value = 0;
+ double double_value = HeapNumber::cast(value)->value();
+ if (!isnan(double_value)) {
+ // NaN clamps to zero (default). Other doubles are rounded to
+ // the nearest integer.
+ int_value = static_cast<int>(double_value + 0.5);
+ }
} else {
- // All other types have been converted to a number type further up
in the
- // call chain.
- UNREACHABLE();
+ // Clamp undefined to zero (default). All other types have been
+ // converted to a number type further up in the call chain.
+ ASSERT(value->IsUndefined());
}
if (int_value < 0) {
clamped_value = 0;
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---