Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Unified Diff: src/compiler/typer.cc

Issue 813813003: Revert of Remove obsolete V8_INFINITY macro. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/js-builtin-reducer.cc ('k') | src/conversions-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/typer.cc
diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc
index 6853aaea821ac90619a6112db9ef61d16260b7b4..9101e1ddd1a5b1898aae7e69212ca4e82320628a 100644
--- a/src/compiler/typer.cc
+++ b/src/compiler/typer.cc
@@ -1,10 +1,6 @@
// Copyright 2014 the V8 project authors. All rights reserved.
// 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"
@@ -14,6 +10,7 @@
#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 {
@@ -163,10 +160,8 @@
Handle<Object> zero = f->NewNumber(0);
Handle<Object> one = f->NewNumber(1);
- Handle<Object> infinity =
- f->NewNumber(+std::numeric_limits<double>::infinity());
- Handle<Object> minusinfinity =
- f->NewNumber(-std::numeric_limits<double>::infinity());
+ Handle<Object> infinity = f->NewNumber(+V8_INFINITY);
+ Handle<Object> minusinfinity = f->NewNumber(-V8_INFINITY);
Type* number = Type::Number();
Type* signed32 = Type::Signed32();
@@ -941,7 +936,7 @@
// Any -0 is converted to 0.
static double array_min(double a[], size_t n) {
DCHECK(n != 0);
- double x = +std::numeric_limits<double>::infinity();
+ double x = +V8_INFINITY;
for (size_t i = 0; i < n; ++i) {
if (!std::isnan(a[i])) {
x = std::min(a[i], x);
@@ -957,7 +952,7 @@
// Any -0 is converted to 0.
static double array_max(double a[], size_t n) {
DCHECK(n != 0);
- double x = -std::numeric_limits<double>::infinity();
+ double x = -V8_INFINITY;
for (size_t i = 0; i < n; ++i) {
if (!std::isnan(a[i])) {
x = std::max(a[i], x);
@@ -1072,11 +1067,9 @@
// "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 == -std::numeric_limits<double>::infinity() ||
- rmax == +std::numeric_limits<double>::infinity())) ||
+ (rmin == -V8_INFINITY || rmax == +V8_INFINITY)) ||
(rhs->Maybe(t->singleton_zero) &&
- (lmin == -std::numeric_limits<double>::infinity() ||
- lmax == +std::numeric_limits<double>::infinity()));
+ (lmin == -V8_INFINITY || lmax == +V8_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);
@@ -1105,11 +1098,10 @@
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() == -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()));
+ 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));
return maybe_nan ? Type::Number() : Type::OrderedNumber();
}
@@ -1154,8 +1146,7 @@
if (lhs->Is(Type::NaN()) || rhs->Is(Type::NaN())) return Type::NaN();
if (lhs->Maybe(Type::NaN()) || rhs->Maybe(t->zeroish) ||
- lhs->Min() == -std::numeric_limits<double>::infinity() ||
- lhs->Max() == +std::numeric_limits<double>::infinity()) {
+ lhs->Min() == -V8_INFINITY || lhs->Max() == +V8_INFINITY) {
// Result maybe NaN.
return Type::Number();
}
« no previous file with comments | « src/compiler/js-builtin-reducer.cc ('k') | src/conversions-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698