Bug 1332797 - Update our various local patches to apply against tip double-conversion. r=froydnj
authorJeff Walden <jwalden@mit.edu>
Tue, 24 Jan 2017 09:29:47 -0800
changeset 331780 95241d9562211604b5b55c16fcd2db10947e837c
parent 331779 3862719c38c5af9014b317d38aea5ae9981d4634
child 331781 e0f0f124580c62ec2970ba07ecf27f2e9d61b53c
push id31286
push usercbook@mozilla.com
push dateTue, 31 Jan 2017 14:54:46 +0000
treeherdermozilla-central@b47946b2076f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1332797
milestone54.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 1332797 - Update our various local patches to apply against tip double-conversion. r=froydnj
mfbt/double-conversion/fix-Wshadow-issues.patch
mfbt/double-conversion/use-StandardInteger.patch
mfbt/double-conversion/use-mozilla-assertions.patch
mfbt/double-conversion/use-static_assert.patch
deleted file mode 100644
--- a/mfbt/double-conversion/fix-Wshadow-issues.patch
+++ /dev/null
@@ -1,85 +0,0 @@
-diff --git a/mfbt/double-conversion/source/strtod.cc b/mfbt/double-conversion/source/strtod.cc
---- a/mfbt/double-conversion/source/strtod.cc
-+++ b/mfbt/double-conversion/source/strtod.cc
-@@ -510,16 +510,17 @@ 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);
-   }
-+  (void) f2; // Mark variable as used.
-   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) {
-     return float_guess;
-   }
- 
-diff --git a/mfbt/double-conversion/source/utils.h b/mfbt/double-conversion/source/utils.h
---- a/mfbt/double-conversion/source/utils.h
-+++ b/mfbt/double-conversion/source/utils.h
-@@ -55,17 +55,17 @@
- #if defined(_M_X64) || defined(__x86_64__) || \
-     defined(__ARMEL__) || defined(__avr32__) || \
-     defined(__hppa__) || defined(__ia64__) || \
-     defined(__mips__) || \
-     defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) || \
-     defined(__sparc__) || defined(__sparc) || defined(__s390__) || \
-     defined(__SH4__) || defined(__alpha__) || \
-     defined(_MIPS_ARCH_MIPS32R2) || \
--    defined(_AARCH64EL_)
-+    defined(__AARCH64EL__) || defined(__aarch64__)
- #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
- #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
-@@ -136,18 +136,18 @@ inline int StrLength(const char* string)
-   return static_cast<int>(length);
- }
- 
- // This is a simplified version of V8's Vector class.
- template <typename T>
- class Vector {
-  public:
-   Vector() : start_(NULL), length_(0) {}
--  Vector(T* data, int length) : start_(data), length_(length) {
--    ASSERT(length == 0 || (length > 0 && data != NULL));
-+  Vector(T* data, int len) : start_(data), length_(len) {
-+    ASSERT(len == 0 || (len > 0 && data != NULL));
-   }
- 
-   // Returns a vector using the same backing storage as this one,
-   // spanning from and including 'from', to but not including 'to'.
-   Vector<T> SubVector(int from, int to) {
-     ASSERT(to <= length_);
-     ASSERT(from < to);
-     ASSERT(0 <= from);
-@@ -179,18 +179,18 @@ class Vector {
- };
- 
- 
- // Helper class for building result strings in a character buffer. The
- // purpose of the class is to use safe operations that checks the
- // buffer bounds on all operations in debug mode.
- class StringBuilder {
-  public:
--  StringBuilder(char* buffer, int size)
--      : buffer_(buffer, size), position_(0) { }
-+  StringBuilder(char* buffer, int buffer_size)
-+      : buffer_(buffer, buffer_size), position_(0) { }
- 
-   ~StringBuilder() { if (!is_finalized()) Finalize(); }
- 
-   int size() const { return buffer_.length(); }
- 
-   // Get the current position in the builder.
-   int position() const {
-     ASSERT(!is_finalized());
--- a/mfbt/double-conversion/use-StandardInteger.patch
+++ b/mfbt/double-conversion/use-StandardInteger.patch
@@ -1,29 +1,38 @@
 diff --git a/mfbt/double-conversion/source/utils.h b/mfbt/double-conversion/source/utils.h
-index cd3e330..bdc7d4b 100644
 --- a/mfbt/double-conversion/source/utils.h
 +++ b/mfbt/double-conversion/source/utils.h
-@@ -74,23 +74,7 @@
+@@ -93,34 +93,18 @@ inline void abort_noreturn() { abort(); 
  #endif
  
+ #if defined(__GNUC__)
+ #define DOUBLE_CONVERSION_UNUSED __attribute__((unused))
+ #else
+ #define DOUBLE_CONVERSION_UNUSED
+ #endif
  
 -#if defined(_WIN32) && !defined(__MINGW32__)
 -
 -typedef signed char int8_t;
 -typedef unsigned char uint8_t;
 -typedef short int16_t;  // NOLINT
 -typedef unsigned short uint16_t;  // NOLINT
 -typedef int int32_t;
 -typedef unsigned int uint32_t;
 -typedef __int64 int64_t;
 -typedef unsigned __int64 uint64_t;
 -// intptr_t and friends are defined in crtdefs.h through stdio.h.
 -
 -#else
 -
--#include <stdint.h>
+ #include <stdint.h>
+ 
+-#endif
 -
--#endif
-+#include <stdint.h>
+ typedef uint16_t uc16;
  
  // The following macro works on both 32 and 64-bit platforms.
  // Usage: instead of writing 0x1234567890123456
+ //      write UINT64_2PART_C(0x12345678,90123456);
+ #define UINT64_2PART_C(a, b) (((static_cast<uint64_t>(a) << 32) + 0x##b##u))
+ 
+ 
--- a/mfbt/double-conversion/use-mozilla-assertions.patch
+++ b/mfbt/double-conversion/use-mozilla-assertions.patch
@@ -1,23 +1,47 @@
 diff --git a/mfbt/double-conversion/source/utils.h b/mfbt/double-conversion/source/utils.h
 --- a/mfbt/double-conversion/source/utils.h
 +++ b/mfbt/double-conversion/source/utils.h
-@@ -31,15 +31,15 @@
+@@ -26,38 +26,38 @@
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ 
+ #ifndef DOUBLE_CONVERSION_UTILS_H_
+ #define DOUBLE_CONVERSION_UTILS_H_
+ 
  #include <stdlib.h>
  #include <string.h>
  
 -#include <assert.h>
 +#include "mozilla/Assertions.h"
  #ifndef ASSERT
--#define ASSERT(condition)      (assert(condition))
-+#define ASSERT(condition)      MOZ_ASSERT(condition)
+ #define ASSERT(condition)         \
+-    assert(condition);
++    MOZ_ASSERT(condition)
  #endif
  #ifndef UNIMPLEMENTED
 -#define UNIMPLEMENTED() (abort())
 +#define UNIMPLEMENTED() MOZ_CRASH()
  #endif
+ #ifndef DOUBLE_CONVERSION_NO_RETURN
+ #ifdef _MSC_VER
+ #define DOUBLE_CONVERSION_NO_RETURN __declspec(noreturn)
+ #else
+ #define DOUBLE_CONVERSION_NO_RETURN __attribute__((noreturn))
+ #endif
+ #endif
  #ifndef UNREACHABLE
+ #ifdef _MSC_VER
+ void DOUBLE_CONVERSION_NO_RETURN abort_noreturn();
+-inline void abort_noreturn() { abort(); }
++inline void abort_noreturn() { MOZ_CRASH(); }
+ #define UNREACHABLE()   (abort_noreturn())
+ #else
 -#define UNREACHABLE()   (abort())
 +#define UNREACHABLE()   MOZ_CRASH()
  #endif
+ #endif
+ 
  
  // Double operations detection based on target architecture.
+ // Linux uses a 80bit wide floating point stack on x86. This induces double
+ // rounding, which in turn leads to wrong results.
+ // An easy way to test if the floating-point operations are correct is to
deleted file mode 100644
--- a/mfbt/double-conversion/use-static_assert.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-diff --git a/mfbt/double-conversion/source/utils.h b/mfbt/double-conversion/source/utils.h
---- a/mfbt/double-conversion/source/utils.h
-+++ b/mfbt/double-conversion/source/utils.h
-@@ -275,19 +275,18 @@ class StringBuilder {
- // There is an additional use for BitCast.
- // Recent gccs will warn when they see casts that may result in breakage due to
- // the type-based aliasing rule.  If you have checked that there is no breakage
- // you can use BitCast to cast one pointer type to another.  This confuses gcc
- // enough that it can no longer see that you have cast one pointer type to
- // another thus avoiding the warning.
- template <class Dest, class Source>
- inline Dest BitCast(const Source& source) {
--  // Compile time assertion: sizeof(Dest) == sizeof(Source)
--  // A compile error here means your Dest and Source have different sizes.
--  typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1];
-+  static_assert(sizeof(Dest) == sizeof(Source),
-+                "BitCast's source and destination types must be the same size");
- 
-   Dest dest;
-   memmove(&dest, &source, sizeof(dest));
-   return dest;
- }
- 
- template <class Dest, class Source>
- inline Dest BitCast(Source* source) {