Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Unified Diff: src/crankshaft/hydrogen-instructions.cc

Issue 2652553003: Access double fields in C++ as uint64_t fields to preserve signaling bit of a NaN. (Closed)
Patch Set: More fixes Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/crankshaft/hydrogen-instructions.h ('k') | src/factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/hydrogen-instructions.cc
diff --git a/src/crankshaft/hydrogen-instructions.cc b/src/crankshaft/hydrogen-instructions.cc
index be1ac9a18c2f2a2a87f8ffca3054c693663a74c4..26bbf2fcd374a2914446acd2c547b8e963c5d7b7 100644
--- a/src/crankshaft/hydrogen-instructions.cc
+++ b/src/crankshaft/hydrogen-instructions.cc
@@ -2177,6 +2177,11 @@ HConstant::HConstant(Special special)
InstanceTypeField::encode(kUnknownInstanceType)),
int32_value_(0) {
DCHECK_EQ(kHoleNaN, special);
+ // Manipulating the signaling NaN used for the hole in C++, e.g. with bit_cast
+ // will change its value on ia32 (the x87 stack is used to return values
+ // and stores to the stack silently clear the signalling bit).
+ // Therefore we have to use memcpy for initializing |double_value_| with
+ // kHoleNanInt64 here.
std::memcpy(&double_value_, &kHoleNanInt64, sizeof(double_value_));
Initialize(Representation::Double());
}
« no previous file with comments | « src/crankshaft/hydrogen-instructions.h ('k') | src/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698