diff options
4 files changed, 1909 insertions, 77 deletions
diff --git a/meta-oe/recipes-extended/mozjs/mozjs/0003-Add-AArch64-support.patch b/meta-oe/recipes-extended/mozjs/mozjs/0003-Add-AArch64-support.patch deleted file mode 100644 index 6e724292a4..0000000000 --- a/meta-oe/recipes-extended/mozjs/mozjs/0003-Add-AArch64-support.patch +++ /dev/null | |||
| @@ -1,76 +0,0 @@ | |||
| 1 | From 15e710e331d36eb279852b5cd1ba37a9a6005217 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Koen Kooi <koen.kooi@linaro.org> | ||
| 3 | Date: Mon, 2 Mar 2015 19:08:22 +0800 | ||
| 4 | Subject: [PATCH 3/5] Add AArch64 support | ||
| 5 | |||
| 6 | --- | ||
| 7 | Upstream-status: Pending | ||
| 8 | |||
| 9 | js/src/assembler/jit/ExecutableAllocator.h | 6 ++++++ | ||
| 10 | js/src/assembler/wtf/Platform.h | 4 ++++ | ||
| 11 | js/src/configure.in | 4 ++++ | ||
| 12 | mfbt/double-conversion/utils.h | 1 + | ||
| 13 | 4 files changed, 15 insertions(+) | ||
| 14 | |||
| 15 | diff --git a/js/src/assembler/jit/ExecutableAllocator.h b/js/src/assembler/jit/ExecutableAllocator.h | ||
| 16 | index c071c33..90764c3 100644 | ||
| 17 | --- a/js/src/assembler/jit/ExecutableAllocator.h | ||
| 18 | +++ b/js/src/assembler/jit/ExecutableAllocator.h | ||
| 19 | @@ -382,6 +382,12 @@ public: | ||
| 20 | { | ||
| 21 | reprotectRegion(start, size, Executable); | ||
| 22 | } | ||
| 23 | +#elif WTF_CPU_AARCH64 && WTF_PLATFORM_LINUX | ||
| 24 | + static void cacheFlush(void* code, size_t size) | ||
| 25 | + { | ||
| 26 | + intptr_t end = reinterpret_cast<intptr_t>(code) + size; | ||
| 27 | + __builtin___clear_cache(reinterpret_cast<char*>(code), reinterpret_cast<char*>(end)); | ||
| 28 | + } | ||
| 29 | #else | ||
| 30 | static void makeWritable(void*, size_t) {} | ||
| 31 | static void makeExecutable(void*, size_t) {} | ||
| 32 | diff --git a/js/src/assembler/wtf/Platform.h b/js/src/assembler/wtf/Platform.h | ||
| 33 | index 0c84896..e8763a7 100644 | ||
| 34 | --- a/js/src/assembler/wtf/Platform.h | ||
| 35 | +++ b/js/src/assembler/wtf/Platform.h | ||
| 36 | @@ -325,6 +325,10 @@ | ||
| 37 | #define WTF_THUMB_ARCH_VERSION 0 | ||
| 38 | #endif | ||
| 39 | |||
| 40 | +/* CPU(AArch64) - 64-bit ARM */ | ||
| 41 | +#if defined(__aarch64__) | ||
| 42 | +#define WTF_CPU_AARCH64 1 | ||
| 43 | +#endif | ||
| 44 | |||
| 45 | /* WTF_CPU_ARMV5_OR_LOWER - ARM instruction set v5 or earlier */ | ||
| 46 | /* On ARMv5 and below the natural alignment is required. | ||
| 47 | diff --git a/js/src/configure.in b/js/src/configure.in | ||
| 48 | index 64c7606..0673aca 100644 | ||
| 49 | --- a/js/src/configure.in | ||
| 50 | +++ b/js/src/configure.in | ||
| 51 | @@ -1121,6 +1121,10 @@ arm*) | ||
| 52 | CPU_ARCH=arm | ||
| 53 | ;; | ||
| 54 | |||
| 55 | +aarch64) | ||
| 56 | + CPU_ARCH=aarch64 | ||
| 57 | + ;; | ||
| 58 | + | ||
| 59 | mips|mipsel) | ||
| 60 | CPU_ARCH="mips" | ||
| 61 | ;; | ||
| 62 | diff --git a/mfbt/double-conversion/utils.h b/mfbt/double-conversion/utils.h | ||
| 63 | index 0eec2d9..fe26dab 100644 | ||
| 64 | --- a/mfbt/double-conversion/utils.h | ||
| 65 | +++ b/mfbt/double-conversion/utils.h | ||
| 66 | @@ -58,6 +58,7 @@ | ||
| 67 | defined(__mips__) || defined(__powerpc__) || \ | ||
| 68 | defined(__sparc__) || defined(__sparc) || defined(__s390__) || \ | ||
| 69 | defined(__SH4__) || defined(__alpha__) || \ | ||
| 70 | + defined(__aarch64__) || \ | ||
| 71 | defined(_MIPS_ARCH_MIPS32R2) | ||
| 72 | #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 | ||
| 73 | #elif defined(_M_IX86) || defined(__i386__) || defined(__i386) | ||
| 74 | -- | ||
| 75 | 1.9.3 | ||
| 76 | |||
diff --git a/meta-oe/recipes-extended/mozjs/mozjs/Update-Double-Conversion.patch b/meta-oe/recipes-extended/mozjs/mozjs/Update-Double-Conversion.patch new file mode 100644 index 0000000000..c5979c97bd --- /dev/null +++ b/meta-oe/recipes-extended/mozjs/mozjs/Update-Double-Conversion.patch | |||
| @@ -0,0 +1,1732 @@ | |||
| 1 | From b4961d6e1d273dd9643fc3c055163d5cd3362fb7 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Alistair Francis <alistair.francis@wdc.com> | ||
| 3 | Date: Fri, 1 Jun 2018 14:47:31 -0700 | ||
| 4 | Subject: [PATCH] Update double conversion | ||
| 5 | |||
| 6 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
| 7 | --- | ||
| 8 | mfbt/double-conversion/COPYING | 26 ++ | ||
| 9 | mfbt/double-conversion/bignum-dtoa.cc | 19 +- | ||
| 10 | mfbt/double-conversion/bignum-dtoa.h | 2 +- | ||
| 11 | mfbt/double-conversion/bignum.cc | 39 +-- | ||
| 12 | mfbt/double-conversion/bignum.h | 5 +- | ||
| 13 | mfbt/double-conversion/cached-powers.cc | 14 +- | ||
| 14 | mfbt/double-conversion/cached-powers.h | 2 +- | ||
| 15 | mfbt/double-conversion/diy-fp.cc | 4 +- | ||
| 16 | mfbt/double-conversion/diy-fp.h | 24 +- | ||
| 17 | mfbt/double-conversion/double-conversion.cc | 293 ++++++++++++++------ | ||
| 18 | mfbt/double-conversion/double-conversion.h | 78 +++--- | ||
| 19 | mfbt/double-conversion/fast-dtoa.cc | 29 +- | ||
| 20 | mfbt/double-conversion/fast-dtoa.h | 2 +- | ||
| 21 | mfbt/double-conversion/fixed-dtoa.cc | 23 +- | ||
| 22 | mfbt/double-conversion/fixed-dtoa.h | 2 +- | ||
| 23 | mfbt/double-conversion/ieee.h | 8 +- | ||
| 24 | mfbt/double-conversion/strtod.cc | 59 ++-- | ||
| 25 | mfbt/double-conversion/strtod.h | 2 +- | ||
| 26 | mfbt/double-conversion/utils.h | 62 +++-- | ||
| 27 | 19 files changed, 465 insertions(+), 228 deletions(-) | ||
| 28 | create mode 100644 mfbt/double-conversion/COPYING | ||
| 29 | |||
| 30 | diff --git a/mfbt/double-conversion/COPYING b/mfbt/double-conversion/COPYING | ||
| 31 | new file mode 100644 | ||
| 32 | index 0000000..933718a | ||
| 33 | --- /dev/null | ||
| 34 | +++ b/mfbt/double-conversion/COPYING | ||
| 35 | @@ -0,0 +1,26 @@ | ||
| 36 | +Copyright 2006-2011, the V8 project authors. All rights reserved. | ||
| 37 | +Redistribution and use in source and binary forms, with or without | ||
| 38 | +modification, are permitted provided that the following conditions are | ||
| 39 | +met: | ||
| 40 | + | ||
| 41 | + * Redistributions of source code must retain the above copyright | ||
| 42 | + notice, this list of conditions and the following disclaimer. | ||
| 43 | + * Redistributions in binary form must reproduce the above | ||
| 44 | + copyright notice, this list of conditions and the following | ||
| 45 | + disclaimer in the documentation and/or other materials provided | ||
| 46 | + with the distribution. | ||
| 47 | + * Neither the name of Google Inc. nor the names of its | ||
| 48 | + contributors may be used to endorse or promote products derived | ||
| 49 | + from this software without specific prior written permission. | ||
| 50 | + | ||
| 51 | +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 52 | +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 53 | +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 54 | +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 55 | +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 56 | +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 57 | +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 58 | +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 59 | +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 60 | +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 61 | +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 62 | diff --git a/mfbt/double-conversion/bignum-dtoa.cc b/mfbt/double-conversion/bignum-dtoa.cc | ||
| 63 | index b6c2e85..06bdf55 100644 | ||
| 64 | --- a/mfbt/double-conversion/bignum-dtoa.cc | ||
| 65 | +++ b/mfbt/double-conversion/bignum-dtoa.cc | ||
| 66 | @@ -25,12 +25,12 @@ | ||
| 67 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 68 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 69 | |||
| 70 | -#include <math.h> | ||
| 71 | +#include <cmath> | ||
| 72 | |||
| 73 | -#include "bignum-dtoa.h" | ||
| 74 | +#include <bignum-dtoa.h> | ||
| 75 | |||
| 76 | -#include "bignum.h" | ||
| 77 | -#include "ieee.h" | ||
| 78 | +#include <bignum.h> | ||
| 79 | +#include <ieee.h> | ||
| 80 | |||
| 81 | namespace double_conversion { | ||
| 82 | |||
| 83 | @@ -192,13 +192,13 @@ static void GenerateShortestDigits(Bignum* numerator, Bignum* denominator, | ||
| 84 | delta_plus = delta_minus; | ||
| 85 | } | ||
| 86 | *length = 0; | ||
| 87 | - while (true) { | ||
| 88 | + for (;;) { | ||
| 89 | uint16_t digit; | ||
| 90 | digit = numerator->DivideModuloIntBignum(*denominator); | ||
| 91 | ASSERT(digit <= 9); // digit is a uint16_t and therefore always positive. | ||
| 92 | // digit = numerator / denominator (integer division). | ||
| 93 | // numerator = numerator % denominator. | ||
| 94 | - buffer[(*length)++] = digit + '0'; | ||
| 95 | + buffer[(*length)++] = static_cast<char>(digit + '0'); | ||
| 96 | |||
| 97 | // Can we stop already? | ||
| 98 | // If the remainder of the division is less than the distance to the lower | ||
| 99 | @@ -282,7 +282,7 @@ static void GenerateShortestDigits(Bignum* numerator, Bignum* denominator, | ||
| 100 | // exponent (decimal_point), when rounding upwards. | ||
| 101 | static void GenerateCountedDigits(int count, int* decimal_point, | ||
| 102 | Bignum* numerator, Bignum* denominator, | ||
| 103 | - Vector<char>(buffer), int* length) { | ||
| 104 | + Vector<char> buffer, int* length) { | ||
| 105 | ASSERT(count >= 0); | ||
| 106 | for (int i = 0; i < count - 1; ++i) { | ||
| 107 | uint16_t digit; | ||
| 108 | @@ -290,7 +290,7 @@ static void GenerateCountedDigits(int count, int* decimal_point, | ||
| 109 | ASSERT(digit <= 9); // digit is a uint16_t and therefore always positive. | ||
| 110 | // digit = numerator / denominator (integer division). | ||
| 111 | // numerator = numerator % denominator. | ||
| 112 | - buffer[i] = digit + '0'; | ||
| 113 | + buffer[i] = static_cast<char>(digit + '0'); | ||
| 114 | // Prepare for next iteration. | ||
| 115 | numerator->Times10(); | ||
| 116 | } | ||
| 117 | @@ -300,7 +300,8 @@ static void GenerateCountedDigits(int count, int* decimal_point, | ||
| 118 | if (Bignum::PlusCompare(*numerator, *numerator, *denominator) >= 0) { | ||
| 119 | digit++; | ||
| 120 | } | ||
| 121 | - buffer[count - 1] = digit + '0'; | ||
| 122 | + ASSERT(digit <= 10); | ||
| 123 | + buffer[count - 1] = static_cast<char>(digit + '0'); | ||
| 124 | // Correct bad digits (in case we had a sequence of '9's). Propagate the | ||
| 125 | // carry until we hat a non-'9' or til we reach the first digit. | ||
| 126 | for (int i = count - 1; i > 0; --i) { | ||
| 127 | diff --git a/mfbt/double-conversion/bignum-dtoa.h b/mfbt/double-conversion/bignum-dtoa.h | ||
| 128 | index 34b9619..88d936a 100644 | ||
| 129 | --- a/mfbt/double-conversion/bignum-dtoa.h | ||
| 130 | +++ b/mfbt/double-conversion/bignum-dtoa.h | ||
| 131 | @@ -28,7 +28,7 @@ | ||
| 132 | #ifndef DOUBLE_CONVERSION_BIGNUM_DTOA_H_ | ||
| 133 | #define DOUBLE_CONVERSION_BIGNUM_DTOA_H_ | ||
| 134 | |||
| 135 | -#include "utils.h" | ||
| 136 | +#include <utils.h> | ||
| 137 | |||
| 138 | namespace double_conversion { | ||
| 139 | |||
| 140 | diff --git a/mfbt/double-conversion/bignum.cc b/mfbt/double-conversion/bignum.cc | ||
| 141 | index 747491a..4786c2e 100644 | ||
| 142 | --- a/mfbt/double-conversion/bignum.cc | ||
| 143 | +++ b/mfbt/double-conversion/bignum.cc | ||
| 144 | @@ -25,13 +25,13 @@ | ||
| 145 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 146 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 147 | |||
| 148 | -#include "bignum.h" | ||
| 149 | -#include "utils.h" | ||
| 150 | +#include <bignum.h> | ||
| 151 | +#include <utils.h> | ||
| 152 | |||
| 153 | namespace double_conversion { | ||
| 154 | |||
| 155 | Bignum::Bignum() | ||
| 156 | - : bigits_(bigits_buffer_, kBigitCapacity), used_digits_(0), exponent_(0) { | ||
| 157 | + : bigits_buffer_(), bigits_(bigits_buffer_, kBigitCapacity), used_digits_(0), exponent_(0) { | ||
| 158 | for (int i = 0; i < kBigitCapacity; ++i) { | ||
| 159 | bigits_[i] = 0; | ||
| 160 | } | ||
| 161 | @@ -40,6 +40,7 @@ Bignum::Bignum() | ||
| 162 | |||
| 163 | template<typename S> | ||
| 164 | static int BitSize(S value) { | ||
| 165 | + (void) value; // Mark variable as used. | ||
| 166 | return 8 * sizeof(value); | ||
| 167 | } | ||
| 168 | |||
| 169 | @@ -103,7 +104,7 @@ void Bignum::AssignDecimalString(Vector<const char> value) { | ||
| 170 | const int kMaxUint64DecimalDigits = 19; | ||
| 171 | Zero(); | ||
| 172 | int length = value.length(); | ||
| 173 | - int pos = 0; | ||
| 174 | + unsigned int pos = 0; | ||
| 175 | // Let's just say that each digit needs 4 bits. | ||
| 176 | while (length >= kMaxUint64DecimalDigits) { | ||
| 177 | uint64_t digits = ReadUInt64(value, pos, kMaxUint64DecimalDigits); | ||
| 178 | @@ -122,9 +123,8 @@ void Bignum::AssignDecimalString(Vector<const char> value) { | ||
| 179 | static int HexCharValue(char c) { | ||
| 180 | if ('0' <= c && c <= '9') return c - '0'; | ||
| 181 | if ('a' <= c && c <= 'f') return 10 + c - 'a'; | ||
| 182 | - if ('A' <= c && c <= 'F') return 10 + c - 'A'; | ||
| 183 | - UNREACHABLE(); | ||
| 184 | - return 0; // To make compiler happy. | ||
| 185 | + ASSERT('A' <= c && c <= 'F'); | ||
| 186 | + return 10 + c - 'A'; | ||
| 187 | } | ||
| 188 | |||
| 189 | |||
| 190 | @@ -445,26 +445,27 @@ void Bignum::AssignPowerUInt16(uint16_t base, int power_exponent) { | ||
| 191 | mask >>= 2; | ||
| 192 | uint64_t this_value = base; | ||
| 193 | |||
| 194 | - bool delayed_multipliciation = false; | ||
| 195 | + bool delayed_multiplication = false; | ||
| 196 | const uint64_t max_32bits = 0xFFFFFFFF; | ||
| 197 | while (mask != 0 && this_value <= max_32bits) { | ||
| 198 | this_value = this_value * this_value; | ||
| 199 | // Verify that there is enough space in this_value to perform the | ||
| 200 | // multiplication. The first bit_size bits must be 0. | ||
| 201 | if ((power_exponent & mask) != 0) { | ||
| 202 | + ASSERT(bit_size > 0); | ||
| 203 | uint64_t base_bits_mask = | ||
| 204 | ~((static_cast<uint64_t>(1) << (64 - bit_size)) - 1); | ||
| 205 | bool high_bits_zero = (this_value & base_bits_mask) == 0; | ||
| 206 | if (high_bits_zero) { | ||
| 207 | this_value *= base; | ||
| 208 | } else { | ||
| 209 | - delayed_multipliciation = true; | ||
| 210 | + delayed_multiplication = true; | ||
| 211 | } | ||
| 212 | } | ||
| 213 | mask >>= 1; | ||
| 214 | } | ||
| 215 | AssignUInt64(this_value); | ||
| 216 | - if (delayed_multipliciation) { | ||
| 217 | + if (delayed_multiplication) { | ||
| 218 | MultiplyByUInt32(base); | ||
| 219 | } | ||
| 220 | |||
| 221 | @@ -501,13 +502,14 @@ uint16_t Bignum::DivideModuloIntBignum(const Bignum& other) { | ||
| 222 | // Start by removing multiples of 'other' until both numbers have the same | ||
| 223 | // number of digits. | ||
| 224 | while (BigitLength() > other.BigitLength()) { | ||
| 225 | - // This naive approach is extremely inefficient if the this divided other | ||
| 226 | - // might be big. This function is implemented for doubleToString where | ||
| 227 | + // This naive approach is extremely inefficient if `this` divided by other | ||
| 228 | + // is big. This function is implemented for doubleToString where | ||
| 229 | // the result should be small (less than 10). | ||
| 230 | ASSERT(other.bigits_[other.used_digits_ - 1] >= ((1 << kBigitSize) / 16)); | ||
| 231 | + ASSERT(bigits_[used_digits_ - 1] < 0x10000); | ||
| 232 | // Remove the multiples of the first digit. | ||
| 233 | // Example this = 23 and other equals 9. -> Remove 2 multiples. | ||
| 234 | - result += bigits_[used_digits_ - 1]; | ||
| 235 | + result += static_cast<uint16_t>(bigits_[used_digits_ - 1]); | ||
| 236 | SubtractTimes(other, bigits_[used_digits_ - 1]); | ||
| 237 | } | ||
| 238 | |||
| 239 | @@ -523,13 +525,15 @@ uint16_t Bignum::DivideModuloIntBignum(const Bignum& other) { | ||
| 240 | // Shortcut for easy (and common) case. | ||
| 241 | int quotient = this_bigit / other_bigit; | ||
| 242 | bigits_[used_digits_ - 1] = this_bigit - other_bigit * quotient; | ||
| 243 | - result += quotient; | ||
| 244 | + ASSERT(quotient < 0x10000); | ||
| 245 | + result += static_cast<uint16_t>(quotient); | ||
| 246 | Clamp(); | ||
| 247 | return result; | ||
| 248 | } | ||
| 249 | |||
| 250 | int division_estimate = this_bigit / (other_bigit + 1); | ||
| 251 | - result += division_estimate; | ||
| 252 | + ASSERT(division_estimate < 0x10000); | ||
| 253 | + result += static_cast<uint16_t>(division_estimate); | ||
| 254 | SubtractTimes(other, division_estimate); | ||
| 255 | |||
| 256 | if (other_bigit * (division_estimate + 1) > this_bigit) { | ||
| 257 | @@ -560,8 +564,8 @@ static int SizeInHexChars(S number) { | ||
| 258 | |||
| 259 | static char HexCharOfValue(int value) { | ||
| 260 | ASSERT(0 <= value && value <= 16); | ||
| 261 | - if (value < 10) return value + '0'; | ||
| 262 | - return value - 10 + 'A'; | ||
| 263 | + if (value < 10) return static_cast<char>(value + '0'); | ||
| 264 | + return static_cast<char>(value - 10 + 'A'); | ||
| 265 | } | ||
| 266 | |||
| 267 | |||
| 268 | @@ -755,7 +759,6 @@ void Bignum::SubtractTimes(const Bignum& other, int factor) { | ||
| 269 | Chunk difference = bigits_[i] - borrow; | ||
| 270 | bigits_[i] = difference & kBigitMask; | ||
| 271 | borrow = difference >> (kChunkSize - 1); | ||
| 272 | - ++i; | ||
| 273 | } | ||
| 274 | Clamp(); | ||
| 275 | } | ||
| 276 | diff --git a/mfbt/double-conversion/bignum.h b/mfbt/double-conversion/bignum.h | ||
| 277 | index 5ec3544..4fdad0c 100644 | ||
| 278 | --- a/mfbt/double-conversion/bignum.h | ||
| 279 | +++ b/mfbt/double-conversion/bignum.h | ||
| 280 | @@ -28,7 +28,7 @@ | ||
| 281 | #ifndef DOUBLE_CONVERSION_BIGNUM_H_ | ||
| 282 | #define DOUBLE_CONVERSION_BIGNUM_H_ | ||
| 283 | |||
| 284 | -#include "utils.h" | ||
| 285 | +#include <utils.h> | ||
| 286 | |||
| 287 | namespace double_conversion { | ||
| 288 | |||
| 289 | @@ -49,7 +49,6 @@ class Bignum { | ||
| 290 | |||
| 291 | void AssignPowerUInt16(uint16_t base, int exponent); | ||
| 292 | |||
| 293 | - void AddUInt16(uint16_t operand); | ||
| 294 | void AddUInt64(uint64_t operand); | ||
| 295 | void AddBignum(const Bignum& other); | ||
| 296 | // Precondition: this >= other. | ||
| 297 | @@ -137,7 +136,7 @@ class Bignum { | ||
| 298 | // The Bignum's value equals value(bigits_) * 2^(exponent_ * kBigitSize). | ||
| 299 | int exponent_; | ||
| 300 | |||
| 301 | - DISALLOW_COPY_AND_ASSIGN(Bignum); | ||
| 302 | + DC_DISALLOW_COPY_AND_ASSIGN(Bignum); | ||
| 303 | }; | ||
| 304 | |||
| 305 | } // namespace double_conversion | ||
| 306 | diff --git a/mfbt/double-conversion/cached-powers.cc b/mfbt/double-conversion/cached-powers.cc | ||
| 307 | index c676429..06e819d 100644 | ||
| 308 | --- a/mfbt/double-conversion/cached-powers.cc | ||
| 309 | +++ b/mfbt/double-conversion/cached-powers.cc | ||
| 310 | @@ -25,13 +25,13 @@ | ||
| 311 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 312 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 313 | |||
| 314 | -#include <stdarg.h> | ||
| 315 | -#include <limits.h> | ||
| 316 | -#include <math.h> | ||
| 317 | +#include <climits> | ||
| 318 | +#include <cmath> | ||
| 319 | +#include <cstdarg> | ||
| 320 | |||
| 321 | -#include "utils.h" | ||
| 322 | +#include <utils.h> | ||
| 323 | |||
| 324 | -#include "cached-powers.h" | ||
| 325 | +#include <cached-powers.h> | ||
| 326 | |||
| 327 | namespace double_conversion { | ||
| 328 | |||
| 329 | @@ -131,7 +131,6 @@ static const CachedPower kCachedPowers[] = { | ||
| 330 | {UINT64_2PART_C(0xaf87023b, 9bf0ee6b), 1066, 340}, | ||
| 331 | }; | ||
| 332 | |||
| 333 | -static const int kCachedPowersLength = ARRAY_SIZE(kCachedPowers); | ||
| 334 | static const int kCachedPowersOffset = 348; // -1 * the first decimal_exponent. | ||
| 335 | static const double kD_1_LOG2_10 = 0.30102999566398114; // 1 / lg(10) | ||
| 336 | // Difference between the decimal exponents in the table above. | ||
| 337 | @@ -149,9 +148,10 @@ void PowersOfTenCache::GetCachedPowerForBinaryExponentRange( | ||
| 338 | int foo = kCachedPowersOffset; | ||
| 339 | int index = | ||
| 340 | (foo + static_cast<int>(k) - 1) / kDecimalExponentDistance + 1; | ||
| 341 | - ASSERT(0 <= index && index < kCachedPowersLength); | ||
| 342 | + ASSERT(0 <= index && index < static_cast<int>(ARRAY_SIZE(kCachedPowers))); | ||
| 343 | CachedPower cached_power = kCachedPowers[index]; | ||
| 344 | ASSERT(min_exponent <= cached_power.binary_exponent); | ||
| 345 | + (void) max_exponent; // Mark variable as used. | ||
| 346 | ASSERT(cached_power.binary_exponent <= max_exponent); | ||
| 347 | *decimal_exponent = cached_power.decimal_exponent; | ||
| 348 | *power = DiyFp(cached_power.significand, cached_power.binary_exponent); | ||
| 349 | diff --git a/mfbt/double-conversion/cached-powers.h b/mfbt/double-conversion/cached-powers.h | ||
| 350 | index 61a5061..a425d7c 100644 | ||
| 351 | --- a/mfbt/double-conversion/cached-powers.h | ||
| 352 | +++ b/mfbt/double-conversion/cached-powers.h | ||
| 353 | @@ -28,7 +28,7 @@ | ||
| 354 | #ifndef DOUBLE_CONVERSION_CACHED_POWERS_H_ | ||
| 355 | #define DOUBLE_CONVERSION_CACHED_POWERS_H_ | ||
| 356 | |||
| 357 | -#include "diy-fp.h" | ||
| 358 | +#include <diy-fp.h> | ||
| 359 | |||
| 360 | namespace double_conversion { | ||
| 361 | |||
| 362 | diff --git a/mfbt/double-conversion/diy-fp.cc b/mfbt/double-conversion/diy-fp.cc | ||
| 363 | index ddd1891..f31cf60 100644 | ||
| 364 | --- a/mfbt/double-conversion/diy-fp.cc | ||
| 365 | +++ b/mfbt/double-conversion/diy-fp.cc | ||
| 366 | @@ -26,8 +26,8 @@ | ||
| 367 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 368 | |||
| 369 | |||
| 370 | -#include "diy-fp.h" | ||
| 371 | -#include "utils.h" | ||
| 372 | +#include <diy-fp.h> | ||
| 373 | +#include <utils.h> | ||
| 374 | |||
| 375 | namespace double_conversion { | ||
| 376 | |||
| 377 | diff --git a/mfbt/double-conversion/diy-fp.h b/mfbt/double-conversion/diy-fp.h | ||
| 378 | index 9dcf8fb..80a8c4c 100644 | ||
| 379 | --- a/mfbt/double-conversion/diy-fp.h | ||
| 380 | +++ b/mfbt/double-conversion/diy-fp.h | ||
| 381 | @@ -28,7 +28,7 @@ | ||
| 382 | #ifndef DOUBLE_CONVERSION_DIY_FP_H_ | ||
| 383 | #define DOUBLE_CONVERSION_DIY_FP_H_ | ||
| 384 | |||
| 385 | -#include "utils.h" | ||
| 386 | +#include <utils.h> | ||
| 387 | |||
| 388 | namespace double_conversion { | ||
| 389 | |||
| 390 | @@ -42,7 +42,7 @@ class DiyFp { | ||
| 391 | static const int kSignificandSize = 64; | ||
| 392 | |||
| 393 | DiyFp() : f_(0), e_(0) {} | ||
| 394 | - DiyFp(uint64_t f, int e) : f_(f), e_(e) {} | ||
| 395 | + DiyFp(uint64_t significand, int exponent) : f_(significand), e_(exponent) {} | ||
| 396 | |||
| 397 | // this = this - other. | ||
| 398 | // The exponents of both numbers must be the same and the significand of this | ||
| 399 | @@ -76,22 +76,22 @@ class DiyFp { | ||
| 400 | |||
| 401 | void Normalize() { | ||
| 402 | ASSERT(f_ != 0); | ||
| 403 | - uint64_t f = f_; | ||
| 404 | - int e = e_; | ||
| 405 | + uint64_t significand = f_; | ||
| 406 | + int exponent = e_; | ||
| 407 | |||
| 408 | // This method is mainly called for normalizing boundaries. In general | ||
| 409 | // boundaries need to be shifted by 10 bits. We thus optimize for this case. | ||
| 410 | const uint64_t k10MSBits = UINT64_2PART_C(0xFFC00000, 00000000); | ||
| 411 | - while ((f & k10MSBits) == 0) { | ||
| 412 | - f <<= 10; | ||
| 413 | - e -= 10; | ||
| 414 | + while ((significand & k10MSBits) == 0) { | ||
| 415 | + significand <<= 10; | ||
| 416 | + exponent -= 10; | ||
| 417 | } | ||
| 418 | - while ((f & kUint64MSB) == 0) { | ||
| 419 | - f <<= 1; | ||
| 420 | - e--; | ||
| 421 | + while ((significand & kUint64MSB) == 0) { | ||
| 422 | + significand <<= 1; | ||
| 423 | + exponent--; | ||
| 424 | } | ||
| 425 | - f_ = f; | ||
| 426 | - e_ = e; | ||
| 427 | + f_ = significand; | ||
| 428 | + e_ = exponent; | ||
| 429 | } | ||
| 430 | |||
| 431 | static DiyFp Normalize(const DiyFp& a) { | ||
| 432 | diff --git a/mfbt/double-conversion/double-conversion.cc b/mfbt/double-conversion/double-conversion.cc | ||
| 433 | index 650137b..7819267 100644 | ||
| 434 | --- a/mfbt/double-conversion/double-conversion.cc | ||
| 435 | +++ b/mfbt/double-conversion/double-conversion.cc | ||
| 436 | @@ -25,17 +25,18 @@ | ||
| 437 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 438 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 439 | |||
| 440 | -#include <limits.h> | ||
| 441 | -#include <math.h> | ||
| 442 | +#include <climits> | ||
| 443 | +#include <locale> | ||
| 444 | +#include <cmath> | ||
| 445 | |||
| 446 | -#include "double-conversion.h" | ||
| 447 | +#include <double-conversion.h> | ||
| 448 | |||
| 449 | -#include "bignum-dtoa.h" | ||
| 450 | -#include "fast-dtoa.h" | ||
| 451 | -#include "fixed-dtoa.h" | ||
| 452 | -#include "ieee.h" | ||
| 453 | -#include "strtod.h" | ||
| 454 | -#include "utils.h" | ||
| 455 | +#include <bignum-dtoa.h> | ||
| 456 | +#include <fast-dtoa.h> | ||
| 457 | +#include <fixed-dtoa.h> | ||
| 458 | +#include <ieee.h> | ||
| 459 | +#include <strtod.h> | ||
| 460 | +#include <utils.h> | ||
| 461 | |||
| 462 | namespace double_conversion { | ||
| 463 | |||
| 464 | @@ -118,7 +119,7 @@ void DoubleToStringConverter::CreateDecimalRepresentation( | ||
| 465 | StringBuilder* result_builder) const { | ||
| 466 | // Create a representation that is padded with zeros if needed. | ||
| 467 | if (decimal_point <= 0) { | ||
| 468 | - // "0.00000decimal_rep". | ||
| 469 | + // "0.00000decimal_rep" or "0.000decimal_rep00". | ||
| 470 | result_builder->AddCharacter('0'); | ||
| 471 | if (digits_after_point > 0) { | ||
| 472 | result_builder->AddCharacter('.'); | ||
| 473 | @@ -129,7 +130,7 @@ void DoubleToStringConverter::CreateDecimalRepresentation( | ||
| 474 | result_builder->AddPadding('0', remaining_digits); | ||
| 475 | } | ||
| 476 | } else if (decimal_point >= length) { | ||
| 477 | - // "decimal_rep0000.00000" or "decimal_rep.0000" | ||
| 478 | + // "decimal_rep0000.00000" or "decimal_rep.0000". | ||
| 479 | result_builder->AddSubstring(decimal_digits, length); | ||
| 480 | result_builder->AddPadding('0', decimal_point - length); | ||
| 481 | if (digits_after_point > 0) { | ||
| 482 | @@ -137,7 +138,7 @@ void DoubleToStringConverter::CreateDecimalRepresentation( | ||
| 483 | result_builder->AddPadding('0', digits_after_point); | ||
| 484 | } | ||
| 485 | } else { | ||
| 486 | - // "decima.l_rep000" | ||
| 487 | + // "decima.l_rep000". | ||
| 488 | ASSERT(digits_after_point > 0); | ||
| 489 | result_builder->AddSubstring(decimal_digits, decimal_point); | ||
| 490 | result_builder->AddCharacter('.'); | ||
| 491 | @@ -162,7 +163,7 @@ bool DoubleToStringConverter::ToShortestIeeeNumber( | ||
| 492 | double value, | ||
| 493 | StringBuilder* result_builder, | ||
| 494 | DoubleToStringConverter::DtoaMode mode) const { | ||
| 495 | - assert(mode == SHORTEST || mode == SHORTEST_SINGLE); | ||
| 496 | + ASSERT(mode == SHORTEST || mode == SHORTEST_SINGLE); | ||
| 497 | if (Double(value).IsSpecial()) { | ||
| 498 | return HandleSpecialValues(value, result_builder); | ||
| 499 | } | ||
| 500 | @@ -348,7 +349,6 @@ static BignumDtoaMode DtoaToBignumDtoaMode( | ||
| 501 | case DoubleToStringConverter::PRECISION: return BIGNUM_DTOA_PRECISION; | ||
| 502 | default: | ||
| 503 | UNREACHABLE(); | ||
| 504 | - return BIGNUM_DTOA_SHORTEST; // To silence compiler. | ||
| 505 | } | ||
| 506 | } | ||
| 507 | |||
| 508 | @@ -403,8 +403,8 @@ void DoubleToStringConverter::DoubleToAscii(double v, | ||
| 509 | vector, length, point); | ||
| 510 | break; | ||
| 511 | default: | ||
| 512 | - UNREACHABLE(); | ||
| 513 | fast_worked = false; | ||
| 514 | + UNREACHABLE(); | ||
| 515 | } | ||
| 516 | if (fast_worked) return; | ||
| 517 | |||
| 518 | @@ -415,20 +415,55 @@ void DoubleToStringConverter::DoubleToAscii(double v, | ||
| 519 | } | ||
| 520 | |||
| 521 | |||
| 522 | -// Consumes the given substring from the iterator. | ||
| 523 | -// Returns false, if the substring does not match. | ||
| 524 | -static bool ConsumeSubString(const char** current, | ||
| 525 | - const char* end, | ||
| 526 | - const char* substring) { | ||
| 527 | - ASSERT(**current == *substring); | ||
| 528 | +namespace { | ||
| 529 | + | ||
| 530 | +inline char ToLower(char ch) { | ||
| 531 | + static const std::ctype<char>& cType = | ||
| 532 | + std::use_facet<std::ctype<char> >(std::locale::classic()); | ||
| 533 | + return cType.tolower(ch); | ||
| 534 | +} | ||
| 535 | + | ||
| 536 | +inline char Pass(char ch) { | ||
| 537 | + return ch; | ||
| 538 | +} | ||
| 539 | + | ||
| 540 | +template <class Iterator, class Converter> | ||
| 541 | +static inline bool ConsumeSubStringImpl(Iterator* current, | ||
| 542 | + Iterator end, | ||
| 543 | + const char* substring, | ||
| 544 | + Converter converter) { | ||
| 545 | + ASSERT(converter(**current) == *substring); | ||
| 546 | for (substring++; *substring != '\0'; substring++) { | ||
| 547 | ++*current; | ||
| 548 | - if (*current == end || **current != *substring) return false; | ||
| 549 | + if (*current == end || converter(**current) != *substring) { | ||
| 550 | + return false; | ||
| 551 | + } | ||
| 552 | } | ||
| 553 | ++*current; | ||
| 554 | return true; | ||
| 555 | } | ||
| 556 | |||
| 557 | +// Consumes the given substring from the iterator. | ||
| 558 | +// Returns false, if the substring does not match. | ||
| 559 | +template <class Iterator> | ||
| 560 | +static bool ConsumeSubString(Iterator* current, | ||
| 561 | + Iterator end, | ||
| 562 | + const char* substring, | ||
| 563 | + bool allow_case_insensibility) { | ||
| 564 | + if (allow_case_insensibility) { | ||
| 565 | + return ConsumeSubStringImpl(current, end, substring, ToLower); | ||
| 566 | + } else { | ||
| 567 | + return ConsumeSubStringImpl(current, end, substring, Pass); | ||
| 568 | + } | ||
| 569 | +} | ||
| 570 | + | ||
| 571 | +// Consumes first character of the str is equal to ch | ||
| 572 | +inline bool ConsumeFirstCharacter(char ch, | ||
| 573 | + const char* str, | ||
| 574 | + bool case_insensibility) { | ||
| 575 | + return case_insensibility ? ToLower(ch) == str[0] : ch == str[0]; | ||
| 576 | +} | ||
| 577 | +} // namespace | ||
| 578 | |||
| 579 | // Maximum number of significant digits in decimal representation. | ||
| 580 | // The longest possible double in decimal representation is | ||
| 581 | @@ -440,10 +475,36 @@ static bool ConsumeSubString(const char** current, | ||
| 582 | const int kMaxSignificantDigits = 772; | ||
| 583 | |||
| 584 | |||
| 585 | +static const char kWhitespaceTable7[] = { 32, 13, 10, 9, 11, 12 }; | ||
| 586 | +static const int kWhitespaceTable7Length = ARRAY_SIZE(kWhitespaceTable7); | ||
| 587 | + | ||
| 588 | + | ||
| 589 | +static const uc16 kWhitespaceTable16[] = { | ||
| 590 | + 160, 8232, 8233, 5760, 6158, 8192, 8193, 8194, 8195, | ||
| 591 | + 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279 | ||
| 592 | +}; | ||
| 593 | +static const int kWhitespaceTable16Length = ARRAY_SIZE(kWhitespaceTable16); | ||
| 594 | + | ||
| 595 | + | ||
| 596 | +static bool isWhitespace(int x) { | ||
| 597 | + if (x < 128) { | ||
| 598 | + for (int i = 0; i < kWhitespaceTable7Length; i++) { | ||
| 599 | + if (kWhitespaceTable7[i] == x) return true; | ||
| 600 | + } | ||
| 601 | + } else { | ||
| 602 | + for (int i = 0; i < kWhitespaceTable16Length; i++) { | ||
| 603 | + if (kWhitespaceTable16[i] == x) return true; | ||
| 604 | + } | ||
| 605 | + } | ||
| 606 | + return false; | ||
| 607 | +} | ||
| 608 | + | ||
| 609 | + | ||
| 610 | // Returns true if a nonspace found and false if the end has reached. | ||
| 611 | -static inline bool AdvanceToNonspace(const char** current, const char* end) { | ||
| 612 | +template <class Iterator> | ||
| 613 | +static inline bool AdvanceToNonspace(Iterator* current, Iterator end) { | ||
| 614 | while (*current != end) { | ||
| 615 | - if (**current != ' ') return true; | ||
| 616 | + if (!isWhitespace(**current)) return true; | ||
| 617 | ++*current; | ||
| 618 | } | ||
| 619 | return false; | ||
| 620 | @@ -462,26 +523,57 @@ static double SignedZero(bool sign) { | ||
| 621 | } | ||
| 622 | |||
| 623 | |||
| 624 | +// Returns true if 'c' is a decimal digit that is valid for the given radix. | ||
| 625 | +// | ||
| 626 | +// The function is small and could be inlined, but VS2012 emitted a warning | ||
| 627 | +// because it constant-propagated the radix and concluded that the last | ||
| 628 | +// condition was always true. By moving it into a separate function the | ||
| 629 | +// compiler wouldn't warn anymore. | ||
| 630 | +#if _MSC_VER | ||
| 631 | +#pragma optimize("",off) | ||
| 632 | +static bool IsDecimalDigitForRadix(int c, int radix) { | ||
| 633 | + return '0' <= c && c <= '9' && (c - '0') < radix; | ||
| 634 | +} | ||
| 635 | +#pragma optimize("",on) | ||
| 636 | +#else | ||
| 637 | +static bool inline IsDecimalDigitForRadix(int c, int radix) { | ||
| 638 | + return '0' <= c && c <= '9' && (c - '0') < radix; | ||
| 639 | +} | ||
| 640 | +#endif | ||
| 641 | +// Returns true if 'c' is a character digit that is valid for the given radix. | ||
| 642 | +// The 'a_character' should be 'a' or 'A'. | ||
| 643 | +// | ||
| 644 | +// The function is small and could be inlined, but VS2012 emitted a warning | ||
| 645 | +// because it constant-propagated the radix and concluded that the first | ||
| 646 | +// condition was always false. By moving it into a separate function the | ||
| 647 | +// compiler wouldn't warn anymore. | ||
| 648 | +static bool IsCharacterDigitForRadix(int c, int radix, char a_character) { | ||
| 649 | + return radix > 10 && c >= a_character && c < a_character + radix - 10; | ||
| 650 | +} | ||
| 651 | + | ||
| 652 | + | ||
| 653 | // Parsing integers with radix 2, 4, 8, 16, 32. Assumes current != end. | ||
| 654 | -template <int radix_log_2> | ||
| 655 | -static double RadixStringToIeee(const char* current, | ||
| 656 | - const char* end, | ||
| 657 | +template <int radix_log_2, class Iterator> | ||
| 658 | +static double RadixStringToIeee(Iterator* current, | ||
| 659 | + Iterator end, | ||
| 660 | bool sign, | ||
| 661 | bool allow_trailing_junk, | ||
| 662 | double junk_string_value, | ||
| 663 | bool read_as_double, | ||
| 664 | - const char** trailing_pointer) { | ||
| 665 | - ASSERT(current != end); | ||
| 666 | + bool* result_is_junk) { | ||
| 667 | + ASSERT(*current != end); | ||
| 668 | |||
| 669 | const int kDoubleSize = Double::kSignificandSize; | ||
| 670 | const int kSingleSize = Single::kSignificandSize; | ||
| 671 | const int kSignificandSize = read_as_double? kDoubleSize: kSingleSize; | ||
| 672 | |||
| 673 | + *result_is_junk = true; | ||
| 674 | + | ||
| 675 | // Skip leading 0s. | ||
| 676 | - while (*current == '0') { | ||
| 677 | - ++current; | ||
| 678 | - if (current == end) { | ||
| 679 | - *trailing_pointer = end; | ||
| 680 | + while (**current == '0') { | ||
| 681 | + ++(*current); | ||
| 682 | + if (*current == end) { | ||
| 683 | + *result_is_junk = false; | ||
| 684 | return SignedZero(sign); | ||
| 685 | } | ||
| 686 | } | ||
| 687 | @@ -492,14 +584,14 @@ static double RadixStringToIeee(const char* current, | ||
| 688 | |||
| 689 | do { | ||
| 690 | int digit; | ||
| 691 | - if (*current >= '0' && *current <= '9' && *current < '0' + radix) { | ||
| 692 | - digit = static_cast<char>(*current) - '0'; | ||
| 693 | - } else if (radix > 10 && *current >= 'a' && *current < 'a' + radix - 10) { | ||
| 694 | - digit = static_cast<char>(*current) - 'a' + 10; | ||
| 695 | - } else if (radix > 10 && *current >= 'A' && *current < 'A' + radix - 10) { | ||
| 696 | - digit = static_cast<char>(*current) - 'A' + 10; | ||
| 697 | + if (IsDecimalDigitForRadix(**current, radix)) { | ||
| 698 | + digit = static_cast<char>(**current) - '0'; | ||
| 699 | + } else if (IsCharacterDigitForRadix(**current, radix, 'a')) { | ||
| 700 | + digit = static_cast<char>(**current) - 'a' + 10; | ||
| 701 | + } else if (IsCharacterDigitForRadix(**current, radix, 'A')) { | ||
| 702 | + digit = static_cast<char>(**current) - 'A' + 10; | ||
| 703 | } else { | ||
| 704 | - if (allow_trailing_junk || !AdvanceToNonspace(¤t, end)) { | ||
| 705 | + if (allow_trailing_junk || !AdvanceToNonspace(current, end)) { | ||
| 706 | break; | ||
| 707 | } else { | ||
| 708 | return junk_string_value; | ||
| 709 | @@ -523,14 +615,14 @@ static double RadixStringToIeee(const char* current, | ||
| 710 | exponent = overflow_bits_count; | ||
| 711 | |||
| 712 | bool zero_tail = true; | ||
| 713 | - while (true) { | ||
| 714 | - ++current; | ||
| 715 | - if (current == end || !isDigit(*current, radix)) break; | ||
| 716 | - zero_tail = zero_tail && *current == '0'; | ||
| 717 | + for (;;) { | ||
| 718 | + ++(*current); | ||
| 719 | + if (*current == end || !isDigit(**current, radix)) break; | ||
| 720 | + zero_tail = zero_tail && **current == '0'; | ||
| 721 | exponent += radix_log_2; | ||
| 722 | } | ||
| 723 | |||
| 724 | - if (!allow_trailing_junk && AdvanceToNonspace(¤t, end)) { | ||
| 725 | + if (!allow_trailing_junk && AdvanceToNonspace(current, end)) { | ||
| 726 | return junk_string_value; | ||
| 727 | } | ||
| 728 | |||
| 729 | @@ -552,13 +644,13 @@ static double RadixStringToIeee(const char* current, | ||
| 730 | } | ||
| 731 | break; | ||
| 732 | } | ||
| 733 | - ++current; | ||
| 734 | - } while (current != end); | ||
| 735 | + ++(*current); | ||
| 736 | + } while (*current != end); | ||
| 737 | |||
| 738 | ASSERT(number < ((int64_t)1 << kSignificandSize)); | ||
| 739 | ASSERT(static_cast<int64_t>(static_cast<double>(number)) == number); | ||
| 740 | |||
| 741 | - *trailing_pointer = current; | ||
| 742 | + *result_is_junk = false; | ||
| 743 | |||
| 744 | if (exponent == 0) { | ||
| 745 | if (sign) { | ||
| 746 | @@ -572,14 +664,14 @@ static double RadixStringToIeee(const char* current, | ||
| 747 | return Double(DiyFp(number, exponent)).value(); | ||
| 748 | } | ||
| 749 | |||
| 750 | - | ||
| 751 | +template <class Iterator> | ||
| 752 | double StringToDoubleConverter::StringToIeee( | ||
| 753 | - const char* input, | ||
| 754 | + Iterator input, | ||
| 755 | int length, | ||
| 756 | - int* processed_characters_count, | ||
| 757 | - bool read_as_double) { | ||
| 758 | - const char* current = input; | ||
| 759 | - const char* end = input + length; | ||
| 760 | + bool read_as_double, | ||
| 761 | + int* processed_characters_count) const { | ||
| 762 | + Iterator current = input; | ||
| 763 | + Iterator end = input + length; | ||
| 764 | |||
| 765 | *processed_characters_count = 0; | ||
| 766 | |||
| 767 | @@ -587,6 +679,8 @@ double StringToDoubleConverter::StringToIeee( | ||
| 768 | const bool allow_leading_spaces = (flags_ & ALLOW_LEADING_SPACES) != 0; | ||
| 769 | const bool allow_trailing_spaces = (flags_ & ALLOW_TRAILING_SPACES) != 0; | ||
| 770 | const bool allow_spaces_after_sign = (flags_ & ALLOW_SPACES_AFTER_SIGN) != 0; | ||
| 771 | + const bool allow_case_insensibility = (flags_ & ALLOW_CASE_INSENSIBILITY) != 0; | ||
| 772 | + | ||
| 773 | |||
| 774 | // To make sure that iterator dereferencing is valid the following | ||
| 775 | // convention is used: | ||
| 776 | @@ -600,7 +694,7 @@ double StringToDoubleConverter::StringToIeee( | ||
| 777 | |||
| 778 | if (allow_leading_spaces || allow_trailing_spaces) { | ||
| 779 | if (!AdvanceToNonspace(¤t, end)) { | ||
| 780 | - *processed_characters_count = current - input; | ||
| 781 | + *processed_characters_count = static_cast<int>(current - input); | ||
| 782 | return empty_string_value_; | ||
| 783 | } | ||
| 784 | if (!allow_leading_spaces && (input != current)) { | ||
| 785 | @@ -626,7 +720,7 @@ double StringToDoubleConverter::StringToIeee( | ||
| 786 | if (*current == '+' || *current == '-') { | ||
| 787 | sign = (*current == '-'); | ||
| 788 | ++current; | ||
| 789 | - const char* next_non_space = current; | ||
| 790 | + Iterator next_non_space = current; | ||
| 791 | // Skip following spaces (if allowed). | ||
| 792 | if (!AdvanceToNonspace(&next_non_space, end)) return junk_string_value_; | ||
| 793 | if (!allow_spaces_after_sign && (current != next_non_space)) { | ||
| 794 | @@ -636,8 +730,8 @@ double StringToDoubleConverter::StringToIeee( | ||
| 795 | } | ||
| 796 | |||
| 797 | if (infinity_symbol_ != NULL) { | ||
| 798 | - if (*current == infinity_symbol_[0]) { | ||
| 799 | - if (!ConsumeSubString(¤t, end, infinity_symbol_)) { | ||
| 800 | + if (ConsumeFirstCharacter(*current, infinity_symbol_, allow_case_insensibility)) { | ||
| 801 | + if (!ConsumeSubString(¤t, end, infinity_symbol_, allow_case_insensibility)) { | ||
| 802 | return junk_string_value_; | ||
| 803 | } | ||
| 804 | |||
| 805 | @@ -649,14 +743,14 @@ double StringToDoubleConverter::StringToIeee( | ||
| 806 | } | ||
| 807 | |||
| 808 | ASSERT(buffer_pos == 0); | ||
| 809 | - *processed_characters_count = current - input; | ||
| 810 | + *processed_characters_count = static_cast<int>(current - input); | ||
| 811 | return sign ? -Double::Infinity() : Double::Infinity(); | ||
| 812 | } | ||
| 813 | } | ||
| 814 | |||
| 815 | if (nan_symbol_ != NULL) { | ||
| 816 | - if (*current == nan_symbol_[0]) { | ||
| 817 | - if (!ConsumeSubString(¤t, end, nan_symbol_)) { | ||
| 818 | + if (ConsumeFirstCharacter(*current, nan_symbol_, allow_case_insensibility)) { | ||
| 819 | + if (!ConsumeSubString(¤t, end, nan_symbol_, allow_case_insensibility)) { | ||
| 820 | return junk_string_value_; | ||
| 821 | } | ||
| 822 | |||
| 823 | @@ -668,7 +762,7 @@ double StringToDoubleConverter::StringToIeee( | ||
| 824 | } | ||
| 825 | |||
| 826 | ASSERT(buffer_pos == 0); | ||
| 827 | - *processed_characters_count = current - input; | ||
| 828 | + *processed_characters_count = static_cast<int>(current - input); | ||
| 829 | return sign ? -Double::NaN() : Double::NaN(); | ||
| 830 | } | ||
| 831 | } | ||
| 832 | @@ -677,7 +771,7 @@ double StringToDoubleConverter::StringToIeee( | ||
| 833 | if (*current == '0') { | ||
| 834 | ++current; | ||
| 835 | if (current == end) { | ||
| 836 | - *processed_characters_count = current - input; | ||
| 837 | + *processed_characters_count = static_cast<int>(current - input); | ||
| 838 | return SignedZero(sign); | ||
| 839 | } | ||
| 840 | |||
| 841 | @@ -690,17 +784,17 @@ double StringToDoubleConverter::StringToIeee( | ||
| 842 | return junk_string_value_; // "0x". | ||
| 843 | } | ||
| 844 | |||
| 845 | - const char* tail_pointer = NULL; | ||
| 846 | - double result = RadixStringToIeee<4>(current, | ||
| 847 | + bool result_is_junk; | ||
| 848 | + double result = RadixStringToIeee<4>(¤t, | ||
| 849 | end, | ||
| 850 | sign, | ||
| 851 | allow_trailing_junk, | ||
| 852 | junk_string_value_, | ||
| 853 | read_as_double, | ||
| 854 | - &tail_pointer); | ||
| 855 | - if (tail_pointer != NULL) { | ||
| 856 | - if (allow_trailing_spaces) AdvanceToNonspace(&tail_pointer, end); | ||
| 857 | - *processed_characters_count = tail_pointer - input; | ||
| 858 | + &result_is_junk); | ||
| 859 | + if (!result_is_junk) { | ||
| 860 | + if (allow_trailing_spaces) AdvanceToNonspace(¤t, end); | ||
| 861 | + *processed_characters_count = static_cast<int>(current - input); | ||
| 862 | } | ||
| 863 | return result; | ||
| 864 | } | ||
| 865 | @@ -709,7 +803,7 @@ double StringToDoubleConverter::StringToIeee( | ||
| 866 | while (*current == '0') { | ||
| 867 | ++current; | ||
| 868 | if (current == end) { | ||
| 869 | - *processed_characters_count = current - input; | ||
| 870 | + *processed_characters_count = static_cast<int>(current - input); | ||
| 871 | return SignedZero(sign); | ||
| 872 | } | ||
| 873 | } | ||
| 874 | @@ -757,7 +851,7 @@ double StringToDoubleConverter::StringToIeee( | ||
| 875 | while (*current == '0') { | ||
| 876 | ++current; | ||
| 877 | if (current == end) { | ||
| 878 | - *processed_characters_count = current - input; | ||
| 879 | + *processed_characters_count = static_cast<int>(current - input); | ||
| 880 | return SignedZero(sign); | ||
| 881 | } | ||
| 882 | exponent--; // Move this 0 into the exponent. | ||
| 883 | @@ -793,20 +887,23 @@ double StringToDoubleConverter::StringToIeee( | ||
| 884 | if (*current == 'e' || *current == 'E') { | ||
| 885 | if (octal && !allow_trailing_junk) return junk_string_value_; | ||
| 886 | if (octal) goto parsing_done; | ||
| 887 | + Iterator junk_begin = current; | ||
| 888 | ++current; | ||
| 889 | if (current == end) { | ||
| 890 | if (allow_trailing_junk) { | ||
| 891 | + current = junk_begin; | ||
| 892 | goto parsing_done; | ||
| 893 | } else { | ||
| 894 | return junk_string_value_; | ||
| 895 | } | ||
| 896 | } | ||
| 897 | - char sign = '+'; | ||
| 898 | + char exponen_sign = '+'; | ||
| 899 | if (*current == '+' || *current == '-') { | ||
| 900 | - sign = static_cast<char>(*current); | ||
| 901 | + exponen_sign = static_cast<char>(*current); | ||
| 902 | ++current; | ||
| 903 | if (current == end) { | ||
| 904 | if (allow_trailing_junk) { | ||
| 905 | + current = junk_begin; | ||
| 906 | goto parsing_done; | ||
| 907 | } else { | ||
| 908 | return junk_string_value_; | ||
| 909 | @@ -816,6 +913,7 @@ double StringToDoubleConverter::StringToIeee( | ||
| 910 | |||
| 911 | if (current == end || *current < '0' || *current > '9') { | ||
| 912 | if (allow_trailing_junk) { | ||
| 913 | + current = junk_begin; | ||
| 914 | goto parsing_done; | ||
| 915 | } else { | ||
| 916 | return junk_string_value_; | ||
| 917 | @@ -837,7 +935,7 @@ double StringToDoubleConverter::StringToIeee( | ||
| 918 | ++current; | ||
| 919 | } while (current != end && *current >= '0' && *current <= '9'); | ||
| 920 | |||
| 921 | - exponent += (sign == '-' ? -num : num); | ||
| 922 | + exponent += (exponen_sign == '-' ? -num : num); | ||
| 923 | } | ||
| 924 | |||
| 925 | if (!(allow_trailing_spaces || allow_trailing_junk) && (current != end)) { | ||
| 926 | @@ -855,16 +953,17 @@ double StringToDoubleConverter::StringToIeee( | ||
| 927 | |||
| 928 | if (octal) { | ||
| 929 | double result; | ||
| 930 | - const char* tail_pointer = NULL; | ||
| 931 | - result = RadixStringToIeee<3>(buffer, | ||
| 932 | + bool result_is_junk; | ||
| 933 | + char* start = buffer; | ||
| 934 | + result = RadixStringToIeee<3>(&start, | ||
| 935 | buffer + buffer_pos, | ||
| 936 | sign, | ||
| 937 | allow_trailing_junk, | ||
| 938 | junk_string_value_, | ||
| 939 | read_as_double, | ||
| 940 | - &tail_pointer); | ||
| 941 | - ASSERT(tail_pointer != NULL); | ||
| 942 | - *processed_characters_count = current - input; | ||
| 943 | + &result_is_junk); | ||
| 944 | + ASSERT(!result_is_junk); | ||
| 945 | + *processed_characters_count = static_cast<int>(current - input); | ||
| 946 | return result; | ||
| 947 | } | ||
| 948 | |||
| 949 | @@ -882,8 +981,42 @@ double StringToDoubleConverter::StringToIeee( | ||
| 950 | } else { | ||
| 951 | converted = Strtof(Vector<const char>(buffer, buffer_pos), exponent); | ||
| 952 | } | ||
| 953 | - *processed_characters_count = current - input; | ||
| 954 | + *processed_characters_count = static_cast<int>(current - input); | ||
| 955 | return sign? -converted: converted; | ||
| 956 | } | ||
| 957 | |||
| 958 | + | ||
| 959 | +double StringToDoubleConverter::StringToDouble( | ||
| 960 | + const char* buffer, | ||
| 961 | + int length, | ||
| 962 | + int* processed_characters_count) const { | ||
| 963 | + return StringToIeee(buffer, length, true, processed_characters_count); | ||
| 964 | +} | ||
| 965 | + | ||
| 966 | + | ||
| 967 | +double StringToDoubleConverter::StringToDouble( | ||
| 968 | + const uc16* buffer, | ||
| 969 | + int length, | ||
| 970 | + int* processed_characters_count) const { | ||
| 971 | + return StringToIeee(buffer, length, true, processed_characters_count); | ||
| 972 | +} | ||
| 973 | + | ||
| 974 | + | ||
| 975 | +float StringToDoubleConverter::StringToFloat( | ||
| 976 | + const char* buffer, | ||
| 977 | + int length, | ||
| 978 | + int* processed_characters_count) const { | ||
| 979 | + return static_cast<float>(StringToIeee(buffer, length, false, | ||
| 980 | + processed_characters_count)); | ||
| 981 | +} | ||
| 982 | + | ||
| 983 | + | ||
| 984 | +float StringToDoubleConverter::StringToFloat( | ||
| 985 | + const uc16* buffer, | ||
| 986 | + int length, | ||
| 987 | + int* processed_characters_count) const { | ||
| 988 | + return static_cast<float>(StringToIeee(buffer, length, false, | ||
| 989 | + processed_characters_count)); | ||
| 990 | +} | ||
| 991 | + | ||
| 992 | } // namespace double_conversion | ||
| 993 | diff --git a/mfbt/double-conversion/double-conversion.h b/mfbt/double-conversion/double-conversion.h | ||
| 994 | index 0e7226d..e66a566 100644 | ||
| 995 | --- a/mfbt/double-conversion/double-conversion.h | ||
| 996 | +++ b/mfbt/double-conversion/double-conversion.h | ||
| 997 | @@ -28,8 +28,7 @@ | ||
| 998 | #ifndef DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_ | ||
| 999 | #define DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_ | ||
| 1000 | |||
| 1001 | -#include "mozilla/Types.h" | ||
| 1002 | -#include "utils.h" | ||
| 1003 | +#include <utils.h> | ||
| 1004 | |||
| 1005 | namespace double_conversion { | ||
| 1006 | |||
| 1007 | @@ -130,7 +129,7 @@ class DoubleToStringConverter { | ||
| 1008 | } | ||
| 1009 | |||
| 1010 | // Returns a converter following the EcmaScript specification. | ||
| 1011 | - static MFBT_API(const DoubleToStringConverter&) EcmaScriptConverter(); | ||
| 1012 | + static const DoubleToStringConverter& EcmaScriptConverter(); | ||
| 1013 | |||
| 1014 | // Computes the shortest string of digits that correctly represent the input | ||
| 1015 | // number. Depending on decimal_in_shortest_low and decimal_in_shortest_high | ||
| 1016 | @@ -198,7 +197,7 @@ class DoubleToStringConverter { | ||
| 1017 | // The last two conditions imply that the result will never contain more than | ||
| 1018 | // 1 + kMaxFixedDigitsBeforePoint + 1 + kMaxFixedDigitsAfterPoint characters | ||
| 1019 | // (one additional character for the sign, and one for the decimal point). | ||
| 1020 | - MFBT_API(bool) ToFixed(double value, | ||
| 1021 | + bool ToFixed(double value, | ||
| 1022 | int requested_digits, | ||
| 1023 | StringBuilder* result_builder) const; | ||
| 1024 | |||
| 1025 | @@ -230,7 +229,7 @@ class DoubleToStringConverter { | ||
| 1026 | // kMaxExponentialDigits + 8 characters (the sign, the digit before the | ||
| 1027 | // decimal point, the decimal point, the exponent character, the | ||
| 1028 | // exponent's sign, and at most 3 exponent digits). | ||
| 1029 | - MFBT_API(bool) ToExponential(double value, | ||
| 1030 | + bool ToExponential(double value, | ||
| 1031 | int requested_digits, | ||
| 1032 | StringBuilder* result_builder) const; | ||
| 1033 | |||
| 1034 | @@ -268,7 +267,7 @@ class DoubleToStringConverter { | ||
| 1035 | // The last condition implies that the result will never contain more than | ||
| 1036 | // kMaxPrecisionDigits + 7 characters (the sign, the decimal point, the | ||
| 1037 | // exponent character, the exponent's sign, and at most 3 exponent digits). | ||
| 1038 | - MFBT_API(bool) ToPrecision(double value, | ||
| 1039 | + bool ToPrecision(double value, | ||
| 1040 | int precision, | ||
| 1041 | StringBuilder* result_builder) const; | ||
| 1042 | |||
| 1043 | @@ -293,15 +292,20 @@ class DoubleToStringConverter { | ||
| 1044 | // kBase10MaximalLength. | ||
| 1045 | // Note that DoubleToAscii null-terminates its input. So the given buffer | ||
| 1046 | // should be at least kBase10MaximalLength + 1 characters long. | ||
| 1047 | - static const MFBT_DATA(int) kBase10MaximalLength = 17; | ||
| 1048 | + static const int kBase10MaximalLength = 17; | ||
| 1049 | |||
| 1050 | - // Converts the given double 'v' to ascii. 'v' must not be NaN, +Infinity, or | ||
| 1051 | - // -Infinity. In SHORTEST_SINGLE-mode this restriction also applies to 'v' | ||
| 1052 | - // after it has been casted to a single-precision float. That is, in this | ||
| 1053 | - // mode static_cast<float>(v) must not be NaN, +Infinity or -Infinity. | ||
| 1054 | + // Converts the given double 'v' to digit characters. 'v' must not be NaN, | ||
| 1055 | + // +Infinity, or -Infinity. In SHORTEST_SINGLE-mode this restriction also | ||
| 1056 | + // applies to 'v' after it has been casted to a single-precision float. That | ||
| 1057 | + // is, in this mode static_cast<float>(v) must not be NaN, +Infinity or | ||
| 1058 | + // -Infinity. | ||
| 1059 | // | ||
| 1060 | // The result should be interpreted as buffer * 10^(point-length). | ||
| 1061 | // | ||
| 1062 | + // The digits are written to the buffer in the platform's charset, which is | ||
| 1063 | + // often UTF-8 (with ASCII-range digits) but may be another charset, such | ||
| 1064 | + // as EBCDIC. | ||
| 1065 | + // | ||
| 1066 | // The output depends on the given mode: | ||
| 1067 | // - SHORTEST: produce the least amount of digits for which the internal | ||
| 1068 | // identity requirement is still satisfied. If the digits are printed | ||
| 1069 | @@ -333,7 +337,7 @@ class DoubleToStringConverter { | ||
| 1070 | // terminating null-character when computing the maximal output size. | ||
| 1071 | // The given length is only used in debug mode to ensure the buffer is big | ||
| 1072 | // enough. | ||
| 1073 | - static MFBT_API(void) DoubleToAscii(double v, | ||
| 1074 | + static void DoubleToAscii(double v, | ||
| 1075 | DtoaMode mode, | ||
| 1076 | int requested_digits, | ||
| 1077 | char* buffer, | ||
| 1078 | @@ -344,7 +348,7 @@ class DoubleToStringConverter { | ||
| 1079 | |||
| 1080 | private: | ||
| 1081 | // Implementation for ToShortest and ToShortestSingle. | ||
| 1082 | - MFBT_API(bool) ToShortestIeeeNumber(double value, | ||
| 1083 | + bool ToShortestIeeeNumber(double value, | ||
| 1084 | StringBuilder* result_builder, | ||
| 1085 | DtoaMode mode) const; | ||
| 1086 | |||
| 1087 | @@ -352,15 +356,15 @@ class DoubleToStringConverter { | ||
| 1088 | // corresponding string using the configured infinity/nan-symbol. | ||
| 1089 | // If either of them is NULL or the value is not special then the | ||
| 1090 | // function returns false. | ||
| 1091 | - MFBT_API(bool) HandleSpecialValues(double value, StringBuilder* result_builder) const; | ||
| 1092 | + bool HandleSpecialValues(double value, StringBuilder* result_builder) const; | ||
| 1093 | // Constructs an exponential representation (i.e. 1.234e56). | ||
| 1094 | // The given exponent assumes a decimal point after the first decimal digit. | ||
| 1095 | - MFBT_API(void) CreateExponentialRepresentation(const char* decimal_digits, | ||
| 1096 | + void CreateExponentialRepresentation(const char* decimal_digits, | ||
| 1097 | int length, | ||
| 1098 | int exponent, | ||
| 1099 | StringBuilder* result_builder) const; | ||
| 1100 | // Creates a decimal representation (i.e 1234.5678). | ||
| 1101 | - MFBT_API(void) CreateDecimalRepresentation(const char* decimal_digits, | ||
| 1102 | + void CreateDecimalRepresentation(const char* decimal_digits, | ||
| 1103 | int length, | ||
| 1104 | int decimal_point, | ||
| 1105 | int digits_after_point, | ||
| 1106 | @@ -375,7 +379,7 @@ class DoubleToStringConverter { | ||
| 1107 | const int max_leading_padding_zeroes_in_precision_mode_; | ||
| 1108 | const int max_trailing_padding_zeroes_in_precision_mode_; | ||
| 1109 | |||
| 1110 | - DISALLOW_IMPLICIT_CONSTRUCTORS(DoubleToStringConverter); | ||
| 1111 | + DC_DISALLOW_IMPLICIT_CONSTRUCTORS(DoubleToStringConverter); | ||
| 1112 | }; | ||
| 1113 | |||
| 1114 | |||
| 1115 | @@ -390,7 +394,8 @@ class StringToDoubleConverter { | ||
| 1116 | ALLOW_TRAILING_JUNK = 4, | ||
| 1117 | ALLOW_LEADING_SPACES = 8, | ||
| 1118 | ALLOW_TRAILING_SPACES = 16, | ||
| 1119 | - ALLOW_SPACES_AFTER_SIGN = 32 | ||
| 1120 | + ALLOW_SPACES_AFTER_SIGN = 32, | ||
| 1121 | + ALLOW_CASE_INSENSIBILITY = 64, | ||
| 1122 | }; | ||
| 1123 | |||
| 1124 | // Flags should be a bit-or combination of the possible Flags-enum. | ||
| 1125 | @@ -416,11 +421,14 @@ class StringToDoubleConverter { | ||
| 1126 | // junk, too. | ||
| 1127 | // - ALLOW_TRAILING_JUNK: ignore trailing characters that are not part of | ||
| 1128 | // a double literal. | ||
| 1129 | - // - ALLOW_LEADING_SPACES: skip over leading spaces. | ||
| 1130 | - // - ALLOW_TRAILING_SPACES: ignore trailing spaces. | ||
| 1131 | - // - ALLOW_SPACES_AFTER_SIGN: ignore spaces after the sign. | ||
| 1132 | + // - ALLOW_LEADING_SPACES: skip over leading whitespace, including spaces, | ||
| 1133 | + // new-lines, and tabs. | ||
| 1134 | + // - ALLOW_TRAILING_SPACES: ignore trailing whitespace. | ||
| 1135 | + // - ALLOW_SPACES_AFTER_SIGN: ignore whitespace after the sign. | ||
| 1136 | // Ex: StringToDouble("- 123.2") -> -123.2. | ||
| 1137 | // StringToDouble("+ 123.2") -> 123.2 | ||
| 1138 | + // - ALLOW_CASE_INSENSIBILITY: ignore case of characters for special values: | ||
| 1139 | + // infinity and nan. | ||
| 1140 | // | ||
| 1141 | // empty_string_value is returned when an empty string is given as input. | ||
| 1142 | // If ALLOW_LEADING_SPACES or ALLOW_TRAILING_SPACES are set, then a string | ||
| 1143 | @@ -503,19 +511,24 @@ class StringToDoubleConverter { | ||
| 1144 | // in the 'processed_characters_count'. Trailing junk is never included. | ||
| 1145 | double StringToDouble(const char* buffer, | ||
| 1146 | int length, | ||
| 1147 | - int* processed_characters_count) { | ||
| 1148 | - return StringToIeee(buffer, length, processed_characters_count, true); | ||
| 1149 | - } | ||
| 1150 | + int* processed_characters_count) const; | ||
| 1151 | + | ||
| 1152 | + // Same as StringToDouble above but for 16 bit characters. | ||
| 1153 | + double StringToDouble(const uc16* buffer, | ||
| 1154 | + int length, | ||
| 1155 | + int* processed_characters_count) const; | ||
| 1156 | |||
| 1157 | // Same as StringToDouble but reads a float. | ||
| 1158 | // Note that this is not equivalent to static_cast<float>(StringToDouble(...)) | ||
| 1159 | // due to potential double-rounding. | ||
| 1160 | float StringToFloat(const char* buffer, | ||
| 1161 | int length, | ||
| 1162 | - int* processed_characters_count) { | ||
| 1163 | - return static_cast<float>(StringToIeee(buffer, length, | ||
| 1164 | - processed_characters_count, false)); | ||
| 1165 | - } | ||
| 1166 | + int* processed_characters_count) const; | ||
| 1167 | + | ||
| 1168 | + // Same as StringToFloat above but for 16 bit characters. | ||
| 1169 | + float StringToFloat(const uc16* buffer, | ||
| 1170 | + int length, | ||
| 1171 | + int* processed_characters_count) const; | ||
| 1172 | |||
| 1173 | private: | ||
| 1174 | const int flags_; | ||
| 1175 | @@ -524,12 +537,13 @@ class StringToDoubleConverter { | ||
| 1176 | const char* const infinity_symbol_; | ||
| 1177 | const char* const nan_symbol_; | ||
| 1178 | |||
| 1179 | - double StringToIeee(const char* buffer, | ||
| 1180 | + template <class Iterator> | ||
| 1181 | + double StringToIeee(Iterator start_pointer, | ||
| 1182 | int length, | ||
| 1183 | - int* processed_characters_count, | ||
| 1184 | - bool read_as_double); | ||
| 1185 | + bool read_as_double, | ||
| 1186 | + int* processed_characters_count) const; | ||
| 1187 | |||
| 1188 | - DISALLOW_IMPLICIT_CONSTRUCTORS(StringToDoubleConverter); | ||
| 1189 | + DC_DISALLOW_IMPLICIT_CONSTRUCTORS(StringToDoubleConverter); | ||
| 1190 | }; | ||
| 1191 | |||
| 1192 | } // namespace double_conversion | ||
| 1193 | diff --git a/mfbt/double-conversion/fast-dtoa.cc b/mfbt/double-conversion/fast-dtoa.cc | ||
| 1194 | index 0609422..d338216 100644 | ||
| 1195 | --- a/mfbt/double-conversion/fast-dtoa.cc | ||
| 1196 | +++ b/mfbt/double-conversion/fast-dtoa.cc | ||
| 1197 | @@ -25,11 +25,11 @@ | ||
| 1198 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 1199 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 1200 | |||
| 1201 | -#include "fast-dtoa.h" | ||
| 1202 | +#include <fast-dtoa.h> | ||
| 1203 | |||
| 1204 | -#include "cached-powers.h" | ||
| 1205 | -#include "diy-fp.h" | ||
| 1206 | -#include "ieee.h" | ||
| 1207 | +#include <cached-powers.h> | ||
| 1208 | +#include <diy-fp.h> | ||
| 1209 | +#include <ieee.h> | ||
| 1210 | |||
| 1211 | namespace double_conversion { | ||
| 1212 | |||
| 1213 | @@ -248,10 +248,7 @@ static void BiggestPowerTen(uint32_t number, | ||
| 1214 | // Note: kPowersOf10[i] == 10^(i-1). | ||
| 1215 | exponent_plus_one_guess++; | ||
| 1216 | // We don't have any guarantees that 2^number_bits <= number. | ||
| 1217 | - // TODO(floitsch): can we change the 'while' into an 'if'? We definitely see | ||
| 1218 | - // number < (2^number_bits - 1), but I haven't encountered | ||
| 1219 | - // number < (2^number_bits - 2) yet. | ||
| 1220 | - while (number < kSmallPowersOfTen[exponent_plus_one_guess]) { | ||
| 1221 | + if (number < kSmallPowersOfTen[exponent_plus_one_guess]) { | ||
| 1222 | exponent_plus_one_guess--; | ||
| 1223 | } | ||
| 1224 | *power = kSmallPowersOfTen[exponent_plus_one_guess]; | ||
| 1225 | @@ -350,7 +347,8 @@ static bool DigitGen(DiyFp low, | ||
| 1226 | // that is smaller than integrals. | ||
| 1227 | while (*kappa > 0) { | ||
| 1228 | int digit = integrals / divisor; | ||
| 1229 | - buffer[*length] = '0' + digit; | ||
| 1230 | + ASSERT(digit <= 9); | ||
| 1231 | + buffer[*length] = static_cast<char>('0' + digit); | ||
| 1232 | (*length)++; | ||
| 1233 | integrals %= divisor; | ||
| 1234 | (*kappa)--; | ||
| 1235 | @@ -379,13 +377,14 @@ static bool DigitGen(DiyFp low, | ||
| 1236 | ASSERT(one.e() >= -60); | ||
| 1237 | ASSERT(fractionals < one.f()); | ||
| 1238 | ASSERT(UINT64_2PART_C(0xFFFFFFFF, FFFFFFFF) / 10 >= one.f()); | ||
| 1239 | - while (true) { | ||
| 1240 | + for (;;) { | ||
| 1241 | fractionals *= 10; | ||
| 1242 | unit *= 10; | ||
| 1243 | unsafe_interval.set_f(unsafe_interval.f() * 10); | ||
| 1244 | // Integer division by one. | ||
| 1245 | int digit = static_cast<int>(fractionals >> -one.e()); | ||
| 1246 | - buffer[*length] = '0' + digit; | ||
| 1247 | + ASSERT(digit <= 9); | ||
| 1248 | + buffer[*length] = static_cast<char>('0' + digit); | ||
| 1249 | (*length)++; | ||
| 1250 | fractionals &= one.f() - 1; // Modulo by one. | ||
| 1251 | (*kappa)--; | ||
| 1252 | @@ -459,7 +458,8 @@ static bool DigitGenCounted(DiyFp w, | ||
| 1253 | // that is smaller than 'integrals'. | ||
| 1254 | while (*kappa > 0) { | ||
| 1255 | int digit = integrals / divisor; | ||
| 1256 | - buffer[*length] = '0' + digit; | ||
| 1257 | + ASSERT(digit <= 9); | ||
| 1258 | + buffer[*length] = static_cast<char>('0' + digit); | ||
| 1259 | (*length)++; | ||
| 1260 | requested_digits--; | ||
| 1261 | integrals %= divisor; | ||
| 1262 | @@ -492,7 +492,8 @@ static bool DigitGenCounted(DiyFp w, | ||
| 1263 | w_error *= 10; | ||
| 1264 | // Integer division by one. | ||
| 1265 | int digit = static_cast<int>(fractionals >> -one.e()); | ||
| 1266 | - buffer[*length] = '0' + digit; | ||
| 1267 | + ASSERT(digit <= 9); | ||
| 1268 | + buffer[*length] = static_cast<char>('0' + digit); | ||
| 1269 | (*length)++; | ||
| 1270 | requested_digits--; | ||
| 1271 | fractionals &= one.f() - 1; // Modulo by one. | ||
| 1272 | @@ -529,7 +530,7 @@ static bool Grisu3(double v, | ||
| 1273 | if (mode == FAST_DTOA_SHORTEST) { | ||
| 1274 | Double(v).NormalizedBoundaries(&boundary_minus, &boundary_plus); | ||
| 1275 | } else { | ||
| 1276 | - assert(mode == FAST_DTOA_SHORTEST_SINGLE); | ||
| 1277 | + ASSERT(mode == FAST_DTOA_SHORTEST_SINGLE); | ||
| 1278 | float single_v = static_cast<float>(v); | ||
| 1279 | Single(single_v).NormalizedBoundaries(&boundary_minus, &boundary_plus); | ||
| 1280 | } | ||
| 1281 | diff --git a/mfbt/double-conversion/fast-dtoa.h b/mfbt/double-conversion/fast-dtoa.h | ||
| 1282 | index 5f1e8ee..9c4da92 100644 | ||
| 1283 | --- a/mfbt/double-conversion/fast-dtoa.h | ||
| 1284 | +++ b/mfbt/double-conversion/fast-dtoa.h | ||
| 1285 | @@ -28,7 +28,7 @@ | ||
| 1286 | #ifndef DOUBLE_CONVERSION_FAST_DTOA_H_ | ||
| 1287 | #define DOUBLE_CONVERSION_FAST_DTOA_H_ | ||
| 1288 | |||
| 1289 | -#include "utils.h" | ||
| 1290 | +#include <utils.h> | ||
| 1291 | |||
| 1292 | namespace double_conversion { | ||
| 1293 | |||
| 1294 | diff --git a/mfbt/double-conversion/fixed-dtoa.cc b/mfbt/double-conversion/fixed-dtoa.cc | ||
| 1295 | index d56b144..fa23529 100644 | ||
| 1296 | --- a/mfbt/double-conversion/fixed-dtoa.cc | ||
| 1297 | +++ b/mfbt/double-conversion/fixed-dtoa.cc | ||
| 1298 | @@ -25,10 +25,10 @@ | ||
| 1299 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 1300 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 1301 | |||
| 1302 | -#include <math.h> | ||
| 1303 | +#include <cmath> | ||
| 1304 | |||
| 1305 | -#include "fixed-dtoa.h" | ||
| 1306 | -#include "ieee.h" | ||
| 1307 | +#include <fixed-dtoa.h> | ||
| 1308 | +#include <ieee.h> | ||
| 1309 | |||
| 1310 | namespace double_conversion { | ||
| 1311 | |||
| 1312 | @@ -98,7 +98,7 @@ class UInt128 { | ||
| 1313 | return high_bits_ == 0 && low_bits_ == 0; | ||
| 1314 | } | ||
| 1315 | |||
| 1316 | - int BitAt(int position) { | ||
| 1317 | + int BitAt(int position) const { | ||
| 1318 | if (position >= 64) { | ||
| 1319 | return static_cast<int>(high_bits_ >> (position - 64)) & 1; | ||
| 1320 | } else { | ||
| 1321 | @@ -133,7 +133,7 @@ static void FillDigits32(uint32_t number, Vector<char> buffer, int* length) { | ||
| 1322 | while (number != 0) { | ||
| 1323 | int digit = number % 10; | ||
| 1324 | number /= 10; | ||
| 1325 | - buffer[(*length) + number_length] = '0' + digit; | ||
| 1326 | + buffer[(*length) + number_length] = static_cast<char>('0' + digit); | ||
| 1327 | number_length++; | ||
| 1328 | } | ||
| 1329 | // Exchange the digits. | ||
| 1330 | @@ -150,7 +150,7 @@ static void FillDigits32(uint32_t number, Vector<char> buffer, int* length) { | ||
| 1331 | } | ||
| 1332 | |||
| 1333 | |||
| 1334 | -static void FillDigits64FixedLength(uint64_t number, int requested_length, | ||
| 1335 | +static void FillDigits64FixedLength(uint64_t number, | ||
| 1336 | Vector<char> buffer, int* length) { | ||
| 1337 | const uint32_t kTen7 = 10000000; | ||
| 1338 | // For efficiency cut the number into 3 uint32_t parts, and print those. | ||
| 1339 | @@ -253,12 +253,14 @@ static void FillFractionals(uint64_t fractionals, int exponent, | ||
| 1340 | fractionals *= 5; | ||
| 1341 | point--; | ||
| 1342 | int digit = static_cast<int>(fractionals >> point); | ||
| 1343 | - buffer[*length] = '0' + digit; | ||
| 1344 | + ASSERT(digit <= 9); | ||
| 1345 | + buffer[*length] = static_cast<char>('0' + digit); | ||
| 1346 | (*length)++; | ||
| 1347 | fractionals -= static_cast<uint64_t>(digit) << point; | ||
| 1348 | } | ||
| 1349 | // If the first bit after the point is set we have to round up. | ||
| 1350 | - if (((fractionals >> (point - 1)) & 1) == 1) { | ||
| 1351 | + ASSERT(fractionals == 0 || point - 1 >= 0); | ||
| 1352 | + if ((fractionals != 0) && ((fractionals >> (point - 1)) & 1) == 1) { | ||
| 1353 | RoundUp(buffer, length, decimal_point); | ||
| 1354 | } | ||
| 1355 | } else { // We need 128 bits. | ||
| 1356 | @@ -274,7 +276,8 @@ static void FillFractionals(uint64_t fractionals, int exponent, | ||
| 1357 | fractionals128.Multiply(5); | ||
| 1358 | point--; | ||
| 1359 | int digit = fractionals128.DivModPowerOf2(point); | ||
| 1360 | - buffer[*length] = '0' + digit; | ||
| 1361 | + ASSERT(digit <= 9); | ||
| 1362 | + buffer[*length] = static_cast<char>('0' + digit); | ||
| 1363 | (*length)++; | ||
| 1364 | } | ||
| 1365 | if (fractionals128.BitAt(point - 1) == 1) { | ||
| 1366 | @@ -358,7 +361,7 @@ bool FastFixedDtoa(double v, | ||
| 1367 | remainder = (dividend % divisor) << exponent; | ||
| 1368 | } | ||
| 1369 | FillDigits32(quotient, buffer, length); | ||
| 1370 | - FillDigits64FixedLength(remainder, divisor_power, buffer, length); | ||
| 1371 | + FillDigits64FixedLength(remainder, buffer, length); | ||
| 1372 | *decimal_point = *length; | ||
| 1373 | } else if (exponent >= 0) { | ||
| 1374 | // 0 <= exponent <= 11 | ||
| 1375 | diff --git a/mfbt/double-conversion/fixed-dtoa.h b/mfbt/double-conversion/fixed-dtoa.h | ||
| 1376 | index 3bdd08e..19fd2e7 100644 | ||
| 1377 | --- a/mfbt/double-conversion/fixed-dtoa.h | ||
| 1378 | +++ b/mfbt/double-conversion/fixed-dtoa.h | ||
| 1379 | @@ -28,7 +28,7 @@ | ||
| 1380 | #ifndef DOUBLE_CONVERSION_FIXED_DTOA_H_ | ||
| 1381 | #define DOUBLE_CONVERSION_FIXED_DTOA_H_ | ||
| 1382 | |||
| 1383 | -#include "utils.h" | ||
| 1384 | +#include <utils.h> | ||
| 1385 | |||
| 1386 | namespace double_conversion { | ||
| 1387 | |||
| 1388 | diff --git a/mfbt/double-conversion/ieee.h b/mfbt/double-conversion/ieee.h | ||
| 1389 | index 839dc47..8949b02 100644 | ||
| 1390 | --- a/mfbt/double-conversion/ieee.h | ||
| 1391 | +++ b/mfbt/double-conversion/ieee.h | ||
| 1392 | @@ -28,7 +28,7 @@ | ||
| 1393 | #ifndef DOUBLE_CONVERSION_DOUBLE_H_ | ||
| 1394 | #define DOUBLE_CONVERSION_DOUBLE_H_ | ||
| 1395 | |||
| 1396 | -#include "diy-fp.h" | ||
| 1397 | +#include <diy-fp.h> | ||
| 1398 | |||
| 1399 | namespace double_conversion { | ||
| 1400 | |||
| 1401 | @@ -99,7 +99,7 @@ class Double { | ||
| 1402 | } | ||
| 1403 | |||
| 1404 | double PreviousDouble() const { | ||
| 1405 | - if (d64_ == (kInfinity | kSignMask)) return -Double::Infinity(); | ||
| 1406 | + if (d64_ == (kInfinity | kSignMask)) return -Infinity(); | ||
| 1407 | if (Sign() < 0) { | ||
| 1408 | return Double(d64_ + 1).value(); | ||
| 1409 | } else { | ||
| 1410 | @@ -256,6 +256,8 @@ class Double { | ||
| 1411 | return (significand & kSignificandMask) | | ||
| 1412 | (biased_exponent << kPhysicalSignificandSize); | ||
| 1413 | } | ||
| 1414 | + | ||
| 1415 | + DC_DISALLOW_COPY_AND_ASSIGN(Double); | ||
| 1416 | }; | ||
| 1417 | |||
| 1418 | class Single { | ||
| 1419 | @@ -391,6 +393,8 @@ class Single { | ||
| 1420 | static const uint32_t kNaN = 0x7FC00000; | ||
| 1421 | |||
| 1422 | const uint32_t d32_; | ||
| 1423 | + | ||
| 1424 | + DC_DISALLOW_COPY_AND_ASSIGN(Single); | ||
| 1425 | }; | ||
| 1426 | |||
| 1427 | } // namespace double_conversion | ||
| 1428 | diff --git a/mfbt/double-conversion/strtod.cc b/mfbt/double-conversion/strtod.cc | ||
| 1429 | index d773f44..a9e85c1 100644 | ||
| 1430 | --- a/mfbt/double-conversion/strtod.cc | ||
| 1431 | +++ b/mfbt/double-conversion/strtod.cc | ||
| 1432 | @@ -25,13 +25,13 @@ | ||
| 1433 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 1434 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 1435 | |||
| 1436 | -#include <stdarg.h> | ||
| 1437 | -#include <limits.h> | ||
| 1438 | +#include <climits> | ||
| 1439 | +#include <cstdarg> | ||
| 1440 | |||
| 1441 | -#include "strtod.h" | ||
| 1442 | -#include "bignum.h" | ||
| 1443 | -#include "cached-powers.h" | ||
| 1444 | -#include "ieee.h" | ||
| 1445 | +#include <bignum.h> | ||
| 1446 | +#include <cached-powers.h> | ||
| 1447 | +#include <ieee.h> | ||
| 1448 | +#include <strtod.h> | ||
| 1449 | |||
| 1450 | namespace double_conversion { | ||
| 1451 | |||
| 1452 | @@ -137,6 +137,7 @@ static void TrimAndCut(Vector<const char> buffer, int exponent, | ||
| 1453 | Vector<const char> right_trimmed = TrimTrailingZeros(left_trimmed); | ||
| 1454 | exponent += left_trimmed.length() - right_trimmed.length(); | ||
| 1455 | if (right_trimmed.length() > kMaxSignificantDecimalDigits) { | ||
| 1456 | + (void) space_size; // Mark variable as used. | ||
| 1457 | ASSERT(space_size >= kMaxSignificantDecimalDigits); | ||
| 1458 | CutToMaxSignificantDigits(right_trimmed, exponent, | ||
| 1459 | buffer_copy_space, updated_exponent); | ||
| 1460 | @@ -204,7 +205,7 @@ static bool DoubleStrtod(Vector<const char> trimmed, | ||
| 1461 | // Note that the ARM simulator is compiled for 32bits. It therefore exhibits | ||
| 1462 | // the same problem. | ||
| 1463 | return false; | ||
| 1464 | -#endif | ||
| 1465 | +#else | ||
| 1466 | if (trimmed.length() <= kMaxExactDoubleIntegerDecimalDigits) { | ||
| 1467 | int read_digits; | ||
| 1468 | // The trimmed input fits into a double. | ||
| 1469 | @@ -242,6 +243,7 @@ static bool DoubleStrtod(Vector<const char> trimmed, | ||
| 1470 | } | ||
| 1471 | } | ||
| 1472 | return false; | ||
| 1473 | +#endif | ||
| 1474 | } | ||
| 1475 | |||
| 1476 | |||
| 1477 | @@ -263,7 +265,6 @@ static DiyFp AdjustmentPowerOfTen(int exponent) { | ||
| 1478 | case 7: return DiyFp(UINT64_2PART_C(0x98968000, 00000000), -40); | ||
| 1479 | default: | ||
| 1480 | UNREACHABLE(); | ||
| 1481 | - return DiyFp(0, 0); | ||
| 1482 | } | ||
| 1483 | } | ||
| 1484 | |||
| 1485 | @@ -286,7 +287,7 @@ static bool DiyFpStrtod(Vector<const char> buffer, | ||
| 1486 | const int kDenominator = 1 << kDenominatorLog; | ||
| 1487 | // Move the remaining decimals into the exponent. | ||
| 1488 | exponent += remaining_decimals; | ||
| 1489 | - int error = (remaining_decimals == 0 ? 0 : kDenominator / 2); | ||
| 1490 | + uint64_t error = (remaining_decimals == 0 ? 0 : kDenominator / 2); | ||
| 1491 | |||
| 1492 | int old_e = input.e(); | ||
| 1493 | input.Normalize(); | ||
| 1494 | @@ -471,6 +472,30 @@ double Strtod(Vector<const char> buffer, int exponent) { | ||
| 1495 | } | ||
| 1496 | } | ||
| 1497 | |||
| 1498 | +static float SanitizedDoubletof(double d) { | ||
| 1499 | + ASSERT(d >= 0.0); | ||
| 1500 | + // ASAN has a sanitize check that disallows casting doubles to floats if | ||
| 1501 | + // they are too big. | ||
| 1502 | + // https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#available-checks | ||
| 1503 | + // The behavior should be covered by IEEE 754, but some projects use this | ||
| 1504 | + // flag, so work around it. | ||
| 1505 | + float max_finite = 3.4028234663852885981170418348451692544e+38; | ||
| 1506 | + // The half-way point between the max-finite and infinity value. | ||
| 1507 | + // Since infinity has an even significand everything equal or greater than | ||
| 1508 | + // this value should become infinity. | ||
| 1509 | + double half_max_finite_infinity = | ||
| 1510 | + 3.40282356779733661637539395458142568448e+38; | ||
| 1511 | + if (d >= max_finite) { | ||
| 1512 | + if (d >= half_max_finite_infinity) { | ||
| 1513 | + return Single::Infinity(); | ||
| 1514 | + } else { | ||
| 1515 | + return max_finite; | ||
| 1516 | + } | ||
| 1517 | + } else { | ||
| 1518 | + return static_cast<float>(d); | ||
| 1519 | + } | ||
| 1520 | +} | ||
| 1521 | + | ||
| 1522 | float Strtof(Vector<const char> buffer, int exponent) { | ||
| 1523 | char copy_buffer[kMaxSignificantDecimalDigits]; | ||
| 1524 | Vector<const char> trimmed; | ||
| 1525 | @@ -482,7 +507,7 @@ float Strtof(Vector<const char> buffer, int exponent) { | ||
| 1526 | double double_guess; | ||
| 1527 | bool is_correct = ComputeGuess(trimmed, exponent, &double_guess); | ||
| 1528 | |||
| 1529 | - float float_guess = static_cast<float>(double_guess); | ||
| 1530 | + float float_guess = SanitizedDoubletof(double_guess); | ||
| 1531 | if (float_guess == double_guess) { | ||
| 1532 | // This shortcut triggers for integer values. | ||
| 1533 | return float_guess; | ||
| 1534 | @@ -505,18 +530,18 @@ float Strtof(Vector<const char> buffer, int exponent) { | ||
| 1535 | double double_next = Double(double_guess).NextDouble(); | ||
| 1536 | double double_previous = Double(double_guess).PreviousDouble(); | ||
| 1537 | |||
| 1538 | - float f1 = static_cast<float>(double_previous); | ||
| 1539 | + float f1 = SanitizedDoubletof(double_previous); | ||
| 1540 | float f2 = float_guess; | ||
| 1541 | - float f3 = static_cast<float>(double_next); | ||
| 1542 | + float f3 = SanitizedDoubletof(double_next); | ||
| 1543 | float f4; | ||
| 1544 | if (is_correct) { | ||
| 1545 | f4 = f3; | ||
| 1546 | } else { | ||
| 1547 | double double_next2 = Double(double_next).NextDouble(); | ||
| 1548 | - f4 = static_cast<float>(double_next2); | ||
| 1549 | + f4 = SanitizedDoubletof(double_next2); | ||
| 1550 | } | ||
| 1551 | - (void)f2; | ||
| 1552 | - assert(f1 <= f2 && f2 <= f3 && f3 <= f4); | ||
| 1553 | + (void) f2; // Mark variable as used. | ||
| 1554 | + ASSERT(f1 <= f2 && f2 <= f3 && f3 <= f4); | ||
| 1555 | |||
| 1556 | // If the guess doesn't lie near a single-precision boundary we can simply | ||
| 1557 | // return its float-value. | ||
| 1558 | @@ -524,11 +549,11 @@ float Strtof(Vector<const char> buffer, int exponent) { | ||
| 1559 | return float_guess; | ||
| 1560 | } | ||
| 1561 | |||
| 1562 | - assert((f1 != f2 && f2 == f3 && f3 == f4) || | ||
| 1563 | + ASSERT((f1 != f2 && f2 == f3 && f3 == f4) || | ||
| 1564 | (f1 == f2 && f2 != f3 && f3 == f4) || | ||
| 1565 | (f1 == f2 && f2 == f3 && f3 != f4)); | ||
| 1566 | |||
| 1567 | - // guess and next are the two possible canditates (in the same way that | ||
| 1568 | + // guess and next are the two possible candidates (in the same way that | ||
| 1569 | // double_guess was the lower candidate for a double-precision guess). | ||
| 1570 | float guess = f1; | ||
| 1571 | float next = f4; | ||
| 1572 | diff --git a/mfbt/double-conversion/strtod.h b/mfbt/double-conversion/strtod.h | ||
| 1573 | index ed0293b..58c4926 100644 | ||
| 1574 | --- a/mfbt/double-conversion/strtod.h | ||
| 1575 | +++ b/mfbt/double-conversion/strtod.h | ||
| 1576 | @@ -28,7 +28,7 @@ | ||
| 1577 | #ifndef DOUBLE_CONVERSION_STRTOD_H_ | ||
| 1578 | #define DOUBLE_CONVERSION_STRTOD_H_ | ||
| 1579 | |||
| 1580 | -#include "utils.h" | ||
| 1581 | +#include <utils.h> | ||
| 1582 | |||
| 1583 | namespace double_conversion { | ||
| 1584 | |||
| 1585 | diff --git a/mfbt/double-conversion/utils.h b/mfbt/double-conversion/utils.h | ||
| 1586 | index 0eec2d9..a748654 100644 | ||
| 1587 | --- a/mfbt/double-conversion/utils.h | ||
| 1588 | +++ b/mfbt/double-conversion/utils.h | ||
| 1589 | @@ -28,19 +28,34 @@ | ||
| 1590 | #ifndef DOUBLE_CONVERSION_UTILS_H_ | ||
| 1591 | #define DOUBLE_CONVERSION_UTILS_H_ | ||
| 1592 | |||
| 1593 | -#include <stdlib.h> | ||
| 1594 | -#include <string.h> | ||
| 1595 | +#include <cstdlib> | ||
| 1596 | +#include <cstring> | ||
| 1597 | |||
| 1598 | -#include <assert.h> | ||
| 1599 | +#include <cassert> | ||
| 1600 | #ifndef ASSERT | ||
| 1601 | -#define ASSERT(condition) (assert(condition)) | ||
| 1602 | +#define ASSERT(condition) \ | ||
| 1603 | + assert(condition); | ||
| 1604 | #endif | ||
| 1605 | #ifndef UNIMPLEMENTED | ||
| 1606 | #define UNIMPLEMENTED() (abort()) | ||
| 1607 | #endif | ||
| 1608 | +#ifndef DOUBLE_CONVERSION_NO_RETURN | ||
| 1609 | +#ifdef _MSC_VER | ||
| 1610 | +#define DOUBLE_CONVERSION_NO_RETURN __declspec(noreturn) | ||
| 1611 | +#else | ||
| 1612 | +#define DOUBLE_CONVERSION_NO_RETURN __attribute__((noreturn)) | ||
| 1613 | +#endif | ||
| 1614 | +#endif | ||
| 1615 | #ifndef UNREACHABLE | ||
| 1616 | +#ifdef _MSC_VER | ||
| 1617 | +void DOUBLE_CONVERSION_NO_RETURN abort_noreturn(); | ||
| 1618 | +inline void abort_noreturn() { abort(); } | ||
| 1619 | +#define UNREACHABLE() (abort_noreturn()) | ||
| 1620 | +#else | ||
| 1621 | #define UNREACHABLE() (abort()) | ||
| 1622 | #endif | ||
| 1623 | +#endif | ||
| 1624 | + | ||
| 1625 | |||
| 1626 | // Double operations detection based on target architecture. | ||
| 1627 | // Linux uses a 80bit wide floating point stack on x86. This induces double | ||
| 1628 | @@ -55,11 +70,18 @@ | ||
| 1629 | #if defined(_M_X64) || defined(__x86_64__) || \ | ||
| 1630 | defined(__ARMEL__) || defined(__avr32__) || \ | ||
| 1631 | defined(__hppa__) || defined(__ia64__) || \ | ||
| 1632 | - defined(__mips__) || defined(__powerpc__) || \ | ||
| 1633 | + defined(__mips__) || \ | ||
| 1634 | + defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) || \ | ||
| 1635 | + defined(_POWER) || defined(_ARCH_PPC) || defined(_ARCH_PPC64) || \ | ||
| 1636 | defined(__sparc__) || defined(__sparc) || defined(__s390__) || \ | ||
| 1637 | defined(__SH4__) || defined(__alpha__) || \ | ||
| 1638 | - defined(_MIPS_ARCH_MIPS32R2) | ||
| 1639 | + defined(_MIPS_ARCH_MIPS32R2) || \ | ||
| 1640 | + defined(__AARCH64EL__) || defined(__aarch64__) || \ | ||
| 1641 | + defined(__riscv) | ||
| 1642 | #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 | ||
| 1643 | +#elif defined(__mc68000__) || \ | ||
| 1644 | + defined(__pnacl__) || defined(__native_client__) | ||
| 1645 | +#undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS | ||
| 1646 | #elif defined(_M_IX86) || defined(__i386__) || defined(__i386) | ||
| 1647 | #if defined(_WIN32) | ||
| 1648 | // Windows uses a 64bit wide floating point stack. | ||
| 1649 | @@ -71,9 +93,10 @@ | ||
| 1650 | #error Target architecture was not detected as supported by Double-Conversion. | ||
| 1651 | #endif | ||
| 1652 | |||
| 1653 | - | ||
| 1654 | #include "mozilla/StandardInteger.h" | ||
| 1655 | |||
| 1656 | +typedef uint16_t uc16; | ||
| 1657 | + | ||
| 1658 | // The following macro works on both 32 and 64-bit platforms. | ||
| 1659 | // Usage: instead of writing 0x1234567890123456 | ||
| 1660 | // write UINT64_2PART_C(0x12345678,90123456); | ||
| 1661 | @@ -92,8 +115,8 @@ | ||
| 1662 | |||
| 1663 | // A macro to disallow the evil copy constructor and operator= functions | ||
| 1664 | // This should be used in the private: declarations for a class | ||
| 1665 | -#ifndef DISALLOW_COPY_AND_ASSIGN | ||
| 1666 | -#define DISALLOW_COPY_AND_ASSIGN(TypeName) \ | ||
| 1667 | +#ifndef DC_DISALLOW_COPY_AND_ASSIGN | ||
| 1668 | +#define DC_DISALLOW_COPY_AND_ASSIGN(TypeName) \ | ||
| 1669 | TypeName(const TypeName&); \ | ||
| 1670 | void operator=(const TypeName&) | ||
| 1671 | #endif | ||
| 1672 | @@ -104,10 +127,10 @@ | ||
| 1673 | // This should be used in the private: declarations for a class | ||
| 1674 | // that wants to prevent anyone from instantiating it. This is | ||
| 1675 | // especially useful for classes containing only static methods. | ||
| 1676 | -#ifndef DISALLOW_IMPLICIT_CONSTRUCTORS | ||
| 1677 | -#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ | ||
| 1678 | +#ifndef DC_DISALLOW_IMPLICIT_CONSTRUCTORS | ||
| 1679 | +#define DC_DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ | ||
| 1680 | TypeName(); \ | ||
| 1681 | - DISALLOW_COPY_AND_ASSIGN(TypeName) | ||
| 1682 | + DC_DISALLOW_COPY_AND_ASSIGN(TypeName) | ||
| 1683 | #endif | ||
| 1684 | |||
| 1685 | namespace double_conversion { | ||
| 1686 | @@ -139,8 +162,8 @@ template <typename T> | ||
| 1687 | class Vector { | ||
| 1688 | public: | ||
| 1689 | Vector() : start_(NULL), length_(0) {} | ||
| 1690 | - Vector(T* data, int length) : start_(data), length_(length) { | ||
| 1691 | - ASSERT(length == 0 || (length > 0 && data != NULL)); | ||
| 1692 | + Vector(T* data, int len) : start_(data), length_(len) { | ||
| 1693 | + ASSERT(len == 0 || (len > 0 && data != NULL)); | ||
| 1694 | } | ||
| 1695 | |||
| 1696 | // Returns a vector using the same backing storage as this one, | ||
| 1697 | @@ -182,8 +205,8 @@ class Vector { | ||
| 1698 | // buffer bounds on all operations in debug mode. | ||
| 1699 | class StringBuilder { | ||
| 1700 | public: | ||
| 1701 | - StringBuilder(char* buffer, int size) | ||
| 1702 | - : buffer_(buffer, size), position_(0) { } | ||
| 1703 | + StringBuilder(char* buffer, int buffer_size) | ||
| 1704 | + : buffer_(buffer, buffer_size), position_(0) { } | ||
| 1705 | |||
| 1706 | ~StringBuilder() { if (!is_finalized()) Finalize(); } | ||
| 1707 | |||
| 1708 | @@ -249,7 +272,7 @@ class StringBuilder { | ||
| 1709 | |||
| 1710 | bool is_finalized() const { return position_ < 0; } | ||
| 1711 | |||
| 1712 | - DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder); | ||
| 1713 | + DC_DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder); | ||
| 1714 | }; | ||
| 1715 | |||
| 1716 | // The type-based aliasing rule allows the compiler to assume that pointers of | ||
| 1717 | @@ -280,7 +303,12 @@ template <class Dest, class Source> | ||
| 1718 | inline Dest BitCast(const Source& source) { | ||
| 1719 | // Compile time assertion: sizeof(Dest) == sizeof(Source) | ||
| 1720 | // A compile error here means your Dest and Source have different sizes. | ||
| 1721 | +#if __cplusplus >= 201103L | ||
| 1722 | + static_assert(sizeof(Dest) == sizeof(Source), | ||
| 1723 | + "source and destination size mismatch"); | ||
| 1724 | +#else | ||
| 1725 | typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1]; | ||
| 1726 | +#endif | ||
| 1727 | |||
| 1728 | Dest dest; | ||
| 1729 | memmove(&dest, &source, sizeof(dest)); | ||
| 1730 | -- | ||
| 1731 | 2.17.0 | ||
| 1732 | |||
diff --git a/meta-oe/recipes-extended/mozjs/mozjs/Update-the-double-conversion-update-script.patch b/meta-oe/recipes-extended/mozjs/mozjs/Update-the-double-conversion-update-script.patch new file mode 100644 index 0000000000..ffeac49826 --- /dev/null +++ b/meta-oe/recipes-extended/mozjs/mozjs/Update-the-double-conversion-update-script.patch | |||
| @@ -0,0 +1,175 @@ | |||
| 1 | From 1c3f6dd9bb478fea0622e8a9ba2efbf19d73e302 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Alistair Francis <alistair.francis@wdc.com> | ||
| 3 | Date: Fri, 1 Jun 2018 14:46:47 -0700 | ||
| 4 | Subject: [PATCH] Update the double conversion update script | ||
| 5 | |||
| 6 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
| 7 | --- | ||
| 8 | .../add-mfbt-api-markers.patch | 94 ------------------- | ||
| 9 | .../more-architectures.patch | 30 ------ | ||
| 10 | mfbt/double-conversion/update.sh | 8 +- | ||
| 11 | 3 files changed, 3 insertions(+), 129 deletions(-) | ||
| 12 | delete mode 100644 mfbt/double-conversion/add-mfbt-api-markers.patch | ||
| 13 | delete mode 100644 mfbt/double-conversion/more-architectures.patch | ||
| 14 | |||
| 15 | diff --git a/mfbt/double-conversion/add-mfbt-api-markers.patch b/mfbt/double-conversion/add-mfbt-api-markers.patch | ||
| 16 | deleted file mode 100644 | ||
| 17 | index b98ec74..0000000 | ||
| 18 | --- a/mfbt/double-conversion/add-mfbt-api-markers.patch | ||
| 19 | +++ /dev/null | ||
| 20 | @@ -1,94 +0,0 @@ | ||
| 21 | -diff --git a/mfbt/double-conversion/double-conversion.h b/mfbt/double-conversion/double-conversion.h | ||
| 22 | -index f98edae..e536a01 100644 | ||
| 23 | ---- a/mfbt/double-conversion/double-conversion.h | ||
| 24 | -+++ b/mfbt/double-conversion/double-conversion.h | ||
| 25 | -@@ -28,6 +28,7 @@ | ||
| 26 | - #ifndef DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_ | ||
| 27 | - #define DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_ | ||
| 28 | - | ||
| 29 | -+#include "mozilla/Types.h" | ||
| 30 | - #include "utils.h" | ||
| 31 | - | ||
| 32 | - namespace double_conversion { | ||
| 33 | -@@ -129,7 +130,7 @@ class DoubleToStringConverter { | ||
| 34 | - } | ||
| 35 | - | ||
| 36 | - // Returns a converter following the EcmaScript specification. | ||
| 37 | -- static const DoubleToStringConverter& EcmaScriptConverter(); | ||
| 38 | -+ static MFBT_API(const DoubleToStringConverter&) EcmaScriptConverter(); | ||
| 39 | - | ||
| 40 | - // Computes the shortest string of digits that correctly represent the input | ||
| 41 | - // number. Depending on decimal_in_shortest_low and decimal_in_shortest_high | ||
| 42 | -@@ -197,7 +198,7 @@ class DoubleToStringConverter { | ||
| 43 | - // The last two conditions imply that the result will never contain more than | ||
| 44 | - // 1 + kMaxFixedDigitsBeforePoint + 1 + kMaxFixedDigitsAfterPoint characters | ||
| 45 | - // (one additional character for the sign, and one for the decimal point). | ||
| 46 | -- bool ToFixed(double value, | ||
| 47 | -+ MFBT_API(bool) ToFixed(double value, | ||
| 48 | - int requested_digits, | ||
| 49 | - StringBuilder* result_builder) const; | ||
| 50 | - | ||
| 51 | -@@ -229,7 +230,7 @@ class DoubleToStringConverter { | ||
| 52 | - // kMaxExponentialDigits + 8 characters (the sign, the digit before the | ||
| 53 | - // decimal point, the decimal point, the exponent character, the | ||
| 54 | - // exponent's sign, and at most 3 exponent digits). | ||
| 55 | -- bool ToExponential(double value, | ||
| 56 | -+ MFBT_API(bool) ToExponential(double value, | ||
| 57 | - int requested_digits, | ||
| 58 | - StringBuilder* result_builder) const; | ||
| 59 | - | ||
| 60 | -@@ -267,7 +268,7 @@ class DoubleToStringConverter { | ||
| 61 | - // The last condition implies that the result will never contain more than | ||
| 62 | - // kMaxPrecisionDigits + 7 characters (the sign, the decimal point, the | ||
| 63 | - // exponent character, the exponent's sign, and at most 3 exponent digits). | ||
| 64 | -- bool ToPrecision(double value, | ||
| 65 | -+ MFBT_API(bool) ToPrecision(double value, | ||
| 66 | - int precision, | ||
| 67 | - StringBuilder* result_builder) const; | ||
| 68 | - | ||
| 69 | -@@ -292,7 +293,7 @@ class DoubleToStringConverter { | ||
| 70 | - // kBase10MaximalLength. | ||
| 71 | - // Note that DoubleToAscii null-terminates its input. So the given buffer | ||
| 72 | - // should be at least kBase10MaximalLength + 1 characters long. | ||
| 73 | -- static const int kBase10MaximalLength = 17; | ||
| 74 | -+ static const MFBT_DATA(int) kBase10MaximalLength = 17; | ||
| 75 | - | ||
| 76 | - // Converts the given double 'v' to ascii. 'v' must not be NaN, +Infinity, or | ||
| 77 | - // -Infinity. In SHORTEST_SINGLE-mode this restriction also applies to 'v' | ||
| 78 | -@@ -332,7 +333,7 @@ class DoubleToStringConverter { | ||
| 79 | - // terminating null-character when computing the maximal output size. | ||
| 80 | - // The given length is only used in debug mode to ensure the buffer is big | ||
| 81 | - // enough. | ||
| 82 | -- static void DoubleToAscii(double v, | ||
| 83 | -+ static MFBT_API(void) DoubleToAscii(double v, | ||
| 84 | - DtoaMode mode, | ||
| 85 | - int requested_digits, | ||
| 86 | - char* buffer, | ||
| 87 | -@@ -343,7 +344,7 @@ class DoubleToStringConverter { | ||
| 88 | - | ||
| 89 | - private: | ||
| 90 | - // Implementation for ToShortest and ToShortestSingle. | ||
| 91 | -- bool ToShortestIeeeNumber(double value, | ||
| 92 | -+ MFBT_API(bool) ToShortestIeeeNumber(double value, | ||
| 93 | - StringBuilder* result_builder, | ||
| 94 | - DtoaMode mode) const; | ||
| 95 | - | ||
| 96 | -@@ -351,15 +352,15 @@ class DoubleToStringConverter { | ||
| 97 | - // corresponding string using the configured infinity/nan-symbol. | ||
| 98 | - // If either of them is NULL or the value is not special then the | ||
| 99 | - // function returns false. | ||
| 100 | -- bool HandleSpecialValues(double value, StringBuilder* result_builder) const; | ||
| 101 | -+ MFBT_API(bool) HandleSpecialValues(double value, StringBuilder* result_builder) const; | ||
| 102 | - // Constructs an exponential representation (i.e. 1.234e56). | ||
| 103 | - // The given exponent assumes a decimal point after the first decimal digit. | ||
| 104 | -- void CreateExponentialRepresentation(const char* decimal_digits, | ||
| 105 | -+ MFBT_API(void) CreateExponentialRepresentation(const char* decimal_digits, | ||
| 106 | - int length, | ||
| 107 | - int exponent, | ||
| 108 | - StringBuilder* result_builder) const; | ||
| 109 | - // Creates a decimal representation (i.e 1234.5678). | ||
| 110 | -- void CreateDecimalRepresentation(const char* decimal_digits, | ||
| 111 | -+ MFBT_API(void) CreateDecimalRepresentation(const char* decimal_digits, | ||
| 112 | - int length, | ||
| 113 | - int decimal_point, | ||
| 114 | - int digits_after_point, | ||
| 115 | diff --git a/mfbt/double-conversion/more-architectures.patch b/mfbt/double-conversion/more-architectures.patch | ||
| 116 | deleted file mode 100644 | ||
| 117 | index b8d3804..0000000 | ||
| 118 | --- a/mfbt/double-conversion/more-architectures.patch | ||
| 119 | +++ /dev/null | ||
| 120 | @@ -1,30 +0,0 @@ | ||
| 121 | -diff --git a/mfbt/double-conversion/utils.h b/mfbt/double-conversion/utils.h | ||
| 122 | ---- a/mfbt/double-conversion/utils.h | ||
| 123 | -+++ b/mfbt/double-conversion/utils.h | ||
| 124 | -@@ -48,20 +48,24 @@ | ||
| 125 | - // An easy way to test if the floating-point operations are correct is to | ||
| 126 | - // evaluate: 89255.0/1e22. If the floating-point stack is 64 bits wide then | ||
| 127 | - // the result is equal to 89255e-22. | ||
| 128 | - // The best way to test this, is to create a division-function and to compare | ||
| 129 | - // the output of the division with the expected result. (Inlining must be | ||
| 130 | - // disabled.) | ||
| 131 | - // On Linux,x86 89255e-22 != Div_double(89255.0/1e22) | ||
| 132 | - #if defined(_M_X64) || defined(__x86_64__) || \ | ||
| 133 | -- defined(__ARMEL__) || \ | ||
| 134 | -+ defined(__ARMEL__) || defined(__avr32__) || \ | ||
| 135 | -+ defined(__hppa__) || defined(__ia64__) || \ | ||
| 136 | -+ defined(__mips__) || defined(__powerpc__) || \ | ||
| 137 | -+ defined(__sparc__) || defined(__sparc) || defined(__s390__) || \ | ||
| 138 | -+ defined(__SH4__) || defined(__alpha__) || \ | ||
| 139 | - defined(_MIPS_ARCH_MIPS32R2) | ||
| 140 | - #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 | ||
| 141 | --#elif defined(_M_IX86) || defined(__i386__) | ||
| 142 | -+#elif defined(_M_IX86) || defined(__i386__) || defined(__i386) | ||
| 143 | - #if defined(_WIN32) | ||
| 144 | - // Windows uses a 64bit wide floating point stack. | ||
| 145 | - #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 | ||
| 146 | - #else | ||
| 147 | - #undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS | ||
| 148 | - #endif // _WIN32 | ||
| 149 | - #else | ||
| 150 | - #error Target architecture was not detected as supported by Double-Conversion. | ||
| 151 | diff --git a/mfbt/double-conversion/update.sh b/mfbt/double-conversion/update.sh | ||
| 152 | index 81add8e..9ef2e91 100755 | ||
| 153 | --- a/mfbt/double-conversion/update.sh | ||
| 154 | +++ b/mfbt/double-conversion/update.sh | ||
| 155 | @@ -4,14 +4,12 @@ | ||
| 156 | # double-conversion source that we need. | ||
| 157 | |||
| 158 | cp $1/LICENSE ./ | ||
| 159 | -cp $1/README ./ | ||
| 160 | +cp $1/COPYING ./ | ||
| 161 | |||
| 162 | # Includes | ||
| 163 | -cp $1/src/*.h ./ | ||
| 164 | +cp $1/double-conversion/*.h ./ | ||
| 165 | |||
| 166 | # Source | ||
| 167 | -cp $1/src/*.cc ./ | ||
| 168 | +cp $1/double-conversion/*.cc ./ | ||
| 169 | |||
| 170 | -patch -p3 < add-mfbt-api-markers.patch | ||
| 171 | patch -p3 < use-StandardInteger.patch | ||
| 172 | -patch -p3 < more-architectures.patch | ||
| 173 | -- | ||
| 174 | 2.17.0 | ||
| 175 | |||
diff --git a/meta-oe/recipes-extended/mozjs/mozjs_17.0.0.bb b/meta-oe/recipes-extended/mozjs/mozjs_17.0.0.bb index 49b7f156e1..c5fbab20b0 100644 --- a/meta-oe/recipes-extended/mozjs/mozjs_17.0.0.bb +++ b/meta-oe/recipes-extended/mozjs/mozjs_17.0.0.bb | |||
| @@ -7,7 +7,6 @@ SRC_URI = "http://ftp.mozilla.org/pub/mozilla.org/js/${BPN}${PV}.tar.gz \ | |||
| 7 | file://0001-mozjs17.0.0-fix-the-compile-bug-of-powerpc.patch \ | 7 | file://0001-mozjs17.0.0-fix-the-compile-bug-of-powerpc.patch \ |
| 8 | file://0001-js.pc.in-do-not-include-RequiredDefines.h-for-depend.patch \ | 8 | file://0001-js.pc.in-do-not-include-RequiredDefines.h-for-depend.patch \ |
| 9 | file://0002-Move-JS_BYTES_PER_WORD-out-of-config.h.patch;patchdir=../../ \ | 9 | file://0002-Move-JS_BYTES_PER_WORD-out-of-config.h.patch;patchdir=../../ \ |
| 10 | file://0003-Add-AArch64-support.patch;patchdir=../../ \ | ||
| 11 | file://0004-mozbug746112-no-decommit-on-large-pages.patch;patchdir=../../ \ | 10 | file://0004-mozbug746112-no-decommit-on-large-pages.patch;patchdir=../../ \ |
| 12 | file://0005-aarch64-64k-page.patch;patchdir=../../ \ | 11 | file://0005-aarch64-64k-page.patch;patchdir=../../ \ |
| 13 | file://0001-regenerate-configure.patch;patchdir=../../ \ | 12 | file://0001-regenerate-configure.patch;patchdir=../../ \ |
| @@ -16,6 +15,8 @@ SRC_URI = "http://ftp.mozilla.org/pub/mozilla.org/js/${BPN}${PV}.tar.gz \ | |||
| 16 | file://0010-fix-cross-compilation-on-i586-targets.patch;patchdir=../../ \ | 15 | file://0010-fix-cross-compilation-on-i586-targets.patch;patchdir=../../ \ |
| 17 | file://Manually_mmap_heap_memory_esr17.patch;patchdir=../../ \ | 16 | file://Manually_mmap_heap_memory_esr17.patch;patchdir=../../ \ |
| 18 | file://0001-compare-the-first-character-of-string-to-be-null-or-.patch;patchdir=../../ \ | 17 | file://0001-compare-the-first-character-of-string-to-be-null-or-.patch;patchdir=../../ \ |
| 18 | file://Update-the-double-conversion-update-script.patch;patchdir=../../ \ | ||
| 19 | file://Update-Double-Conversion.patch;patchdir=../../ \ | ||
| 19 | " | 20 | " |
| 20 | 21 | ||
| 21 | SRC_URI[md5sum] = "20b6f8f1140ef6e47daa3b16965c9202" | 22 | SRC_URI[md5sum] = "20b6f8f1140ef6e47daa3b16965c9202" |
