// 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
// 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);
// 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);
// 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"
// 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);
#include "src/assembler.h"
#include <cmath>
+#include <limits>
+
#include "src/api.h"
#include "src/base/cpu.h"
#include "src/base/functional.h"
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;
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
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) {
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;
}
}
// 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"
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
// 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"
#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 {
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();
// 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);
// 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);
// "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);
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();
}
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();
}
#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.
}
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;
}
}
- 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 {
#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
// 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"
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.
// 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"
} 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());
}
}
}
// 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
// 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);
// 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);
// (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"
// 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.
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;
}
// 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
// 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);
// 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);
// 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"
// 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.
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;
}
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;
}
// 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
// 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(¬_minus_inf1);
__ fneg(double_result, double_scratch);
// 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(¬_minus_inf2);
__ fmr(double_result, kDoubleRegZero);
// 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"
// 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);
// 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"
static double BignumStrtod(Vector<const char> buffer,
int exponent,
double guess) {
- if (guess == V8_INFINITY) {
+ if (guess == std::numeric_limits<double>::infinity()) {
return guess;
}
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;
// 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"
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());
}
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());
}
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},
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},
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)) {
// 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));
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(); }
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};
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());
}
}
- double inf = V8_INFINITY;
+ double inf = std::numeric_limits<double>::infinity();
R.CheckPutConstantOnRight(-inf);
R.CheckPutConstantOnRight(-0.1);
R.CheckPutConstantOnRight(0.1);
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"));
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),
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};
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);
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());
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)]);
}
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)]);
}
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]);
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]);
__ 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.
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:
//
// 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]);
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};
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());
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());
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);
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());
}
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
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);
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() {
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) {
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);
// 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"
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()));
}
// 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"
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[] = {
// 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"
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[] = {