Bug 806538 - Update double-conversion and document the version we are at. r=Waldo.
authorRafael Ávila de Espíndola <respindola@mozilla.com>
Tue, 30 Oct 2012 15:30:08 -0400
changeset 111925 1c6b13fd3b6ad6826d6aeb8c27e293d7d9786696
parent 111924 0a1f5facc2aeb858b5ba472d40d7179aeaeb33a9
child 111926 3ee9ad46c81cbf16a680f5d219593f3ab9aff93e
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersWaldo
bugs806538
milestone19.0a1
Bug 806538 - Update double-conversion and document the version we are at. r=Waldo.
mfbt/double-conversion/double-conversion.cc
mfbt/double-conversion/fast-dtoa.cc
mfbt/double-conversion/more-architectures.patch
mfbt/double-conversion/strtod.cc
mfbt/double-conversion/update.sh
--- a/mfbt/double-conversion/double-conversion.cc
+++ b/mfbt/double-conversion/double-conversion.cc
@@ -157,17 +157,17 @@ void DoubleToStringConverter::CreateDeci
   }
 }
 
 
 bool DoubleToStringConverter::ToShortestIeeeNumber(
     double value,
     StringBuilder* result_builder,
     DoubleToStringConverter::DtoaMode mode) const {
-  assert(mode == SHORTEST || mode == SHORTEST_SINGLE);
+  ASSERT(mode == SHORTEST || mode == SHORTEST_SINGLE);
   if (Double(value).IsSpecial()) {
     return HandleSpecialValues(value, result_builder);
   }
 
   int decimal_point;
   bool sign;
   const int kDecimalRepCapacity = kBase10MaximalLength + 1;
   char decimal_rep[kDecimalRepCapacity];
--- a/mfbt/double-conversion/fast-dtoa.cc
+++ b/mfbt/double-conversion/fast-dtoa.cc
@@ -524,17 +524,17 @@ static bool Grisu3(double v,
   // boundary_minus and boundary_plus are the boundaries between v and its
   // closest floating-point neighbors. Any number strictly between
   // boundary_minus and boundary_plus will round to v when convert to a double.
   // Grisu3 will never output representations that lie exactly on a boundary.
   DiyFp boundary_minus, boundary_plus;
   if (mode == FAST_DTOA_SHORTEST) {
     Double(v).NormalizedBoundaries(&boundary_minus, &boundary_plus);
   } else {
-    assert(mode == FAST_DTOA_SHORTEST_SINGLE);
+    ASSERT(mode == FAST_DTOA_SHORTEST_SINGLE);
     float single_v = static_cast<float>(v);
     Single(single_v).NormalizedBoundaries(&boundary_minus, &boundary_plus);
   }
   ASSERT(boundary_plus.e() == w.e());
   DiyFp ten_mk;  // Cached power of ten: 10^-k
   int mk;        // -k
   int ten_mk_minimal_binary_exponent =
      kMinimalTargetExponent - (w.e() + DiyFp::kSignificandSize);
deleted file mode 100644
--- a/mfbt/double-conversion/more-architectures.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-diff --git a/mfbt/double-conversion/utils.h b/mfbt/double-conversion/utils.h
---- a/mfbt/double-conversion/utils.h
-+++ b/mfbt/double-conversion/utils.h
-@@ -48,20 +48,24 @@
- // An easy way to test if the floating-point operations are correct is to
- // evaluate: 89255.0/1e22. If the floating-point stack is 64 bits wide then
- // the result is equal to 89255e-22.
- // The best way to test this, is to create a division-function and to compare
- // the output of the division with the expected result. (Inlining must be
- // disabled.)
- // On Linux,x86 89255e-22 != Div_double(89255.0/1e22)
- #if defined(_M_X64) || defined(__x86_64__) || \
--    defined(__ARMEL__) || \
-+    defined(__ARMEL__) || defined(__avr32__) || \
-+    defined(__hppa__) || defined(__ia64__) || \
-+    defined(__mips__) || defined(__powerpc__) || \
-+    defined(__sparc__) || defined(__sparc) || defined(__s390__) || \
-+    defined(__SH4__) || defined(__alpha__) || \
-     defined(_MIPS_ARCH_MIPS32R2)
- #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
--#elif defined(_M_IX86) || defined(__i386__)
-+#elif defined(_M_IX86) || defined(__i386__) || defined(__i386)
- #if defined(_WIN32)
- // Windows uses a 64bit wide floating point stack.
- #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
- #else
- #undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS
- #endif  // _WIN32
- #else
- #error Target architecture was not detected as supported by Double-Conversion.
--- a/mfbt/double-conversion/strtod.cc
+++ b/mfbt/double-conversion/strtod.cc
@@ -510,25 +510,25 @@ float Strtof(Vector<const char> buffer, 
   float f3 = static_cast<float>(double_next);
   float f4;
   if (is_correct) {
     f4 = f3;
   } else {
     double double_next2 = Double(double_next).NextDouble();
     f4 = static_cast<float>(double_next2);
   }
-  assert(f1 <= f2 && f2 <= f3 && f3 <= f4);
+  ASSERT(f1 <= f2 && f2 <= f3 && f3 <= f4);
 
   // If the guess doesn't lie near a single-precision boundary we can simply
   // return its float-value.
-  if ((f1 == f4)) {
+  if (f1 == f4) {
     return float_guess;
   }
 
-  assert((f1 != f2 && f2 == f3 && f3 == f4) ||
+  ASSERT((f1 != f2 && f2 == f3 && f3 == f4) ||
          (f1 == f2 && f2 != f3 && f3 == f4) ||
          (f1 == f2 && f2 == f3 && f3 != f4));
 
   // guess and next are the two possible canditates (in the same way that
   // double_guess was the lower candidate for a double-precision guess).
   float guess = f1;
   float next = f4;
   DiyFp upper_boundary;
--- a/mfbt/double-conversion/update.sh
+++ b/mfbt/double-conversion/update.sh
@@ -1,17 +1,20 @@
 # Usage: ./update.sh <double-conversion-src-directory>
 #
 # Copies the needed files from a directory containing the original
 # double-conversion source that we need.
 
+# This was last updated with git rev e5b34421b763f7bf7e4f9081403db417d5a55a36.
+
+set -e
+
 cp $1/LICENSE ./
 cp $1/README ./
 
 # Includes
 cp $1/src/*.h ./
 
 # Source
 cp $1/src/*.cc ./
 
 patch -p3 < add-mfbt-api-markers.patch
 patch -p3 < use-StandardInteger.patch
-patch -p3 < more-architectures.patch