mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1332797 - Update our various local patches to apply against tip double-conversion. r=froydnj
--HG-- extra : rebase_source : 6b785879615aea4b9be0c31edb51bc86f8c958f9
This commit is contained in:
parent
bdf8fd6644
commit
dd137bcf96
@ -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());
|
@ -1,10 +1,14 @@
|
||||
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__)
|
||||
-
|
||||
@ -20,10 +24,15 @@ index cd3e330..bdc7d4b 100644
|
||||
-
|
||||
-#else
|
||||
-
|
||||
-#include <stdint.h>
|
||||
-
|
||||
#include <stdint.h>
|
||||
|
||||
-#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))
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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) {
|
Loading…
Reference in New Issue
Block a user