Bug 918350 - Change UnspecifiedNaN's bit pattern to be the all-ones NaN. r=waldo
authorDan Gohman <sunfish@google.com>
Thu, 19 Sep 2013 18:47:55 -0700
changeset 162799 d0888eb399ec6efaf501b84f23413c1173ffd0ac
parent 162798 141c61d174ee681c8b93541f2ce8a6efa4607ee6
child 162800 5953301b310c4ddb9501114a25c9136e5d6ccc36
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswaldo
bugs918350
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 918350 - Change UnspecifiedNaN's bit pattern to be the all-ones NaN. r=waldo
mfbt/FloatingPoint.h
--- a/mfbt/FloatingPoint.h
+++ b/mfbt/FloatingPoint.h
@@ -185,17 +185,23 @@ DoubleIsInt32(double d, int32_t* i)
 
 /**
  * Computes a NaN value.  Do not use this method if you depend upon a particular
  * NaN value being returned.
  */
 static MOZ_ALWAYS_INLINE double
 UnspecifiedNaN()
 {
-  return SpecificNaN(0, 0xfffffffffffffULL);
+  /*
+   * If we can use any quiet NaN, we might as well use the all-ones NaN,
+   * since it's cheap to materialize on common platforms (such as x64, where
+   * this value can be represented in a 32-bit signed immediate field, allowing
+   * it to be stored to memory in a single instruction).
+   */
+  return SpecificNaN(1, 0xfffffffffffffULL);
 }
 
 /**
  * Compare two doubles for equality, *without* equating -0 to +0, and equating
  * any NaN value to any other NaN value.  (The normal equality operators equate
  * -0 with +0, and they equate NaN to no other value.)
  */
 static inline bool