| Index: src/compiler/operation-typer.cc
|
| diff --git a/src/compiler/operation-typer.cc b/src/compiler/operation-typer.cc
|
| index 1ac1b8be1dfc669a0d2ed55011d4775dc3c9d6f5..4295a22287f1b24939ecb999358e1032170bc53b 100644
|
| --- a/src/compiler/operation-typer.cc
|
| +++ b/src/compiler/operation-typer.cc
|
| @@ -460,6 +460,16 @@ Type* OperationTyper::NumberTrunc(Type* type) {
|
| return cache_.kIntegerOrMinusZeroOrNaN;
|
| }
|
|
|
| +Type* OperationTyper::NumberToBoolean(Type* type) {
|
| + DCHECK(type->Is(Type::Number()));
|
| + if (!type->IsInhabited()) return Type::None();
|
| + if (type->Is(cache_.kZeroish)) return singleton_false_;
|
| + if (type->Is(Type::PlainNumber()) && (type->Max() < 0 || 0 < type->Min())) {
|
| + return singleton_true_; // Ruled out nan, -0 and +0.
|
| + }
|
| + return Type::Boolean();
|
| +}
|
| +
|
| Type* OperationTyper::NumberToInt32(Type* type) {
|
| DCHECK(type->Is(Type::Number()));
|
|
|
|
|