зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1245414, part 7 - Update mfbt/decimal/to-moz-dependencies.patch. r=Waldo
--HG-- extra : rebase_source : e79b2009d89c8921f632f7ebc5bfb908b5444523
This commit is contained in:
Родитель
b8a0bc7f14
Коммит
66a8428e62
|
@ -33,6 +33,8 @@
|
|||
|
||||
#define ASSERT_NOT_REACHED() MOZ_ASSERT_UNREACHABLE("moz-decimal-utils.h")
|
||||
|
||||
#define STACK_ALLOCATED() DISALLOW_NEW()
|
||||
|
||||
#define WTF_MAKE_NONCOPYABLE(ClassName) \
|
||||
private: \
|
||||
ClassName(const ClassName&) = delete; \
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
diff --git a/mfbt/decimal/Decimal.cpp b/mfbt/decimal/Decimal.cpp
|
||||
--- a/mfbt/decimal/Decimal.cpp
|
||||
+++ b/mfbt/decimal/Decimal.cpp
|
||||
@@ -23,26 +23,23 @@
|
||||
@@ -23,22 +23,20 @@
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
|
@ -10,29 +10,26 @@ diff --git a/mfbt/decimal/Decimal.cpp b/mfbt/decimal/Decimal.cpp
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
-#include "config.h"
|
||||
#include "Decimal.h"
|
||||
-#include "platform/Decimal.h"
|
||||
+#include "Decimal.h"
|
||||
+#include "moz-decimal-utils.h"
|
||||
|
||||
-#include "wtf/Allocator.h"
|
||||
-#include "wtf/MathExtras.h"
|
||||
-#include "wtf/Noncopyable.h"
|
||||
-#include "wtf/text/StringBuilder.h"
|
||||
+using namespace moz_decimal_utils;
|
||||
|
||||
#include <algorithm>
|
||||
#include <float.h>
|
||||
|
||||
-#include <wtf/Assertions.h>
|
||||
-#include <wtf/MathExtras.h>
|
||||
-#include <wtf/Noncopyable.h>
|
||||
-#include <wtf/text/StringBuilder.h>
|
||||
+using namespace moz_decimal_utils;
|
||||
|
||||
namespace WebCore {
|
||||
namespace blink {
|
||||
|
||||
namespace DecimalPrivate {
|
||||
|
||||
static int const ExponentMax = 1023;
|
||||
static int const ExponentMin = -1023;
|
||||
static int const Precision = 18;
|
||||
@@ -685,17 +682,17 @@ Decimal Decimal::floor() const
|
||||
result += 1;
|
||||
}
|
||||
@@ -690,17 +688,17 @@ Decimal Decimal::floor() const
|
||||
if (isNegative() && !isMultiplePowersOfTen(m_data.coefficient(), numberOfDropDigits))
|
||||
++result;
|
||||
return Decimal(sign(), 0, result);
|
||||
}
|
||||
|
||||
|
@ -49,7 +46,7 @@ diff --git a/mfbt/decimal/Decimal.cpp b/mfbt/decimal/Decimal.cpp
|
|||
}
|
||||
|
||||
Decimal Decimal::fromString(const String& str)
|
||||
@@ -937,17 +934,17 @@ Decimal Decimal::round() const
|
||||
@@ -931,17 +929,17 @@ Decimal Decimal::round() const
|
||||
result /= 10;
|
||||
return Decimal(sign(), 0, result);
|
||||
}
|
||||
|
@ -68,7 +65,7 @@ diff --git a/mfbt/decimal/Decimal.cpp b/mfbt/decimal/Decimal.cpp
|
|||
|
||||
return std::numeric_limits<double>::quiet_NaN();
|
||||
}
|
||||
@@ -990,17 +987,17 @@ String Decimal::toString() const
|
||||
@@ -984,17 +982,17 @@ String Decimal::toString() const
|
||||
++coefficient;
|
||||
|
||||
while (originalExponent < 0 && coefficient && !(coefficient % 10)) {
|
||||
|
@ -87,7 +84,7 @@ diff --git a/mfbt/decimal/Decimal.cpp b/mfbt/decimal/Decimal.cpp
|
|||
return builder.toString();
|
||||
}
|
||||
|
||||
@@ -1032,15 +1029,28 @@ String Decimal::toString() const
|
||||
@@ -1026,14 +1024,27 @@ String Decimal::toString() const
|
||||
if (adjustedExponent) {
|
||||
builder.append(adjustedExponent < 0 ? "e" : "e+");
|
||||
builder.appendNumber(adjustedExponent);
|
||||
|
@ -114,12 +111,11 @@ diff --git a/mfbt/decimal/Decimal.cpp b/mfbt/decimal/Decimal.cpp
|
|||
return Decimal(EncodedData(sign, EncodedData::ClassZero));
|
||||
}
|
||||
|
||||
} // namespace WebCore
|
||||
|
||||
} // namespace blink
|
||||
diff --git a/mfbt/decimal/Decimal.h b/mfbt/decimal/Decimal.h
|
||||
--- a/mfbt/decimal/Decimal.h
|
||||
+++ b/mfbt/decimal/Decimal.h
|
||||
@@ -23,24 +23,41 @@
|
||||
@@ -23,26 +23,49 @@
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
|
@ -130,8 +126,8 @@ diff --git a/mfbt/decimal/Decimal.h b/mfbt/decimal/Decimal.h
|
|||
|
||||
+/**
|
||||
+ * Imported from:
|
||||
+ * http://src.chromium.org/viewvc/blink/trunk/Source/core/platform/Decimal.h
|
||||
+ * Check hg log for the svn rev of the last update from Blink core.
|
||||
+ * https://chromium.googlesource.com/chromium/src.git/+/master/third_party/WebKit/Source/platform/Decimal.h
|
||||
+ * Check UPSTREAM-GIT-SHA for the commit ID of the last update from Blink core.
|
||||
+ */
|
||||
+
|
||||
#ifndef Decimal_h
|
||||
|
@ -141,9 +137,11 @@ diff --git a/mfbt/decimal/Decimal.h b/mfbt/decimal/Decimal.h
|
|||
+#include <stdint.h>
|
||||
#include "mozilla/Types.h"
|
||||
|
||||
-#include "platform/PlatformExport.h"
|
||||
-#include "wtf/Allocator.h"
|
||||
-#include "wtf/Assertions.h"
|
||||
-#include "wtf/text/WTFString.h"
|
||||
-#include <stdint.h>
|
||||
-#include <wtf/Assertions.h>
|
||||
-#include <wtf/text/WTFString.h>
|
||||
+#include <string>
|
||||
+
|
||||
+#ifndef ASSERT
|
||||
|
@ -151,22 +149,30 @@ diff --git a/mfbt/decimal/Decimal.h b/mfbt/decimal/Decimal.h
|
|||
+#define ASSERT MOZ_ASSERT
|
||||
+#endif
|
||||
+
|
||||
+// To use WTF_MAKE_FAST_ALLOCATED we'd need:
|
||||
+// http://src.chromium.org/viewvc/blink/trunk/Source/wtf/FastMalloc.h
|
||||
+#define PLATFORM_EXPORT
|
||||
+
|
||||
+// To use USING_FAST_MALLOC we'd need:
|
||||
+// https://chromium.googlesource.com/chromium/src.git/+/master/third_party/WebKit/Source/wtf/Allocator.h
|
||||
+// Since we don't allocate Decimal objects, no need.
|
||||
+#define WTF_MAKE_FAST_ALLOCATED \
|
||||
+#define USING_FAST_MALLOC(type) \
|
||||
+ void ignore_this_dummy_method() = delete
|
||||
+
|
||||
+#define DISALLOW_NEW() \
|
||||
+ private: \
|
||||
+ void* operator new(size_t) = delete; \
|
||||
+ void* operator new(size_t, void*) = delete; \
|
||||
+ public:
|
||||
|
||||
namespace WebCore {
|
||||
namespace blink {
|
||||
|
||||
namespace DecimalPrivate {
|
||||
class SpecialValueHandler;
|
||||
}
|
||||
|
||||
// This class represents decimal base floating point number.
|
||||
@@ -136,27 +153,28 @@ public:
|
||||
@@ -139,27 +162,28 @@ public:
|
||||
MFBT_API Decimal abs() const;
|
||||
MFBT_API Decimal ceiling() const;
|
||||
MFBT_API Decimal ceil() const;
|
||||
MFBT_API Decimal floor() const;
|
||||
MFBT_API Decimal remainder(const Decimal&) const;
|
||||
MFBT_API Decimal round() const;
|
||||
|
@ -195,20 +201,20 @@ diff --git a/mfbt/decimal/Decimal.h b/mfbt/decimal/Decimal.h
|
|||
MFBT_API explicit Decimal(const EncodedData&);
|
||||
const EncodedData& value() const { return m_data; }
|
||||
|
||||
@@ -175,10 +193,21 @@ private:
|
||||
@@ -178,9 +202,20 @@ private:
|
||||
|
||||
Sign sign() const { return m_data.sign(); }
|
||||
|
||||
EncodedData m_data;
|
||||
};
|
||||
|
||||
} // namespace WebCore
|
||||
} // namespace blink
|
||||
|
||||
+namespace mozilla {
|
||||
+ typedef WebCore::Decimal Decimal;
|
||||
+}
|
||||
+typedef blink::Decimal Decimal;
|
||||
+} // namespace mozilla
|
||||
+
|
||||
+#undef WTF_MAKE_FAST_ALLOCATED
|
||||
+#undef USING_FAST_MALLOC
|
||||
+
|
||||
+#ifdef DEFINED_ASSERT_FOR_DECIMAL_H
|
||||
+#undef DEFINED_ASSERT_FOR_DECIMAL_H
|
||||
|
@ -216,4 +222,3 @@ diff --git a/mfbt/decimal/Decimal.h b/mfbt/decimal/Decimal.h
|
|||
+#endif
|
||||
+
|
||||
#endif // Decimal_h
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче