Remove obsolete V8_INFINITY macro.
authorbmeurer <bmeurer@chromium.org>
Fri, 19 Dec 2014 07:17:45 +0000 (23:17 -0800)
committerCommit bot <commit-bot@chromium.org>
Fri, 19 Dec 2014 07:18:00 +0000 (07:18 +0000)
Use std::numeric_limits consistently.

R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/798413003

Cr-Commit-Position: refs/heads/master@{#25897}

37 files changed:
src/arm/code-stubs-arm.cc
src/arm/lithium-codegen-arm.cc
src/assembler.cc
src/compiler/js-builtin-reducer.cc
src/compiler/typer.cc
src/conversions-inl.h
src/globals.h
src/heap/heap.cc
src/hydrogen-instructions.cc
src/mips/code-stubs-mips.cc
src/mips/lithium-codegen-mips.cc
src/mips/simulator-mips.cc
src/mips64/code-stubs-mips64.cc
src/mips64/lithium-codegen-mips64.cc
src/mips64/simulator-mips64.cc
src/ppc/code-stubs-ppc.cc
src/ppc/lithium-codegen-ppc.cc
src/strtod.cc
src/types.cc
test/cctest/compiler/codegen-tester.cc
test/cctest/compiler/function-tester.h
test/cctest/compiler/test-branch-combine.cc
test/cctest/compiler/test-js-constant-cache.cc
test/cctest/compiler/test-machine-operator-reducer.cc
test/cctest/compiler/test-run-jsops.cc
test/cctest/compiler/test-run-machops.cc
test/cctest/compiler/test-typer.cc
test/cctest/compiler/value-helper.h
test/cctest/test-assembler-arm64.cc
test/cctest/test-checks.cc
test/cctest/test-double.cc
test/cctest/test-strtod.cc
test/cctest/test-types.cc
test/cctest/types-fuzz.h
test/unittests/compiler/js-builtin-reducer-unittest.cc
test/unittests/compiler/machine-operator-reducer-unittest.cc
test/unittests/compiler/simplified-operator-reducer-unittest.cc

index ef286bbe01585a7a1ad56d3e71c0b5fdc278233f..6aa5f30650c8a1755c2a8d26c319b822c14a9db8 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <limits>
+
 #include "src/v8.h"
 
 #if V8_TARGET_ARCH_ARM
@@ -782,7 +784,8 @@ void MathPowStub::Generate(MacroAssembler* masm) {
 
       // Calculates square root of base.  Check for the special case of
       // Math.pow(-Infinity, 0.5) == Infinity (ECMA spec, 15.8.2.13).
-      __ vmov(double_scratch, -V8_INFINITY, scratch);
+      __ vmov(double_scratch, -std::numeric_limits<double>::infinity(),
+              scratch);
       __ VFPCompareAndSetFlags(double_base, double_scratch);
       __ vneg(double_result, double_scratch, eq);
       __ b(eq, &done);
@@ -799,7 +802,8 @@ void MathPowStub::Generate(MacroAssembler* masm) {
 
       // Calculates square root of base.  Check for the special case of
       // Math.pow(-Infinity, -0.5) == 0 (ECMA spec, 15.8.2.13).
-      __ vmov(double_scratch, -V8_INFINITY, scratch);
+      __ vmov(double_scratch, -std::numeric_limits<double>::infinity(),
+              scratch);
       __ VFPCompareAndSetFlags(double_base, double_scratch);
       __ vmov(double_result, kDoubleRegZero, eq);
       __ b(eq, &done);
index 9d9591b69fe912f213eeddc6824172b2128ea46f..04024055f0749e8ab661cbca167c9dcc4e27ff24 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <limits>
+
 #include "src/v8.h"
 
 #include "src/arm/lithium-codegen-arm.h"
@@ -3880,7 +3882,7 @@ void LCodeGen::DoMathPowHalf(LMathPowHalf* instr) {
   // Math.pow(-Infinity, 0.5) == Infinity
   // Math.sqrt(-Infinity) == NaN
   Label done;
-  __ vmov(temp, -V8_INFINITY, scratch0());
+  __ vmov(temp, -std::numeric_limits<double>::infinity(), scratch0());
   __ VFPCompareAndSetFlags(input, temp);
   __ vneg(result, temp, eq);
   __ b(&done, eq);
index c73b470c28cb47592e502879253901488ce9483f..958b4009fe1eb08b9585abbdd2ee1d1cc9f9d9c9 100644 (file)
@@ -35,6 +35,8 @@
 #include "src/assembler.h"
 
 #include <cmath>
+#include <limits>
+
 #include "src/api.h"
 #include "src/base/cpu.h"
 #include "src/base/functional.h"
@@ -886,7 +888,7 @@ void ExternalReference::SetUp() {
   double_constants.minus_one_half = -0.5;
   double_constants.canonical_non_hole_nan = base::OS::nan_value();
   double_constants.the_hole_nan = bit_cast<double>(kHoleNanInt64);
-  double_constants.negative_infinity = -V8_INFINITY;
+  double_constants.negative_infinity = -std::numeric_limits<double>::infinity();
   double_constants.uint32_bias =
     static_cast<double>(static_cast<uint32_t>(0xFFFFFFFF)) + 1;
 
@@ -910,7 +912,7 @@ void ExternalReference::InitializeMathExpData() {
     math_exp_constants_array[0] = -708.39641853226408;
     // Input values larger than this always return +Infinity.
     math_exp_constants_array[1] = 709.78271289338397;
-    math_exp_constants_array[2] = V8_INFINITY;
+    math_exp_constants_array[2] = std::numeric_limits<double>::infinity();
     // The rest is black magic. Do not attempt to understand it. It is
     // loosely based on the "expd" function published at:
     // http://herumi.blogspot.com/2011/08/fast-double-precision-exponential.html
@@ -1413,7 +1415,7 @@ double power_helper(double x, double y) {
     return power_double_int(x, y_int);  // Returns 1 if exponent is 0.
   }
   if (y == 0.5) {
-    return (std::isinf(x)) ? V8_INFINITY
+    return (std::isinf(x)) ? std::numeric_limits<double>::infinity()
                            : fast_sqrt(x + 0.0);  // Convert -0 to +0.
   }
   if (y == -0.5) {
@@ -1450,7 +1452,8 @@ double power_double_double(double x, double y) {
   if ((x == 0.0 || std::isinf(x)) && std::isfinite(y)) {
     double f;
     if (std::modf(y, &f) != 0.0) {
-      return ((x == 0.0) ^ (y > 0)) ? V8_INFINITY : 0;
+      return ((x == 0.0) ^ (y > 0)) ? std::numeric_limits<double>::infinity()
+                                    : 0.0;
     }
   }
 
index 263b0feedda04949e0f83843996da6a51eea86d4..27b774976259854e006a57c4599eea08f89c5f77 100644 (file)
@@ -2,9 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "src/compiler/js-builtin-reducer.h"
+
+#include <limits>
+
 #include "src/compiler/diamond.h"
 #include "src/compiler/graph-inl.h"
-#include "src/compiler/js-builtin-reducer.h"
 #include "src/compiler/js-graph.h"
 #include "src/compiler/node-matchers.h"
 #include "src/compiler/node-properties-inl.h"
@@ -138,7 +141,8 @@ Reduction JSBuiltinReducer::ReduceMathMax(Node* node) {
   JSCallReduction r(node);
   if (r.InputsMatchZero()) {
     // Math.max() -> -Infinity
-    return Replace(jsgraph()->Constant(-V8_INFINITY));
+    return Replace(
+        jsgraph()->Constant(-std::numeric_limits<double>::infinity()));
   }
   if (r.InputsMatchOne(Type::Number())) {
     // Math.max(a:number) -> a
index dc20d847c80176ebe7a0eb4c67bd3bb2bd259058..dadcb47c22f20b2a1fec98500f320d9edb50fc47 100644 (file)
@@ -2,6 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "src/compiler/typer.h"
+
+#include <limits>
+
 #include "src/bootstrapper.h"
 #include "src/compiler/graph-inl.h"
 #include "src/compiler/graph-reducer.h"
@@ -10,7 +14,6 @@
 #include "src/compiler/node-properties-inl.h"
 #include "src/compiler/node-properties.h"
 #include "src/compiler/simplified-operator.h"
-#include "src/compiler/typer.h"
 
 namespace v8 {
 namespace internal {
@@ -160,8 +163,10 @@ Typer::Typer(Graph* graph, MaybeHandle<Context> context)
 
   Handle<Object> zero = f->NewNumber(0);
   Handle<Object> one = f->NewNumber(1);
-  Handle<Object> infinity = f->NewNumber(+V8_INFINITY);
-  Handle<Object> minusinfinity = f->NewNumber(-V8_INFINITY);
+  Handle<Object> infinity =
+      f->NewNumber(+std::numeric_limits<double>::infinity());
+  Handle<Object> minusinfinity =
+      f->NewNumber(-std::numeric_limits<double>::infinity());
 
   Type* number = Type::Number();
   Type* signed32 = Type::Signed32();
@@ -936,7 +941,7 @@ Type* Typer::Visitor::JSShiftRightLogicalTyper(Type* lhs, Type* rhs, Typer* t) {
 // Any -0 is converted to 0.
 static double array_min(double a[], size_t n) {
   DCHECK(n != 0);
-  double x = +V8_INFINITY;
+  double x = +std::numeric_limits<double>::infinity();
   for (size_t i = 0; i < n; ++i) {
     if (!std::isnan(a[i])) {
       x = std::min(a[i], x);
@@ -952,7 +957,7 @@ static double array_min(double a[], size_t n) {
 // Any -0 is converted to 0.
 static double array_max(double a[], size_t n) {
   DCHECK(n != 0);
-  double x = -V8_INFINITY;
+  double x = -std::numeric_limits<double>::infinity();
   for (size_t i = 0; i < n; ++i) {
     if (!std::isnan(a[i])) {
       x = std::max(a[i], x);
@@ -1067,9 +1072,11 @@ Type* Typer::Visitor::JSMultiplyRanger(Type::RangeType* lhs,
   // "results" above is nan, the actual result may still be, so we have to do a
   // different check:
   bool maybe_nan = (lhs->Maybe(t->singleton_zero) &&
-                    (rmin == -V8_INFINITY || rmax == +V8_INFINITY)) ||
+                    (rmin == -std::numeric_limits<double>::infinity() ||
+                     rmax == +std::numeric_limits<double>::infinity())) ||
                    (rhs->Maybe(t->singleton_zero) &&
-                    (lmin == -V8_INFINITY || lmax == +V8_INFINITY));
+                    (lmin == -std::numeric_limits<double>::infinity() ||
+                     lmax == +std::numeric_limits<double>::infinity()));
   if (maybe_nan) return t->weakint;  // Giving up.
   bool maybe_minuszero = (lhs->Maybe(t->singleton_zero) && rmin < 0) ||
                          (rhs->Maybe(t->singleton_zero) && lmin < 0);
@@ -1098,10 +1105,11 @@ Type* Typer::Visitor::JSDivideTyper(Type* lhs, Type* rhs, Typer* t) {
   if (lhs->Is(Type::NaN()) || rhs->Is(Type::NaN())) return Type::NaN();
   // Division is tricky, so all we do is try ruling out nan.
   // TODO(neis): try ruling out -0 as well?
-  bool maybe_nan =
-      lhs->Maybe(Type::NaN()) || rhs->Maybe(t->zeroish) ||
-      ((lhs->Min() == -V8_INFINITY || lhs->Max() == +V8_INFINITY) &&
-       (rhs->Min() == -V8_INFINITY || rhs->Max() == +V8_INFINITY));
+  bool maybe_nan = lhs->Maybe(Type::NaN()) || rhs->Maybe(t->zeroish) ||
+                   ((lhs->Min() == -std::numeric_limits<double>::infinity() ||
+                     lhs->Max() == +std::numeric_limits<double>::infinity()) &&
+                    (rhs->Min() == -std::numeric_limits<double>::infinity() ||
+                     rhs->Max() == +std::numeric_limits<double>::infinity()));
   return maybe_nan ? Type::Number() : Type::OrderedNumber();
 }
 
@@ -1146,7 +1154,8 @@ Type* Typer::Visitor::JSModulusTyper(Type* lhs, Type* rhs, Typer* t) {
   if (lhs->Is(Type::NaN()) || rhs->Is(Type::NaN())) return Type::NaN();
 
   if (lhs->Maybe(Type::NaN()) || rhs->Maybe(t->zeroish) ||
-      lhs->Min() == -V8_INFINITY || lhs->Max() == +V8_INFINITY) {
+      lhs->Min() == -std::numeric_limits<double>::infinity() ||
+      lhs->Max() == +std::numeric_limits<double>::infinity()) {
     // Result maybe NaN.
     return Type::Number();
   }
index ae87dc4d31b01763eef756a1058a05ca0dc1561e..e09165044ddc5b43bbf4da48ef4e0bda916d3d56 100644 (file)
@@ -5,11 +5,9 @@
 #ifndef V8_CONVERSIONS_INL_H_
 #define V8_CONVERSIONS_INL_H_
 
-#include <float.h>         // Required for DBL_MAX and on Win32 for finite()
-#include <limits.h>        // Required for INT_MAX etc.
-#include <stdarg.h>
 #include <cmath>
-#include "src/globals.h"       // Required for V8_INFINITY
+#include <cstdarg>
+#include <limits>
 
 // ----------------------------------------------------------------------------
 // Extra POSIX/ANSI functions for Win32/MSVC.
@@ -483,7 +481,8 @@ double InternalStringToDouble(UnicodeCache* unicode_cache,
     }
 
     DCHECK(buffer_pos == 0);
-    return (sign == NEGATIVE) ? -V8_INFINITY : V8_INFINITY;
+    return (sign == NEGATIVE) ? -std::numeric_limits<double>::infinity()
+                              : std::numeric_limits<double>::infinity();
   }
 
   bool leading_zero = false;
@@ -643,7 +642,7 @@ double InternalStringToDouble(UnicodeCache* unicode_cache,
       }
     }
 
-    const int max_exponent = INT_MAX / 2;
+    const int max_exponent = std::numeric_limits<int>::max() / 2;
     DCHECK(-max_exponent / 2 <= exponent && exponent <= max_exponent / 2);
     int num = 0;
     do {
index 3a83f2cbee1d9a091d8c4cb6895ed0ab44c45485..8c27b01b545bf35c4778571b07fd9a5efaeb4680 100644 (file)
 #include "src/base/logging.h"
 #include "src/base/macros.h"
 
-// Unfortunately, the INFINITY macro cannot be used with the '-pedantic'
-// warning flag and certain versions of GCC due to a bug:
-// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11931
-// For now, we use the more involved template-based version from <limits>, but
-// only when compiling with GCC versions affected by the bug (2.96.x - 4.0.x)
-#if V8_CC_GNU && V8_GNUC_PREREQ(2, 96, 0) && !V8_GNUC_PREREQ(4, 1, 0)
-# include <limits>  // NOLINT
-# define V8_INFINITY std::numeric_limits<double>::infinity()
-#elif V8_LIBC_MSVCRT
-# define V8_INFINITY HUGE_VAL
-#else
-# define V8_INFINITY INFINITY
-#endif
-
 #if V8_TARGET_ARCH_IA32 || (V8_TARGET_ARCH_X64 && !V8_TARGET_ARCH_32_BIT) || \
     V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS ||     \
     V8_TARGET_ARCH_MIPS64
index 56e961445d1e7618483491afaf2ab96e41b3150b..e1060792095607b36f5e4ec3fafb6dc4a6f3b712 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <limits>
+
 #include "src/v8.h"
 
 #include "src/accessors.h"
@@ -2908,7 +2910,8 @@ void Heap::CreateInitialObjects() {
 
   set_nan_value(
       *factory->NewHeapNumber(base::OS::nan_value(), IMMUTABLE, TENURED));
-  set_infinity_value(*factory->NewHeapNumber(V8_INFINITY, IMMUTABLE, TENURED));
+  set_infinity_value(*factory->NewHeapNumber(
+      std::numeric_limits<double>::infinity(), IMMUTABLE, TENURED));
 
   // The hole has not been created yet, but we want to put something
   // predictable in the gaps in the string table, so lets make that Smi zero.
index 0e6a03d71650cceb1fec2201698d6a936b86a934..d07a3387d0fac2d65feecf538315a17ad45f2749 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <limits>
+
 #include "src/v8.h"
 
 #include "src/base/bits.h"
@@ -4355,7 +4357,8 @@ HInstruction* HDiv::New(
       } else {
         int sign = Double(c_left->DoubleValue()).Sign() *
                    Double(c_right->DoubleValue()).Sign();  // Right could be -0.
-        return H_CONSTANT_DOUBLE(sign * V8_INFINITY);
+        return H_CONSTANT_DOUBLE(sign *
+                                 std::numeric_limits<double>::infinity());
       }
     }
   }
index 97eed7470725f5ab2c1cb194ab78da0e25dfabaa..6d7892d5c3f3434f1803981264d09f39a3e70729 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <limits>
+
 #include "src/v8.h"
 
 #if V8_TARGET_ARCH_MIPS
@@ -855,7 +857,7 @@ void MathPowStub::Generate(MacroAssembler* masm) {
       // double_scratch can be overwritten in the delay slot.
       // Calculates square root of base.  Check for the special case of
       // Math.pow(-Infinity, 0.5) == Infinity (ECMA spec, 15.8.2.13).
-      __ Move(double_scratch, static_cast<double>(-V8_INFINITY));
+      __ Move(double_scratch, std::numeric_limits<double>::infinity());
       __ BranchF(USE_DELAY_SLOT, &done, NULL, eq, double_base, double_scratch);
       __ neg_d(double_result, double_scratch);
 
@@ -875,7 +877,7 @@ void MathPowStub::Generate(MacroAssembler* masm) {
       // double_scratch can be overwritten in the delay slot.
       // Calculates square root of base.  Check for the special case of
       // Math.pow(-Infinity, -0.5) == 0 (ECMA spec, 15.8.2.13).
-      __ Move(double_scratch, static_cast<double>(-V8_INFINITY));
+      __ Move(double_scratch, std::numeric_limits<double>::infinity());
       __ BranchF(USE_DELAY_SLOT, &done, NULL, eq, double_base, double_scratch);
       __ Move(double_result, kDoubleRegZero);
 
index cdc68c865275d7897fc8ce25040eb7c9303663ea..004548997b3241f52374378a4a7e6b5f884e0f66 100644 (file)
@@ -25,6 +25,8 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+#include <limits>
+
 #include "src/v8.h"
 
 #include "src/base/bits.h"
@@ -3842,7 +3844,7 @@ void LCodeGen::DoMathPowHalf(LMathPowHalf* instr) {
   // Math.pow(-Infinity, 0.5) == Infinity
   // Math.sqrt(-Infinity) == NaN
   Label done;
-  __ Move(temp, static_cast<double>(-V8_INFINITY));
+  __ Move(temp, std::numeric_limits<double>::infinity());
   __ BranchF(USE_DELAY_SLOT, &done, NULL, eq, temp, input);
   // Set up Infinity in the delay slot.
   // result is overwritten if the branch is not taken.
index fabca67062fab264b5c9dff0192c308c18e67b9f..9320fbaecc8a7d7c298daee6d69b160a8f939cda 100644 (file)
@@ -1288,7 +1288,8 @@ bool Simulator::set_fcsr_round_error(double original, double rounded) {
     set_fcsr_bit(kFCSRInexactFlagBit, true);
   }
 
-  if (rounded < DBL_MIN && rounded > -DBL_MIN && rounded != 0) {
+  if (rounded < std::numeric_limits<double>::min() &&
+      rounded > -std::numeric_limits<double>::min() && rounded != 0) {
     set_fcsr_bit(kFCSRUnderflowFlagBit, true);
     ret = true;
   }
index 6bbd1a3183a21baba02a4e177e5798b4a3cd95be..892ae2a39a00dd057880127fda8782aa0e32c96a 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <limits>
+
 #include "src/v8.h"
 
 #if V8_TARGET_ARCH_MIPS64
@@ -851,7 +853,7 @@ void MathPowStub::Generate(MacroAssembler* masm) {
       // double_scratch can be overwritten in the delay slot.
       // Calculates square root of base.  Check for the special case of
       // Math.pow(-Infinity, 0.5) == Infinity (ECMA spec, 15.8.2.13).
-      __ Move(double_scratch, static_cast<double>(-V8_INFINITY));
+      __ Move(double_scratch, std::numeric_limits<double>::infinity());
       __ BranchF(USE_DELAY_SLOT, &done, NULL, eq, double_base, double_scratch);
       __ neg_d(double_result, double_scratch);
 
@@ -871,7 +873,7 @@ void MathPowStub::Generate(MacroAssembler* masm) {
       // double_scratch can be overwritten in the delay slot.
       // Calculates square root of base.  Check for the special case of
       // Math.pow(-Infinity, -0.5) == 0 (ECMA spec, 15.8.2.13).
-      __ Move(double_scratch, static_cast<double>(-V8_INFINITY));
+      __ Move(double_scratch, std::numeric_limits<double>::infinity());
       __ BranchF(USE_DELAY_SLOT, &done, NULL, eq, double_base, double_scratch);
       __ Move(double_result, kDoubleRegZero);
 
index a817a285a4ed65408e85dafe30cdb1345d607c8f..9df5ccaa9992e213367558a885ca42f5ba07ee92 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <limits>
+
 #include "src/v8.h"
 
 #include "src/code-factory.h"
@@ -3874,7 +3876,7 @@ void LCodeGen::DoMathPowHalf(LMathPowHalf* instr) {
   // Math.pow(-Infinity, 0.5) == Infinity
   // Math.sqrt(-Infinity) == NaN
   Label done;
-  __ Move(temp, static_cast<double>(-V8_INFINITY));
+  __ Move(temp, std::numeric_limits<double>::infinity());
   __ BranchF(USE_DELAY_SLOT, &done, NULL, eq, temp, input);
   // Set up Infinity in the delay slot.
   // result is overwritten if the branch is not taken.
index 9899d47a0e5ec940d99bf1514827f6f57f2187f9..86b1d8ef3ab5b3ede644ba9c601f88a9b9c04c00 100644 (file)
@@ -1204,7 +1204,8 @@ bool Simulator::set_fcsr_round_error(double original, double rounded) {
     set_fcsr_bit(kFCSRInexactFlagBit, true);
   }
 
-  if (rounded < DBL_MIN && rounded > -DBL_MIN && rounded != 0) {
+  if (rounded < std::numeric_limits<double>::min() &&
+      rounded > -std::numeric_limits<double>::min() && rounded != 0) {
     set_fcsr_bit(kFCSRUnderflowFlagBit, true);
     ret = true;
   }
@@ -1236,7 +1237,8 @@ bool Simulator::set_fcsr_round64_error(double original, double rounded) {
     set_fcsr_bit(kFCSRInexactFlagBit, true);
   }
 
-  if (rounded < DBL_MIN && rounded > -DBL_MIN && rounded != 0) {
+  if (rounded < std::numeric_limits<double>::min() &&
+      rounded > -std::numeric_limits<double>::min() && rounded != 0) {
     set_fcsr_bit(kFCSRUnderflowFlagBit, true);
     ret = true;
   }
index 3e84a2143c3417a987c63eec0834e83b64db05c6..a83a85ce774235f35b44f7bc75d81c078fed7b8e 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <limits>
+
 #include "src/v8.h"
 
 #if V8_TARGET_ARCH_PPC
@@ -798,7 +800,8 @@ void MathPowStub::Generate(MacroAssembler* masm) {
 
       // Calculates square root of base.  Check for the special case of
       // Math.pow(-Infinity, 0.5) == Infinity (ECMA spec, 15.8.2.13).
-      __ LoadDoubleLiteral(double_scratch, -V8_INFINITY, scratch);
+      __ LoadDoubleLiteral(double_scratch,
+                           -std::numeric_limits<double>::infinity(), scratch);
       __ fcmpu(double_base, double_scratch);
       __ bne(&not_minus_inf1);
       __ fneg(double_result, double_scratch);
@@ -817,7 +820,8 @@ void MathPowStub::Generate(MacroAssembler* masm) {
 
       // Calculates square root of base.  Check for the special case of
       // Math.pow(-Infinity, -0.5) == 0 (ECMA spec, 15.8.2.13).
-      __ LoadDoubleLiteral(double_scratch, -V8_INFINITY, scratch);
+      __ LoadDoubleLiteral(double_scratch,
+                           -std::numeric_limits<double>::infinity(), scratch);
       __ fcmpu(double_base, double_scratch);
       __ bne(&not_minus_inf2);
       __ fmr(double_result, kDoubleRegZero);
index 7b6052c3e624ef89eb678241ef74dbffcfadf5dc..2ab53e5588c12ee0bc3fcba4bad40483c343e0a6 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <limits>
+
 #include "src/v8.h"
 
 #include "src/base/bits.h"
@@ -4036,7 +4038,8 @@ void LCodeGen::DoMathPowHalf(LMathPowHalf* instr) {
   // Math.sqrt(-Infinity) == NaN
   Label skip, done;
 
-  __ LoadDoubleLiteral(temp, -V8_INFINITY, scratch0());
+  __ LoadDoubleLiteral(temp, -std::numeric_limits<double>::infinity(),
+                       scratch0());
   __ fcmpu(input, temp);
   __ bne(&skip);
   __ fneg(result, temp);
index 2b48af3cc60c93aeaadc9660d2e5e77c99268896..4f06b3979d976b914bf1b3bda59e5cb100a8c801 100644 (file)
@@ -2,8 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include <stdarg.h>
 #include <cmath>
+#include <cstdarg>
+#include <limits>
 
 #include "src/v8.h"
 
@@ -352,7 +353,7 @@ static bool DiyFpStrtod(Vector<const char> buffer,
 static double BignumStrtod(Vector<const char> buffer,
                            int exponent,
                            double guess) {
-  if (guess == V8_INFINITY) {
+  if (guess == std::numeric_limits<double>::infinity()) {
     return guess;
   }
 
@@ -408,7 +409,9 @@ double Strtod(Vector<const char> buffer, int exponent) {
                                      kMaxSignificantDecimalDigits),
                   significant_exponent);
   }
-  if (exponent + trimmed.length() - 1 >= kMaxDecimalPower) return V8_INFINITY;
+  if (exponent + trimmed.length() - 1 >= kMaxDecimalPower) {
+    return std::numeric_limits<double>::infinity();
+  }
   if (exponent + trimmed.length() <= kMinDecimalPower) return 0.0;
 
   double guess;
index c4f1bae5fbcf4d3695a20e1b631e3860727467ee..fe29d9dbad4cfff80d442e8f4587cfad34223235 100644 (file)
@@ -2,10 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include <iomanip>
-
 #include "src/types.h"
 
+#include <iomanip>
+#include <limits>
+
 #include "src/ostreams.h"
 #include "src/types-inl.h"
 
@@ -81,7 +82,7 @@ double TypeImpl<Config>::Min() {
   DCHECK(this->Is(Number()));
   if (this->IsBitset()) return BitsetType::Min(this->AsBitset());
   if (this->IsUnion()) {
-    double min = +V8_INFINITY;
+    double min = +std::numeric_limits<double>::infinity();
     for (int i = 0, n = this->AsUnion()->Length(); i < n; ++i) {
       min = std::min(min, this->AsUnion()->Get(i)->Min());
     }
@@ -99,7 +100,7 @@ double TypeImpl<Config>::Max() {
   DCHECK(this->Is(Number()));
   if (this->IsBitset()) return BitsetType::Max(this->AsBitset());
   if (this->IsUnion()) {
-    double max = -V8_INFINITY;
+    double max = -std::numeric_limits<double>::infinity();
     for (int i = 0, n = this->AsUnion()->Length(); i < n; ++i) {
       max = std::max(max, this->AsUnion()->Get(i)->Max());
     }
@@ -287,7 +288,7 @@ TypeImpl<Config>::BitsetType::Lub(double value) {
 template <class Config>
 const typename TypeImpl<Config>::BitsetType::BitsetMin
     TypeImpl<Config>::BitsetType::BitsetMins31[] = {
-        {kOtherNumber, -V8_INFINITY},
+        {kOtherNumber, -std::numeric_limits<double>::infinity()},
         {kOtherSigned32, kMinInt},
         {kNegativeSignedSmall, -0x40000000},
         {kUnsignedSmall, 0},
@@ -301,7 +302,7 @@ const typename TypeImpl<Config>::BitsetType::BitsetMin
 template <class Config>
 const typename TypeImpl<Config>::BitsetType::BitsetMin
     TypeImpl<Config>::BitsetType::BitsetMins32[] = {
-        {kOtherNumber, -V8_INFINITY},
+        {kOtherNumber, -std::numeric_limits<double>::infinity()},
         {kNegativeSignedSmall, kMinInt},
         {kUnsignedSmall, 0},
         {kOtherUnsigned32, 0x80000000},
@@ -353,7 +354,7 @@ double TypeImpl<Config>::BitsetType::Max(bitset bits) {
   const BitsetMin* mins = BitsetMins();
   bool mz = SEMANTIC(bits & kMinusZero);
   if (BitsetType::Is(mins[BitsetMinsSize()-1].bits, bits)) {
-    return +V8_INFINITY;
+    return +std::numeric_limits<double>::infinity();
   }
   for (size_t i = BitsetMinsSize()-1; i-- > 0; ) {
     if (Is(SEMANTIC(mins[i].bits), bits)) {
index 5311001714c87aeabb8d68e08352ade30a921105..caffbb7c357046e97b92cd362514da1d0fa18015 100644 (file)
@@ -142,7 +142,7 @@ TEST(CompareWrapper) {
 
   // Check NaN handling.
   double nan = v8::base::OS::nan_value();
-  double inf = V8_INFINITY;
+  double inf = std::numeric_limits<double>::infinity();
   CHECK_EQ(false, wFloat64Equal.Float64Compare(nan, 0.0));
   CHECK_EQ(false, wFloat64Equal.Float64Compare(nan, 1.0));
   CHECK_EQ(false, wFloat64Equal.Float64Compare(nan, inf));
index 7e16eead38629e15612d37e5be1ba8cef649c959..a93dfc6e9869c45ebda5546fbc0e6162b978b71c 100644 (file)
@@ -137,7 +137,9 @@ class FunctionTester : public InitializedHandleScope {
 
   Handle<Object> infinity() { return isolate->factory()->infinity_value(); }
 
-  Handle<Object> minus_infinity() { return Val(-V8_INFINITY); }
+  Handle<Object> minus_infinity() {
+    return Val(-std::numeric_limits<double>::infinity());
+  }
 
   Handle<Object> nan() { return isolate->factory()->nan_value(); }
 
index cd3472d6bb1448f6ba1d952b294f90eeb621035c..48694a83e0bc390fc4b4ab46579f1b68232ec303 100644 (file)
@@ -414,7 +414,7 @@ TEST(BranchCombineInt32CmpAllInputShapes_inverse_branch_false) {
 
 
 TEST(BranchCombineFloat64Compares) {
-  double inf = V8_INFINITY;
+  double inf = std::numeric_limits<double>::infinity();
   double nan = v8::base::OS::nan_value();
   double inputs[] = {0.0, 1.0, -1.0, -inf, inf, nan};
 
index 8588f66f1f546f7a6161e0f5d9f04b6752bc19ab..a7f26648f450e0e50117d04c1dd5e8fd2c2b7413 100644 (file)
@@ -446,23 +446,12 @@ TEST(JSGraph_GetCachedNodes_together) {
   JSConstantCacheTester T;
 
   Node* constants[] = {
-      T.TrueConstant(),
-      T.UndefinedConstant(),
-      T.TheHoleConstant(),
-      T.TrueConstant(),
-      T.FalseConstant(),
-      T.NullConstant(),
-      T.ZeroConstant(),
-      T.OneConstant(),
-      T.NaNConstant(),
-      T.Int32Constant(0),
-      T.Int32Constant(1),
-      T.Int64Constant(-2),
-      T.Int64Constant(-4),
-      T.Float64Constant(0.9),
-      T.Float64Constant(V8_INFINITY),
-      T.Constant(0.99),
-      T.Constant(1.11),
+      T.TrueConstant(), T.UndefinedConstant(), T.TheHoleConstant(),
+      T.TrueConstant(), T.FalseConstant(), T.NullConstant(), T.ZeroConstant(),
+      T.OneConstant(), T.NaNConstant(), T.Int32Constant(0), T.Int32Constant(1),
+      T.Int64Constant(-2), T.Int64Constant(-4), T.Float64Constant(0.9),
+      T.Float64Constant(std::numeric_limits<double>::infinity()),
+      T.Constant(0.99), T.Constant(1.11),
       T.ExternalConstant(ExternalReference::address_of_one_half())};
 
   NodeVector nodes(T.main_zone());
index b538fb7ff5fa00bd70e1b7580bb3fc655953b28a..a333b1b68bf2df272444e26b026c805684e03f08 100644 (file)
@@ -795,7 +795,7 @@ TEST(ReduceFloat64Mul) {
     }
   }
 
-  double inf = V8_INFINITY;
+  double inf = std::numeric_limits<double>::infinity();
   R.CheckPutConstantOnRight(-inf);
   R.CheckPutConstantOnRight(-0.1);
   R.CheckPutConstantOnRight(0.1);
index eb39760ff7ea945d438827230edee4b20672ebaa..9e423d5f97e408cb438b13005e17a814730b6eb3 100644 (file)
@@ -57,8 +57,8 @@ TEST(BinopDivide) {
 
   T.CheckCall(2, 8, 4);
   T.CheckCall(2.1, 8.4, 4);
-  T.CheckCall(V8_INFINITY, 8, 0);
-  T.CheckCall(-V8_INFINITY, -8, 0);
+  T.CheckCall(std::numeric_limits<double>::infinity(), 8, 0);
+  T.CheckCall(-std::numeric_limits<double>::infinity(), -8, 0);
   T.CheckCall(T.infinity(), T.Val(8), T.Val("0"));
   T.CheckCall(T.minus_infinity(), T.Val("-8"), T.Val(0.0));
   T.CheckCall(T.Val(1.5), T.Val("3"), T.Val("2"));
index 974d4cef5436cffaa83281cce136ed6f085f3206..deec63ca01e7ce92f24a5b921eee459ba2bfdae6 100644 (file)
@@ -2910,7 +2910,7 @@ TEST(RunFloat64Binop) {
                            m.machine()->Float64Mul(), m.machine()->Float64Div(),
                            m.machine()->Float64Mod(), NULL};
 
-  double inf = V8_INFINITY;
+  double inf = std::numeric_limits<double>::infinity();
   const Operator* inputs[] = {
       m.common()->Float64Constant(0),     m.common()->Float64Constant(1),
       m.common()->Float64Constant(1),     m.common()->Float64Constant(0),
@@ -3864,7 +3864,7 @@ static int Float64CompareHelper(RawMachineAssemblerTester<int32_t>* m,
 
 
 TEST(RunFloat64Compare) {
-  double inf = V8_INFINITY;
+  double inf = std::numeric_limits<double>::infinity();
   // All pairs (a1, a2) are of the form a1 < a2.
   double inputs[] = {0.0,  1.0,  -1.0, 0.22, -1.22, 0.22,
                      -inf, 0.22, 0.22, inf,  -inf,  inf};
index 2b9d91af02c017e8477af6602151cf2c831078c3..56a85674e1621cdc5cda4cafe9d77fa8efcd45df 100644 (file)
@@ -32,8 +32,8 @@ class TyperTester : public HandleAndZoneScope, public GraphAndBuilders {
     integers.push_back(0);
     integers.push_back(-1);
     integers.push_back(+1);
-    integers.push_back(-V8_INFINITY);
-    integers.push_back(+V8_INFINITY);
+    integers.push_back(-std::numeric_limits<double>::infinity());
+    integers.push_back(+std::numeric_limits<double>::infinity());
     for (int i = 0; i < 5; ++i) {
       double x = rng_->NextInt();
       integers.push_back(x);
@@ -99,9 +99,12 @@ class TyperTester : public HandleAndZoneScope, public GraphAndBuilders {
       case 1: return max;
       default: break;
     }
-    if (min == +V8_INFINITY) return +V8_INFINITY;
-    if (max == -V8_INFINITY) return -V8_INFINITY;
-    if (min == -V8_INFINITY && max == +V8_INFINITY) {
+    if (min == +std::numeric_limits<double>::infinity())
+      return +std::numeric_limits<double>::infinity();
+    if (max == -std::numeric_limits<double>::infinity())
+      return -std::numeric_limits<double>::infinity();
+    if (min == -std::numeric_limits<double>::infinity() &&
+        max == +std::numeric_limits<double>::infinity()) {
       return rng_->NextInt() * static_cast<double>(rng_->NextInt());
     }
     double result = nearbyint(min + (max - min) * rng_->NextDouble());
index 218a773fa9d7be3b7951ef84a03bc2d2cc120930..a08a6e2eea205c4b5ebc0376a69863833759965c 100644 (file)
@@ -102,14 +102,13 @@ class ValueHelper {
   static std::vector<double> float64_vector() {
     static const double nan = v8::base::OS::nan_value();
     static const double values[] = {
-        0.125,           0.25,            0.375,          0.5,
-        1.25,            -1.75,           2,              5.125,
-        6.25,            0.0,             -0.0,           982983.25,
-        888,             2147483647.0,    -999.75,        3.1e7,
-        -2e66,           3e-88,           -2147483648.0,  V8_INFINITY,
-        -V8_INFINITY,    nan,             2147483647.375, 2147483647.75,
-        2147483648.0,    2147483648.25,   2147483649.25,  -2147483647.0,
-        -2147483647.125, -2147483647.875, -2147483648.25, -2147483649.5};
+        0.125, 0.25, 0.375, 0.5, 1.25, -1.75, 2, 5.125, 6.25, 0.0, -0.0,
+        982983.25, 888, 2147483647.0, -999.75, 3.1e7, -2e66, 3e-88,
+        -2147483648.0, std::numeric_limits<double>::infinity(),
+        -std::numeric_limits<double>::infinity(), nan, 2147483647.375,
+        2147483647.75, 2147483648.0, 2147483648.25, 2147483649.25,
+        -2147483647.0, -2147483647.125, -2147483647.875, -2147483648.25,
+        -2147483649.5};
     return std::vector<double>(&values[0], &values[arraysize(values)]);
   }
 
@@ -135,9 +134,11 @@ class ValueHelper {
 
   static const std::vector<double> nan_vector(size_t limit = 0) {
     static const double nan = v8::base::OS::nan_value();
-    static const double values[] = {-nan,               -V8_INFINITY * -0.0,
-                                    -V8_INFINITY * 0.0, V8_INFINITY * -0.0,
-                                    V8_INFINITY * 0.0,  nan};
+    static const double values[] = {
+        -nan, -std::numeric_limits<double>::infinity() * -0.0,
+        -std::numeric_limits<double>::infinity() * 0.0,
+        std::numeric_limits<double>::infinity() * -0.0,
+        std::numeric_limits<double>::infinity() * 0.0, nan};
     return std::vector<double>(&values[0], &values[arraysize(values)]);
   }
 
index 108152efc2c9e04c2a44c8005b112dc3a09d4a68..a270902b84a118585fb330b39d9ee670e1235615 100644 (file)
@@ -5858,10 +5858,11 @@ TEST(fmax_fmin_d) {
                        snan_processed, snan_processed);
 
   // Iterate over all combinations of inputs.
-  double inputs[] = { DBL_MAX, DBL_MIN, 1.0, 0.0,
-                      -DBL_MAX, -DBL_MIN, -1.0, -0.0,
-                      kFP64PositiveInfinity, kFP64NegativeInfinity,
-                      kFP64QuietNaN, kFP64SignallingNaN };
+  double inputs[] = {
+      std::numeric_limits<double>::max(), std::numeric_limits<double>::min(),
+      1.0, 0.0, -std::numeric_limits<double>::max(),
+      -std::numeric_limits<double>::min(), -1.0, -0.0, kFP64PositiveInfinity,
+      kFP64NegativeInfinity, kFP64QuietNaN, kFP64SignallingNaN};
 
   const int count = sizeof(inputs) / sizeof(inputs[0]);
 
@@ -5943,10 +5944,11 @@ TEST(fmax_fmin_s) {
                       snan_processed, snan_processed);
 
   // Iterate over all combinations of inputs.
-  float inputs[] = { FLT_MAX, FLT_MIN, 1.0, 0.0,
-                     -FLT_MAX, -FLT_MIN, -1.0, -0.0,
-                     kFP32PositiveInfinity, kFP32NegativeInfinity,
-                     kFP32QuietNaN, kFP32SignallingNaN };
+  float inputs[] = {
+      std::numeric_limits<float>::max(), std::numeric_limits<float>::min(), 1.0,
+      0.0, -std::numeric_limits<float>::max(),
+      -std::numeric_limits<float>::min(), -1.0, -0.0, kFP32PositiveInfinity,
+      kFP32NegativeInfinity, kFP32QuietNaN, kFP32SignallingNaN};
 
   const int count = sizeof(inputs) / sizeof(inputs[0]);
 
@@ -6742,8 +6744,8 @@ TEST(fcvt_ds) {
   __ Fmov(s24, kFP32NegativeInfinity);
   __ Fmov(s25, 0.0);
   __ Fmov(s26, -0.0);
-  __ Fmov(s27, FLT_MAX);
-  __ Fmov(s28, FLT_MIN);
+  __ Fmov(s27, std::numeric_limits<float>::max());
+  __ Fmov(s28, std::numeric_limits<float>::min());
   __ Fmov(s29, rawbits_to_float(0x7fc12345));   // Quiet NaN.
   __ Fmov(s30, rawbits_to_float(0x7f812345));   // Signalling NaN.
 
@@ -6777,8 +6779,8 @@ TEST(fcvt_ds) {
   CHECK_EQUAL_FP64(kFP64NegativeInfinity, d8);
   CHECK_EQUAL_FP64(0.0f, d9);
   CHECK_EQUAL_FP64(-0.0f, d10);
-  CHECK_EQUAL_FP64(FLT_MAX, d11);
-  CHECK_EQUAL_FP64(FLT_MIN, d12);
+  CHECK_EQUAL_FP64(std::numeric_limits<float>::max(), d11);
+  CHECK_EQUAL_FP64(std::numeric_limits<float>::min(), d12);
 
   // Check that the NaN payload is preserved according to ARM64 conversion
   // rules:
@@ -6802,83 +6804,86 @@ TEST(fcvt_sd) {
   //
   // Note that this test only checks ties-to-even rounding, because that is all
   // that the simulator supports.
-  struct {double in; float expected;} test[] = {
-    // Check some simple conversions.
-    {0.0, 0.0f},
-    {1.0, 1.0f},
-    {1.5, 1.5f},
-    {2.0, 2.0f},
-    {FLT_MAX, FLT_MAX},
-    //  - The smallest normalized float.
-    {pow(2.0, -126), powf(2, -126)},
-    //  - Normal floats that need (ties-to-even) rounding.
-    //    For normalized numbers:
-    //         bit 29 (0x0000000020000000) is the lowest-order bit which will
-    //                                     fit in the float's mantissa.
-    {rawbits_to_double(0x3ff0000000000000), rawbits_to_float(0x3f800000)},
-    {rawbits_to_double(0x3ff0000000000001), rawbits_to_float(0x3f800000)},
-    {rawbits_to_double(0x3ff0000010000000), rawbits_to_float(0x3f800000)},
-    {rawbits_to_double(0x3ff0000010000001), rawbits_to_float(0x3f800001)},
-    {rawbits_to_double(0x3ff0000020000000), rawbits_to_float(0x3f800001)},
-    {rawbits_to_double(0x3ff0000020000001), rawbits_to_float(0x3f800001)},
-    {rawbits_to_double(0x3ff0000030000000), rawbits_to_float(0x3f800002)},
-    {rawbits_to_double(0x3ff0000030000001), rawbits_to_float(0x3f800002)},
-    {rawbits_to_double(0x3ff0000040000000), rawbits_to_float(0x3f800002)},
-    {rawbits_to_double(0x3ff0000040000001), rawbits_to_float(0x3f800002)},
-    {rawbits_to_double(0x3ff0000050000000), rawbits_to_float(0x3f800002)},
-    {rawbits_to_double(0x3ff0000050000001), rawbits_to_float(0x3f800003)},
-    {rawbits_to_double(0x3ff0000060000000), rawbits_to_float(0x3f800003)},
-    //  - A mantissa that overflows into the exponent during rounding.
-    {rawbits_to_double(0x3feffffff0000000), rawbits_to_float(0x3f800000)},
-    //  - The largest double that rounds to a normal float.
-    {rawbits_to_double(0x47efffffefffffff), rawbits_to_float(0x7f7fffff)},
-
-    // Doubles that are too big for a float.
-    {kFP64PositiveInfinity, kFP32PositiveInfinity},
-    {DBL_MAX, kFP32PositiveInfinity},
-    //  - The smallest exponent that's too big for a float.
-    {pow(2.0, 128), kFP32PositiveInfinity},
-    //  - This exponent is in range, but the value rounds to infinity.
-    {rawbits_to_double(0x47effffff0000000), kFP32PositiveInfinity},
-
-    // Doubles that are too small for a float.
-    //  - The smallest (subnormal) double.
-    {DBL_MIN, 0.0},
-    //  - The largest double which is too small for a subnormal float.
-    {rawbits_to_double(0x3690000000000000), rawbits_to_float(0x00000000)},
-
-    // Normal doubles that become subnormal floats.
-    //  - The largest subnormal float.
-    {rawbits_to_double(0x380fffffc0000000), rawbits_to_float(0x007fffff)},
-    //  - The smallest subnormal float.
-    {rawbits_to_double(0x36a0000000000000), rawbits_to_float(0x00000001)},
-    //  - Subnormal floats that need (ties-to-even) rounding.
-    //    For these subnormals:
-    //         bit 34 (0x0000000400000000) is the lowest-order bit which will
-    //                                     fit in the float's mantissa.
-    {rawbits_to_double(0x37c159e000000000), rawbits_to_float(0x00045678)},
-    {rawbits_to_double(0x37c159e000000001), rawbits_to_float(0x00045678)},
-    {rawbits_to_double(0x37c159e200000000), rawbits_to_float(0x00045678)},
-    {rawbits_to_double(0x37c159e200000001), rawbits_to_float(0x00045679)},
-    {rawbits_to_double(0x37c159e400000000), rawbits_to_float(0x00045679)},
-    {rawbits_to_double(0x37c159e400000001), rawbits_to_float(0x00045679)},
-    {rawbits_to_double(0x37c159e600000000), rawbits_to_float(0x0004567a)},
-    {rawbits_to_double(0x37c159e600000001), rawbits_to_float(0x0004567a)},
-    {rawbits_to_double(0x37c159e800000000), rawbits_to_float(0x0004567a)},
-    {rawbits_to_double(0x37c159e800000001), rawbits_to_float(0x0004567a)},
-    {rawbits_to_double(0x37c159ea00000000), rawbits_to_float(0x0004567a)},
-    {rawbits_to_double(0x37c159ea00000001), rawbits_to_float(0x0004567b)},
-    {rawbits_to_double(0x37c159ec00000000), rawbits_to_float(0x0004567b)},
-    //  - The smallest double which rounds up to become a subnormal float.
-    {rawbits_to_double(0x3690000000000001), rawbits_to_float(0x00000001)},
-
-    // Check NaN payload preservation.
-    {rawbits_to_double(0x7ff82468a0000000), rawbits_to_float(0x7fc12345)},
-    {rawbits_to_double(0x7ff82468bfffffff), rawbits_to_float(0x7fc12345)},
-    //  - Signalling NaNs become quiet NaNs.
-    {rawbits_to_double(0x7ff02468a0000000), rawbits_to_float(0x7fc12345)},
-    {rawbits_to_double(0x7ff02468bfffffff), rawbits_to_float(0x7fc12345)},
-    {rawbits_to_double(0x7ff000001fffffff), rawbits_to_float(0x7fc00000)},
+  struct {
+    double in;
+    float expected;
+  } test[] = {
+      // Check some simple conversions.
+      {0.0, 0.0f},
+      {1.0, 1.0f},
+      {1.5, 1.5f},
+      {2.0, 2.0f},
+      {std::numeric_limits<float>::max(), std::numeric_limits<float>::max()},
+      //  - The smallest normalized float.
+      {pow(2.0, -126), powf(2, -126)},
+      //  - Normal floats that need (ties-to-even) rounding.
+      //    For normalized numbers:
+      //         bit 29 (0x0000000020000000) is the lowest-order bit which will
+      //                                     fit in the float's mantissa.
+      {rawbits_to_double(0x3ff0000000000000), rawbits_to_float(0x3f800000)},
+      {rawbits_to_double(0x3ff0000000000001), rawbits_to_float(0x3f800000)},
+      {rawbits_to_double(0x3ff0000010000000), rawbits_to_float(0x3f800000)},
+      {rawbits_to_double(0x3ff0000010000001), rawbits_to_float(0x3f800001)},
+      {rawbits_to_double(0x3ff0000020000000), rawbits_to_float(0x3f800001)},
+      {rawbits_to_double(0x3ff0000020000001), rawbits_to_float(0x3f800001)},
+      {rawbits_to_double(0x3ff0000030000000), rawbits_to_float(0x3f800002)},
+      {rawbits_to_double(0x3ff0000030000001), rawbits_to_float(0x3f800002)},
+      {rawbits_to_double(0x3ff0000040000000), rawbits_to_float(0x3f800002)},
+      {rawbits_to_double(0x3ff0000040000001), rawbits_to_float(0x3f800002)},
+      {rawbits_to_double(0x3ff0000050000000), rawbits_to_float(0x3f800002)},
+      {rawbits_to_double(0x3ff0000050000001), rawbits_to_float(0x3f800003)},
+      {rawbits_to_double(0x3ff0000060000000), rawbits_to_float(0x3f800003)},
+      //  - A mantissa that overflows into the exponent during rounding.
+      {rawbits_to_double(0x3feffffff0000000), rawbits_to_float(0x3f800000)},
+      //  - The largest double that rounds to a normal float.
+      {rawbits_to_double(0x47efffffefffffff), rawbits_to_float(0x7f7fffff)},
+
+      // Doubles that are too big for a float.
+      {kFP64PositiveInfinity, kFP32PositiveInfinity},
+      {std::numeric_limits<double>::max(), kFP32PositiveInfinity},
+      //  - The smallest exponent that's too big for a float.
+      {pow(2.0, 128), kFP32PositiveInfinity},
+      //  - This exponent is in range, but the value rounds to infinity.
+      {rawbits_to_double(0x47effffff0000000), kFP32PositiveInfinity},
+
+      // Doubles that are too small for a float.
+      //  - The smallest (subnormal) double.
+      {std::numeric_limits<double>::min(), 0.0},
+      //  - The largest double which is too small for a subnormal float.
+      {rawbits_to_double(0x3690000000000000), rawbits_to_float(0x00000000)},
+
+      // Normal doubles that become subnormal floats.
+      //  - The largest subnormal float.
+      {rawbits_to_double(0x380fffffc0000000), rawbits_to_float(0x007fffff)},
+      //  - The smallest subnormal float.
+      {rawbits_to_double(0x36a0000000000000), rawbits_to_float(0x00000001)},
+      //  - Subnormal floats that need (ties-to-even) rounding.
+      //    For these subnormals:
+      //         bit 34 (0x0000000400000000) is the lowest-order bit which will
+      //                                     fit in the float's mantissa.
+      {rawbits_to_double(0x37c159e000000000), rawbits_to_float(0x00045678)},
+      {rawbits_to_double(0x37c159e000000001), rawbits_to_float(0x00045678)},
+      {rawbits_to_double(0x37c159e200000000), rawbits_to_float(0x00045678)},
+      {rawbits_to_double(0x37c159e200000001), rawbits_to_float(0x00045679)},
+      {rawbits_to_double(0x37c159e400000000), rawbits_to_float(0x00045679)},
+      {rawbits_to_double(0x37c159e400000001), rawbits_to_float(0x00045679)},
+      {rawbits_to_double(0x37c159e600000000), rawbits_to_float(0x0004567a)},
+      {rawbits_to_double(0x37c159e600000001), rawbits_to_float(0x0004567a)},
+      {rawbits_to_double(0x37c159e800000000), rawbits_to_float(0x0004567a)},
+      {rawbits_to_double(0x37c159e800000001), rawbits_to_float(0x0004567a)},
+      {rawbits_to_double(0x37c159ea00000000), rawbits_to_float(0x0004567a)},
+      {rawbits_to_double(0x37c159ea00000001), rawbits_to_float(0x0004567b)},
+      {rawbits_to_double(0x37c159ec00000000), rawbits_to_float(0x0004567b)},
+      //  - The smallest double which rounds up to become a subnormal float.
+      {rawbits_to_double(0x3690000000000001), rawbits_to_float(0x00000001)},
+
+      // Check NaN payload preservation.
+      {rawbits_to_double(0x7ff82468a0000000), rawbits_to_float(0x7fc12345)},
+      {rawbits_to_double(0x7ff82468bfffffff), rawbits_to_float(0x7fc12345)},
+      //  - Signalling NaNs become quiet NaNs.
+      {rawbits_to_double(0x7ff02468a0000000), rawbits_to_float(0x7fc12345)},
+      {rawbits_to_double(0x7ff02468bfffffff), rawbits_to_float(0x7fc12345)},
+      {rawbits_to_double(0x7ff000001fffffff), rawbits_to_float(0x7fc00000)},
   };
   int count = sizeof(test) / sizeof(test[0]);
 
index 79e87ddd0c8572d7bb531f8a8e64cd37a506d16c..ac68b2119305b1d08e52f14c1da5e0c7f617bfb7 100644 (file)
@@ -16,7 +16,7 @@ TEST(CheckEqualsZeroAndMinusZero) {
 
 
 TEST(CheckEqualsReflexivity) {
-  double inf = V8_INFINITY;
+  double inf = std::numeric_limits<double>::infinity();
   double nan = v8::base::OS::nan_value();
   double constants[] = {-nan, -inf, -3.1415, -1.0,   -0.1, -0.0,
                         0.0,  0.1,  1.0,     3.1415, inf,  nan};
index 16dcb37101ef6501db6252b79c799af1ad3da2e8..3ff263daca7f386a52cddd2218845b9cbb0a546a 100644 (file)
@@ -103,8 +103,8 @@ TEST(IsDenormal) {
 
 
 TEST(IsSpecial) {
-  CHECK(Double(V8_INFINITY).IsSpecial());
-  CHECK(Double(-V8_INFINITY).IsSpecial());
+  CHECK(Double(std::numeric_limits<double>::infinity()).IsSpecial());
+  CHECK(Double(-std::numeric_limits<double>::infinity()).IsSpecial());
   CHECK(Double(v8::base::OS::nan_value()).IsSpecial());
   uint64_t bits = V8_2PART_UINT64_C(0xFFF12345, 00000000);
   CHECK(Double(bits).IsSpecial());
@@ -126,8 +126,8 @@ TEST(IsSpecial) {
 
 
 TEST(IsInfinite) {
-  CHECK(Double(V8_INFINITY).IsInfinite());
-  CHECK(Double(-V8_INFINITY).IsInfinite());
+  CHECK(Double(std::numeric_limits<double>::infinity()).IsInfinite());
+  CHECK(Double(-std::numeric_limits<double>::infinity()).IsInfinite());
   CHECK(!Double(v8::base::OS::nan_value()).IsInfinite());
   CHECK(!Double(0.0).IsInfinite());
   CHECK(!Double(-0.0).IsInfinite());
@@ -140,8 +140,8 @@ TEST(IsInfinite) {
 
 TEST(Sign) {
   CHECK_EQ(1, Double(1.0).Sign());
-  CHECK_EQ(1, Double(V8_INFINITY).Sign());
-  CHECK_EQ(-1, Double(-V8_INFINITY).Sign());
+  CHECK_EQ(1, Double(std::numeric_limits<double>::infinity()).Sign());
+  CHECK_EQ(-1, Double(-std::numeric_limits<double>::infinity()).Sign());
   CHECK_EQ(1, Double(0.0).Sign());
   CHECK_EQ(-1, Double(-0.0).Sign());
   uint64_t min_double64 = V8_2PART_UINT64_C(0x00000000, 00000001);
@@ -225,7 +225,8 @@ TEST(NextDouble) {
   CHECK_EQ(-0.0, d1.value());
   CHECK_EQ(0.0, d2.value());
   CHECK_EQ(4e-324, d2.NextDouble());
-  CHECK_EQ(-1.7976931348623157e308, Double(-V8_INFINITY).NextDouble());
-  CHECK_EQ(V8_INFINITY,
+  CHECK_EQ(-1.7976931348623157e308,
+           Double(-std::numeric_limits<double>::infinity()).NextDouble());
+  CHECK_EQ(std::numeric_limits<double>::infinity(),
            Double(V8_2PART_UINT64_C(0x7fefffff, ffffffff)).NextDouble());
 }
index 7c1118603e8c82c81df51415815430c8e2206e49..77a3dc41edac695f01f4c6431f0c96ee8e20565d 100644 (file)
@@ -200,36 +200,42 @@ TEST(Strtod) {
   CHECK_EQ(0.0, StrtodChar("0000000010000", -329));
   CHECK_EQ(0.0, StrtodChar("0000000090000", -329));
 
-  // It would be more readable to put the literals (and not V8_INFINITY) on the
+  // It would be more readable to put the literals (and not
+  // std::numeric_limits<double>::infinity()) on the
   // left side (i.e. CHECK_EQ(1e309, StrtodChar("1", 309))), but then Gcc
   // complains that the floating constant exceeds range of 'double'.
-  CHECK_EQ(V8_INFINITY, StrtodChar("1", 309));
+  CHECK_EQ(std::numeric_limits<double>::infinity(), StrtodChar("1", 309));
   CHECK_EQ(1e308, StrtodChar("1", 308));
   CHECK_EQ(1234e305, StrtodChar("1234", 305));
   CHECK_EQ(1234e304, StrtodChar("1234", 304));
-  CHECK_EQ(V8_INFINITY, StrtodChar("18", 307));
+  CHECK_EQ(std::numeric_limits<double>::infinity(), StrtodChar("18", 307));
   CHECK_EQ(17e307, StrtodChar("17", 307));
-  CHECK_EQ(V8_INFINITY, StrtodChar("0000001", 309));
+  CHECK_EQ(std::numeric_limits<double>::infinity(), StrtodChar("0000001", 309));
   CHECK_EQ(1e308, StrtodChar("00000001", 308));
   CHECK_EQ(1234e305, StrtodChar("00000001234", 305));
   CHECK_EQ(1234e304, StrtodChar("000000001234", 304));
-  CHECK_EQ(V8_INFINITY, StrtodChar("0000000018", 307));
+  CHECK_EQ(std::numeric_limits<double>::infinity(),
+           StrtodChar("0000000018", 307));
   CHECK_EQ(17e307, StrtodChar("0000000017", 307));
-  CHECK_EQ(V8_INFINITY, StrtodChar("1000000", 303));
+  CHECK_EQ(std::numeric_limits<double>::infinity(), StrtodChar("1000000", 303));
   CHECK_EQ(1e308, StrtodChar("100000", 303));
   CHECK_EQ(1234e305, StrtodChar("123400000", 300));
   CHECK_EQ(1234e304, StrtodChar("123400000", 299));
-  CHECK_EQ(V8_INFINITY, StrtodChar("180000000", 300));
+  CHECK_EQ(std::numeric_limits<double>::infinity(),
+           StrtodChar("180000000", 300));
   CHECK_EQ(17e307, StrtodChar("170000000", 300));
-  CHECK_EQ(V8_INFINITY, StrtodChar("00000001000000", 303));
+  CHECK_EQ(std::numeric_limits<double>::infinity(),
+           StrtodChar("00000001000000", 303));
   CHECK_EQ(1e308, StrtodChar("000000000000100000", 303));
   CHECK_EQ(1234e305, StrtodChar("00000000123400000", 300));
   CHECK_EQ(1234e304, StrtodChar("0000000123400000", 299));
-  CHECK_EQ(V8_INFINITY, StrtodChar("00000000180000000", 300));
+  CHECK_EQ(std::numeric_limits<double>::infinity(),
+           StrtodChar("00000000180000000", 300));
   CHECK_EQ(17e307, StrtodChar("00000000170000000", 300));
   CHECK_EQ(1.7976931348623157E+308, StrtodChar("17976931348623157", 292));
   CHECK_EQ(1.7976931348623158E+308, StrtodChar("17976931348623158", 292));
-  CHECK_EQ(V8_INFINITY, StrtodChar("17976931348623159", 292));
+  CHECK_EQ(std::numeric_limits<double>::infinity(),
+           StrtodChar("17976931348623159", 292));
 
   // The following number is the result of 89255.0/1e22. Both floating-point
   // numbers can be accurately represented with doubles. However on Linux,x86
@@ -407,7 +413,7 @@ static bool CheckDouble(Vector<const char> buffer,
     d.NormalizedBoundaries(&lower_boundary, &upper_boundary);
     return CompareBignumToDiyFp(input_digits, exponent, lower_boundary) <= 0;
   }
-  if (to_check == V8_INFINITY) {
+  if (to_check == std::numeric_limits<double>::infinity()) {
     const double kMaxDouble = 1.7976931348623157e308;
     // Check that the buffer*10^exponent >= boundary between kMaxDouble and inf.
     Double d(kMaxDouble);
index ebef527dd0b3a64b019bdcf739e59f9ceef6f73d..4fc32e9219975458dc0f7c66c39bd4ef65538f99 100644 (file)
@@ -339,10 +339,14 @@ struct Tests : Rep {
     CHECK(!T.Constant(fac->NewNumber(10e60))->Is(T.Integral32));
     CHECK(T.Constant(fac->NewNumber(-1.0*0.0))->Is(T.MinusZero));
     CHECK(T.Constant(fac->NewNumber(v8::base::OS::nan_value()))->Is(T.NaN));
-    CHECK(T.Constant(fac->NewNumber(V8_INFINITY))->Is(T.PlainNumber));
-    CHECK(!T.Constant(fac->NewNumber(V8_INFINITY))->Is(T.Integral32));
-    CHECK(T.Constant(fac->NewNumber(-V8_INFINITY))->Is(T.PlainNumber));
-    CHECK(!T.Constant(fac->NewNumber(-V8_INFINITY))->Is(T.Integral32));
+    CHECK(T.Constant(fac->NewNumber(std::numeric_limits<double>::infinity()))
+              ->Is(T.PlainNumber));
+    CHECK(!T.Constant(fac->NewNumber(std::numeric_limits<double>::infinity()))
+               ->Is(T.Integral32));
+    CHECK(T.Constant(fac->NewNumber(-std::numeric_limits<double>::infinity()))
+              ->Is(T.PlainNumber));
+    CHECK(!T.Constant(fac->NewNumber(-std::numeric_limits<double>::infinity()))
+               ->Is(T.Integral32));
   }
 
   void Range() {
index 4eac64c838b409ce0c96b1383d28dc8867c09a33..3fe4782ff33521d55c84f8190be5b7a76bd0fe11 100644 (file)
@@ -87,8 +87,10 @@ class Types {
       types.push_back(Type::Constant(*it, region));
     }
 
-    integers.push_back(isolate->factory()->NewNumber(-V8_INFINITY));
-    integers.push_back(isolate->factory()->NewNumber(+V8_INFINITY));
+    integers.push_back(isolate->factory()->NewNumber(
+        -std::numeric_limits<double>::infinity()));
+    integers.push_back(isolate->factory()->NewNumber(
+        +std::numeric_limits<double>::infinity()));
     integers.push_back(isolate->factory()->NewNumber(-rng_->NextInt(10)));
     integers.push_back(isolate->factory()->NewNumber(+rng_->NextInt(10)));
     for (int i = 0; i < 10; ++i) {
@@ -98,8 +100,10 @@ class Types {
       if (!IsMinusZero(x)) integers.push_back(isolate->factory()->NewNumber(x));
     }
 
-    Integer = Type::Range(isolate->factory()->NewNumber(-V8_INFINITY),
-                          isolate->factory()->NewNumber(+V8_INFINITY), region);
+    Integer = Type::Range(
+        isolate->factory()->NewNumber(-std::numeric_limits<double>::infinity()),
+        isolate->factory()->NewNumber(+std::numeric_limits<double>::infinity()),
+        region);
 
     NumberArray = Type::Array(Number, region);
     StringArray = Type::Array(String, region);
index 0747f0c876abacbef9285946971d63bfa312e148..8c6a4d9a3851e3f40e0048e837c713342a4ae503 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <limits>
+
 #include "src/compiler/js-builtin-reducer.h"
 #include "src/compiler/js-graph.h"
 #include "src/compiler/node-properties-inl.h"
@@ -132,7 +134,8 @@ TEST_F(JSBuiltinReducerTest, MathMax0) {
   Reduction r = Reduce(call);
 
   ASSERT_TRUE(r.Changed());
-  EXPECT_THAT(r.replacement(), IsNumberConstant(-V8_INFINITY));
+  EXPECT_THAT(r.replacement(),
+              IsNumberConstant(-std::numeric_limits<double>::infinity()));
 }
 
 
index 6a8a4d3e4b6c7639e1737538dfe5cc0dfdae489f..1f34a060fb0023bc56663c42e919e2c9210f6606 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <limits>
+
 #include "src/base/bits.h"
 #include "src/base/division-by-constant.h"
 #include "src/compiler/js-graph.h"
@@ -110,26 +112,24 @@ const float kFloat32Values[] = {
 
 
 const double kFloat64Values[] = {
-    -V8_INFINITY,  -4.23878e+275, -5.82632e+265, -6.60355e+220, -6.26172e+212,
-    -2.56222e+211, -4.82408e+201, -1.84106e+157, -1.63662e+127, -1.55772e+100,
-    -1.67813e+72,  -2.3382e+55,   -3.179e+30,    -1.441e+09,    -1.0647e+09,
-    -7.99361e+08,  -5.77375e+08,  -2.20984e+08,  -32757,        -13171,
-    -9970,         -3984,         -107,          -105,          -92,
-    -77,           -61,           -0.000208163,  -1.86685e-06,  -1.17296e-10,
-    -9.26358e-11,  -5.08004e-60,  -1.74753e-65,  -1.06561e-71,  -5.67879e-79,
-    -5.78459e-130, -2.90989e-171, -7.15489e-243, -3.76242e-252, -1.05639e-263,
-    -4.40497e-267, -2.19666e-273, -4.9998e-276,  -5.59821e-278, -2.03855e-282,
-    -5.99335e-283, -7.17554e-284, -3.11744e-309, -0.0,          0.0,
-    2.22507e-308,  1.30127e-270,  7.62898e-260,  4.00313e-249,  3.16829e-233,
-    1.85244e-228,  2.03544e-129,  1.35126e-110,  1.01182e-106,  5.26333e-94,
-    1.35292e-90,   2.85394e-83,   1.78323e-77,   5.4967e-57,    1.03207e-25,
-    4.57401e-25,   1.58738e-05,   2,             125,           2310,
-    9636,          14802,         17168,         28945,         29305,
-    4.81336e+07,   1.41207e+08,   4.65962e+08,   1.40499e+09,   2.12648e+09,
-    8.80006e+30,   1.4446e+45,    1.12164e+54,   2.48188e+89,   6.71121e+102,
-    3.074e+112,    4.9699e+152,   5.58383e+166,  4.30654e+172,  7.08824e+185,
-    9.6586e+214,   2.028e+223,    6.63277e+243,  1.56192e+261,  1.23202e+269,
-    5.72883e+289,  8.5798e+290,   1.40256e+294,  1.79769e+308,  V8_INFINITY};
+    -std::numeric_limits<double>::infinity(), -4.23878e+275, -5.82632e+265,
+    -6.60355e+220, -6.26172e+212, -2.56222e+211, -4.82408e+201, -1.84106e+157,
+    -1.63662e+127, -1.55772e+100, -1.67813e+72, -2.3382e+55, -3.179e+30,
+    -1.441e+09, -1.0647e+09, -7.99361e+08, -5.77375e+08, -2.20984e+08, -32757,
+    -13171, -9970, -3984, -107, -105, -92, -77, -61, -0.000208163, -1.86685e-06,
+    -1.17296e-10, -9.26358e-11, -5.08004e-60, -1.74753e-65, -1.06561e-71,
+    -5.67879e-79, -5.78459e-130, -2.90989e-171, -7.15489e-243, -3.76242e-252,
+    -1.05639e-263, -4.40497e-267, -2.19666e-273, -4.9998e-276, -5.59821e-278,
+    -2.03855e-282, -5.99335e-283, -7.17554e-284, -3.11744e-309, -0.0, 0.0,
+    2.22507e-308, 1.30127e-270, 7.62898e-260, 4.00313e-249, 3.16829e-233,
+    1.85244e-228, 2.03544e-129, 1.35126e-110, 1.01182e-106, 5.26333e-94,
+    1.35292e-90, 2.85394e-83, 1.78323e-77, 5.4967e-57, 1.03207e-25, 4.57401e-25,
+    1.58738e-05, 2, 125, 2310, 9636, 14802, 17168, 28945, 29305, 4.81336e+07,
+    1.41207e+08, 4.65962e+08, 1.40499e+09, 2.12648e+09, 8.80006e+30, 1.4446e+45,
+    1.12164e+54, 2.48188e+89, 6.71121e+102, 3.074e+112, 4.9699e+152,
+    5.58383e+166, 4.30654e+172, 7.08824e+185, 9.6586e+214, 2.028e+223,
+    6.63277e+243, 1.56192e+261, 1.23202e+269, 5.72883e+289, 8.5798e+290,
+    1.40256e+294, 1.79769e+308, std::numeric_limits<double>::infinity()};
 
 
 const int32_t kInt32Values[] = {
index 8a42f7d3ebc620f626f54abd639b8808a60f8a5b..c94d588b4d84bc5d3a4a3ff71f3195ed0ccc7fb2 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <limits>
+
 #include "src/compiler/js-graph.h"
 #include "src/compiler/simplified-operator.h"
 #include "src/compiler/simplified-operator-reducer.h"
@@ -50,26 +52,25 @@ class SimplifiedOperatorReducerTestWithParam
 namespace {
 
 static const double kFloat64Values[] = {
-    -V8_INFINITY,  -6.52696e+290, -1.05768e+290, -5.34203e+268, -1.01997e+268,
-    -8.22758e+266, -1.58402e+261, -5.15246e+241, -5.92107e+226, -1.21477e+226,
-    -1.67913e+188, -1.6257e+184,  -2.60043e+170, -2.52941e+168, -3.06033e+116,
-    -4.56201e+52,  -3.56788e+50,  -9.9066e+38,   -3.07261e+31,  -2.1271e+09,
-    -1.91489e+09,  -1.73053e+09,  -9.30675e+08,  -26030,        -20453,
-    -15790,        -11699,        -111,          -97,           -78,
-    -63,           -58,           -1.53858e-06,  -2.98914e-12,  -1.14741e-39,
-    -8.20347e-57,  -1.48932e-59,  -3.17692e-66,  -8.93103e-81,  -3.91337e-83,
-    -6.0489e-92,   -8.83291e-113, -4.28266e-117, -1.92058e-178, -2.0567e-192,
-    -1.68167e-194, -1.51841e-214, -3.98738e-234, -7.31851e-242, -2.21875e-253,
-    -1.11612e-293, -0.0,          0.0,           2.22507e-308,  1.06526e-307,
-    4.16643e-227,  6.76624e-223,  2.0432e-197,   3.16254e-184,  1.37315e-173,
-    2.88603e-172,  1.54155e-99,   4.42923e-81,   1.40539e-73,   5.4462e-73,
-    1.24064e-58,   3.11167e-58,   2.75826e-39,   0.143815,      58,
-    67,            601,           7941,          11644,         13697,
-    25680,         29882,         1.32165e+08,   1.62439e+08,   4.16837e+08,
-    9.59097e+08,   1.32491e+09,   1.8728e+09,    1.0672e+17,    2.69606e+46,
-    1.98285e+79,   1.0098e+82,    7.93064e+88,   3.67444e+121,  9.36506e+123,
-    7.27954e+162,  3.05316e+168,  1.16171e+175,  1.64771e+189,  1.1622e+202,
-    2.00748e+239,  2.51778e+244,  3.90282e+306,  1.79769e+308,  V8_INFINITY};
+    -std::numeric_limits<double>::infinity(), -6.52696e+290, -1.05768e+290,
+    -5.34203e+268, -1.01997e+268, -8.22758e+266, -1.58402e+261, -5.15246e+241,
+    -5.92107e+226, -1.21477e+226, -1.67913e+188, -1.6257e+184, -2.60043e+170,
+    -2.52941e+168, -3.06033e+116, -4.56201e+52, -3.56788e+50, -9.9066e+38,
+    -3.07261e+31, -2.1271e+09, -1.91489e+09, -1.73053e+09, -9.30675e+08, -26030,
+    -20453, -15790, -11699, -111, -97, -78, -63, -58, -1.53858e-06,
+    -2.98914e-12, -1.14741e-39, -8.20347e-57, -1.48932e-59, -3.17692e-66,
+    -8.93103e-81, -3.91337e-83, -6.0489e-92, -8.83291e-113, -4.28266e-117,
+    -1.92058e-178, -2.0567e-192, -1.68167e-194, -1.51841e-214, -3.98738e-234,
+    -7.31851e-242, -2.21875e-253, -1.11612e-293, -0.0, 0.0, 2.22507e-308,
+    1.06526e-307, 4.16643e-227, 6.76624e-223, 2.0432e-197, 3.16254e-184,
+    1.37315e-173, 2.88603e-172, 1.54155e-99, 4.42923e-81, 1.40539e-73,
+    5.4462e-73, 1.24064e-58, 3.11167e-58, 2.75826e-39, 0.143815, 58, 67, 601,
+    7941, 11644, 13697, 25680, 29882, 1.32165e+08, 1.62439e+08, 4.16837e+08,
+    9.59097e+08, 1.32491e+09, 1.8728e+09, 1.0672e+17, 2.69606e+46, 1.98285e+79,
+    1.0098e+82, 7.93064e+88, 3.67444e+121, 9.36506e+123, 7.27954e+162,
+    3.05316e+168, 1.16171e+175, 1.64771e+189, 1.1622e+202, 2.00748e+239,
+    2.51778e+244, 3.90282e+306, 1.79769e+308,
+    std::numeric_limits<double>::infinity()};
 
 
 static const int32_t kInt32Values[] = {