Index: src/compiler/typer.cc |
diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc |
index 5ea84bd90cdfb11c5dc0011898b26f350783dd71..e11e7c4be16b32617668fc3c09cea118a2efb610 100644 |
--- a/src/compiler/typer.cc |
+++ b/src/compiler/typer.cc |
@@ -240,6 +240,7 @@ class Typer::Visitor : public Reducer { |
static Type* ToNumber(Type*, Typer*); |
static Type* ToObject(Type*, Typer*); |
static Type* ToString(Type*, Typer*); |
+ static Type* NumberFloor(Type*, Typer*); |
static Type* NumberToInt32(Type*, Typer*); |
static Type* NumberToUint32(Type*, Typer*); |
@@ -487,6 +488,12 @@ Type* Typer::Visitor::ToString(Type* type, Typer* t) { |
return Type::String(); |
} |
+// static |
+Type* Typer::Visitor::NumberFloor(Type* type, Typer* t) { |
+ DCHECK(type->Is(Type::Number())); |
+ if (type->Is(t->cache_.kIntegerOrMinusZeroOrNaN)) return type; |
+ return t->cache_.kIntegerOrMinusZeroOrNaN; |
+} |
Type* Typer::Visitor::NumberToInt32(Type* type, Typer* t) { |
// TODO(neis): DCHECK(type->Is(Type::Number())); |
@@ -1715,6 +1722,9 @@ Type* Typer::Visitor::TypeNumberShiftRightLogical(Node* node) { |
return Type::Unsigned32(); |
} |
+Type* Typer::Visitor::TypeNumberFloor(Node* node) { |
+ return TypeUnaryOp(node, NumberFloor); |
+} |
Type* Typer::Visitor::TypeNumberToInt32(Node* node) { |
return TypeUnaryOp(node, NumberToInt32); |