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

Unified Diff: src/compiler/typer.cc

Issue 2139203002: [turbofan] Allow non-speculative operators to consume feedback types. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments. Created 4 years, 5 months 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/simplified-lowering.cc ('k') | no next file » | 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 ce8a5636233c1476de497b1db9e3c2615ce48337..0e765adb0fff61b3ceda0849b273fc79a48e3ba4 100644
--- a/src/compiler/typer.cc
+++ b/src/compiler/typer.cc
@@ -254,7 +254,6 @@ class Typer::Visitor : public Reducer {
static Type* ToNumber(Type*, Typer*);
static Type* ToObject(Type*, Typer*);
static Type* ToString(Type*, Typer*);
- static Type* NumberAbs(Type*, Typer*);
static Type* NumberCeil(Type*, Typer*);
static Type* NumberFloor(Type*, Typer*);
static Type* NumberRound(Type*, Typer*);
@@ -492,34 +491,6 @@ Type* Typer::Visitor::ToString(Type* type, Typer* t) {
}
// static
-Type* Typer::Visitor::NumberAbs(Type* type, Typer* t) {
- DCHECK(type->Is(Type::Number()));
- Factory* const f = t->isolate()->factory();
- bool const maybe_nan = type->Maybe(Type::NaN());
- bool const maybe_minuszero = type->Maybe(Type::MinusZero());
- type = Type::Intersect(type, Type::PlainNumber(), t->zone());
- double const max = type->Max();
- double const min = type->Min();
- if (min < 0) {
- if (type->Is(t->cache_.kInteger)) {
- type =
- Type::Range(0.0, std::max(std::fabs(min), std::fabs(max)), t->zone());
- } else if (min == max) {
- type = Type::Constant(f->NewNumber(std::fabs(min)), t->zone());
- } else {
- type = Type::PlainNumber();
- }
- }
- if (maybe_minuszero) {
- type = Type::Union(type, t->cache_.kSingletonZero, t->zone());
- }
- if (maybe_nan) {
- type = Type::Union(type, Type::NaN(), t->zone());
- }
- return type;
-}
-
-// static
Type* Typer::Visitor::NumberCeil(Type* type, Typer* t) {
DCHECK(type->Is(Type::Number()));
if (type->Is(t->cache_.kIntegerOrMinusZeroOrNaN)) return type;
@@ -1055,36 +1026,26 @@ Type* Typer::Visitor::JSAddTyper(Type* lhs, Type* rhs, Typer* t) {
}
}
// The addition must be numeric.
- return t->operation_typer()->NumericAdd(ToNumber(lhs, t), ToNumber(rhs, t));
+ return t->operation_typer()->NumberAdd(ToNumber(lhs, t), ToNumber(rhs, t));
}
Type* Typer::Visitor::JSSubtractTyper(Type* lhs, Type* rhs, Typer* t) {
- return t->operation_typer()->NumericSubtract(ToNumber(lhs, t),
- ToNumber(rhs, t));
+ return t->operation_typer()->NumberSubtract(ToNumber(lhs, t),
+ ToNumber(rhs, t));
}
Type* Typer::Visitor::JSMultiplyTyper(Type* lhs, Type* rhs, Typer* t) {
- return t->operation_typer()->NumericMultiply(ToNumber(lhs, t),
- ToNumber(rhs, t));
+ return t->operation_typer()->NumberMultiply(ToNumber(lhs, t),
+ ToNumber(rhs, t));
}
Type* Typer::Visitor::JSDivideTyper(Type* lhs, Type* rhs, Typer* t) {
- return t->operation_typer()->NumericDivide(ToNumber(lhs, t),
- ToNumber(rhs, t));
- lhs = ToNumber(lhs, t);
- rhs = ToNumber(rhs, 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.
- bool maybe_nan =
- lhs->Maybe(Type::NaN()) || rhs->Maybe(t->cache_.kZeroish) ||
- ((lhs->Min() == -V8_INFINITY || lhs->Max() == +V8_INFINITY) &&
- (rhs->Min() == -V8_INFINITY || rhs->Max() == +V8_INFINITY));
- return maybe_nan ? Type::Number() : Type::OrderedNumber();
+ return t->operation_typer()->NumberDivide(ToNumber(lhs, t), ToNumber(rhs, t));
}
Type* Typer::Visitor::JSModulusTyper(Type* lhs, Type* rhs, Typer* t) {
- return t->operation_typer()->NumericModulus(ToNumber(lhs, t),
- ToNumber(rhs, t));
+ return t->operation_typer()->NumberModulus(ToNumber(lhs, t),
+ ToNumber(rhs, t));
}
@@ -1655,7 +1616,7 @@ Type* Typer::Visitor::TypePlainPrimitiveToFloat64(Node* node) {
Type* Typer::Visitor::TypeNumberImul(Node* node) { return Type::Signed32(); }
Type* Typer::Visitor::TypeNumberAbs(Node* node) {
- return TypeUnaryOp(node, NumberAbs);
+ return typer_->operation_typer()->NumberAbs(Operand(node, 0));
}
Type* Typer::Visitor::TypeNumberClz32(Node* node) {
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698