Bug 614188 - Part 1: setup mfbt/double-conversion; r=Waldo
authorNathan Froyd <froydnj@mozilla.com>
Mon, 19 Mar 2012 12:21:05 -0400
changeset 94850 463626bffba7aa5a7a92649e304c2da5f6a11735
parent 94849 7598b32483f907560acbd4e52494aa8d286e3e8c
child 94851 1603db611224f1218797820f120f063791293ca7
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersWaldo
bugs614188
milestone14.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 614188 - Part 1: setup mfbt/double-conversion; r=Waldo
mfbt/double-conversion/add-mfbt-api-markers.patch
mfbt/double-conversion/update.sh
mfbt/double-conversion/use-StandardInteger.patch
new file mode 100644
--- /dev/null
+++ b/mfbt/double-conversion/add-mfbt-api-markers.patch
@@ -0,0 +1,109 @@
+diff --git a/mfbt/double-conversion/double-conversion.h b/mfbt/double-conversion/double-conversion.h
+index f98edae..e536a01 100644
+--- a/mfbt/double-conversion/double-conversion.h
++++ b/mfbt/double-conversion/double-conversion.h
+@@ -28,6 +28,7 @@
+ #ifndef DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
+ #define DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
+ 
++#include "mozilla/Types.h"
+ #include "utils.h"
+ 
+ namespace double_conversion {
+@@ -129,7 +130,7 @@ class DoubleToStringConverter {
+   }
+ 
+   // Returns a converter following the EcmaScript specification.
+-  static const DoubleToStringConverter& EcmaScriptConverter();
++  static MFBT_API(const DoubleToStringConverter&) EcmaScriptConverter();
+ 
+   // Computes the shortest string of digits that correctly represent the input
+   // number. Depending on decimal_in_shortest_low and decimal_in_shortest_high
+@@ -154,12 +155,12 @@ class DoubleToStringConverter {
+   // Returns true if the conversion succeeds. The conversion always succeeds
+   // except when the input value is special and no infinity_symbol or
+   // nan_symbol has been given to the constructor.
+-  bool ToShortest(double value, StringBuilder* result_builder) const {
++  MFBT_API(bool) ToShortest(double value, StringBuilder* result_builder) const {
+     return ToShortestIeeeNumber(value, result_builder, SHORTEST);
+   }
+ 
+   // Same as ToShortest, but for single-precision floats.
+-  bool ToShortestSingle(float value, StringBuilder* result_builder) const {
++  MFBT_API(bool) ToShortestSingle(float value, StringBuilder* result_builder) const {
+     return ToShortestIeeeNumber(value, result_builder, SHORTEST_SINGLE);
+   }
+ 
+@@ -197,7 +198,7 @@ class DoubleToStringConverter {
+   // The last two conditions imply that the result will never contain more than
+   // 1 + kMaxFixedDigitsBeforePoint + 1 + kMaxFixedDigitsAfterPoint characters
+   // (one additional character for the sign, and one for the decimal point).
+-  bool ToFixed(double value,
++  MFBT_API(bool) ToFixed(double value,
+                int requested_digits,
+                StringBuilder* result_builder) const;
+ 
+@@ -229,7 +230,7 @@ class DoubleToStringConverter {
+   // kMaxExponentialDigits + 8 characters (the sign, the digit before the
+   // decimal point, the decimal point, the exponent character, the
+   // exponent's sign, and at most 3 exponent digits).
+-  bool ToExponential(double value,
++  MFBT_API(bool) ToExponential(double value,
+                      int requested_digits,
+                      StringBuilder* result_builder) const;
+ 
+@@ -267,7 +268,7 @@ class DoubleToStringConverter {
+   // The last condition implies that the result will never contain more than
+   // kMaxPrecisionDigits + 7 characters (the sign, the decimal point, the
+   // exponent character, the exponent's sign, and at most 3 exponent digits).
+-  bool ToPrecision(double value,
++  MFBT_API(bool) ToPrecision(double value,
+                    int precision,
+                    StringBuilder* result_builder) const;
+ 
+@@ -292,7 +293,7 @@ class DoubleToStringConverter {
+   // kBase10MaximalLength.
+   // Note that DoubleToAscii null-terminates its input. So the given buffer
+   // should be at least kBase10MaximalLength + 1 characters long.
+-  static const int kBase10MaximalLength = 17;
++  static const MFBT_DATA(int) kBase10MaximalLength = 17;
+ 
+   // Converts the given double 'v' to ascii. 'v' must not be NaN, +Infinity, or
+   // -Infinity. In SHORTEST_SINGLE-mode this restriction also applies to 'v'
+@@ -332,7 +333,7 @@ class DoubleToStringConverter {
+   // terminating null-character when computing the maximal output size.
+   // The given length is only used in debug mode to ensure the buffer is big
+   // enough.
+-  static void DoubleToAscii(double v,
++  static MFBT_API(void) DoubleToAscii(double v,
+                             DtoaMode mode,
+                             int requested_digits,
+                             char* buffer,
+@@ -343,7 +344,7 @@ class DoubleToStringConverter {
+ 
+  private:
+   // Implementation for ToShortest and ToShortestSingle.
+-  bool ToShortestIeeeNumber(double value,
++  MFBT_API(bool) ToShortestIeeeNumber(double value,
+                             StringBuilder* result_builder,
+                             DtoaMode mode) const;
+ 
+@@ -351,15 +352,15 @@ class DoubleToStringConverter {
+   // corresponding string using the configured infinity/nan-symbol.
+   // If either of them is NULL or the value is not special then the
+   // function returns false.
+-  bool HandleSpecialValues(double value, StringBuilder* result_builder) const;
++  MFBT_API(bool) HandleSpecialValues(double value, StringBuilder* result_builder) const;
+   // Constructs an exponential representation (i.e. 1.234e56).
+   // The given exponent assumes a decimal point after the first decimal digit.
+-  void CreateExponentialRepresentation(const char* decimal_digits,
++  MFBT_API(void) CreateExponentialRepresentation(const char* decimal_digits,
+                                        int length,
+                                        int exponent,
+                                        StringBuilder* result_builder) const;
+   // Creates a decimal representation (i.e 1234.5678).
+-  void CreateDecimalRepresentation(const char* decimal_digits,
++  MFBT_API(void) CreateDecimalRepresentation(const char* decimal_digits,
+                                    int length,
+                                    int decimal_point,
+                                    int digits_after_point,
new file mode 100755
--- /dev/null
+++ b/mfbt/double-conversion/update.sh
@@ -0,0 +1,16 @@
+# Usage: ./update.sh <double-conversion-src-directory>
+#
+# Copies the needed files from a directory containing the original
+# double-conversion source that we need.
+
+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 < useStandardInteger.patch
new file mode 100644
--- /dev/null
+++ b/mfbt/double-conversion/use-StandardInteger.patch
@@ -0,0 +1,29 @@
+diff --git a/mfbt/double-conversion/utils.h b/mfbt/double-conversion/utils.h
+index cd3e330..bdc7d4b 100644
+--- a/mfbt/double-conversion/utils.h
++++ b/mfbt/double-conversion/utils.h
+@@ -68,23 +68,7 @@
+ #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>
+-
+-#endif
++#include "mozilla/StandardInteger.h"
+ 
+ // The following macro works on both 32 and 64-bit platforms.
+ // Usage: instead of writing 0x1234567890123456