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

Unified Diff: src/compiler/typer.cc

Issue 1843533003: [turbofan] Introduce NumberFloor simplified operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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-operator-reducer.cc ('k') | src/compiler/verifier.cc » ('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 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);
« no previous file with comments | « src/compiler/simplified-operator-reducer.cc ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698