Commit 85ed0097 authored by dusan.milosavljevic's avatar dusan.milosavljevic Committed by Commit bot

Make SNaN verification universal for all arches.

The mips HW prior to revision 5 has opposite encoding for NaNs.

TEST=mjsunit/regress/*, regress-1167, regress-undefined-nan2
BUG=

Review URL: https://codereview.chromium.org/912833003

Cr-Commit-Position: refs/heads/master@{#26568}
parent 41e74ad4
......@@ -390,8 +390,12 @@ void FixedDoubleArray::FixedDoubleArrayVerify() {
for (int i = 0; i < length(); i++) {
if (!is_the_hole(i)) {
uint64_t value = get_representation(i);
CHECK((value & V8_UINT64_C(0x7FF8000000000000)) !=
V8_UINT64_C(0x7FF0000000000000) ||
uint64_t unexpected =
bit_cast<uint64_t>(std::numeric_limits<double>::quiet_NaN()) &
V8_UINT64_C(0x7FF8000000000000);
// Create implementation specific sNaN by inverting relevant bit.
unexpected ^= V8_UINT64_C(0x0008000000000000);
CHECK((value & V8_UINT64_C(0x7FF8000000000000)) != unexpected ||
(value & V8_UINT64_C(0x0007FFFFFFFFFFFF)) == V8_UINT64_C(0));
}
}
......
......@@ -2335,7 +2335,7 @@ void FixedDoubleArray::set(int index, double value) {
map() != GetHeap()->fixed_array_map());
int offset = kHeaderSize + index * kDoubleSize;
if (std::isnan(value)) {
WRITE_UINT64_FIELD(this, offset, V8_UINT64_C(0xFFFFFFFFFFFFFFFF));
WRITE_DOUBLE_FIELD(this, offset, std::numeric_limits<double>::quiet_NaN());
} else {
WRITE_DOUBLE_FIELD(this, offset, value);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment