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

Unified Diff: src/compiler/typer.cc

Issue 1894523002: [turbofan] Introduce ObjectIsString operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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.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 515622e1b80645fbd55905e5c5895f8e284708bd..2ac137641d54cab8605cb1ef47b713c46acc4257 100644
--- a/src/compiler/typer.cc
+++ b/src/compiler/typer.cc
@@ -250,6 +250,7 @@ class Typer::Visitor : public Reducer {
static Type* ObjectIsNumber(Type*, Typer*);
static Type* ObjectIsReceiver(Type*, Typer*);
static Type* ObjectIsSmi(Type*, Typer*);
+ static Type* ObjectIsString(Type*, Typer*);
static Type* ObjectIsUndetectable(Type*, Typer*);
static Type* JSAddRanger(RangeType*, RangeType*, Typer*);
@@ -577,6 +578,11 @@ Type* Typer::Visitor::ObjectIsSmi(Type* type, Typer* t) {
return Type::Boolean();
}
+Type* Typer::Visitor::ObjectIsString(Type* type, Typer* t) {
+ if (type->Is(Type::String())) return t->singleton_true_;
+ if (!type->Maybe(Type::String())) return t->singleton_false_;
+ return Type::Boolean();
+}
Type* Typer::Visitor::ObjectIsUndetectable(Type* type, Typer* t) {
if (type->Is(Type::Undetectable())) return t->singleton_true_;
@@ -1997,6 +2003,9 @@ Type* Typer::Visitor::TypeObjectIsSmi(Node* node) {
return TypeUnaryOp(node, ObjectIsSmi);
}
+Type* Typer::Visitor::TypeObjectIsString(Node* node) {
+ return TypeUnaryOp(node, ObjectIsString);
+}
Type* Typer::Visitor::TypeObjectIsUndetectable(Node* node) {
return TypeUnaryOp(node, ObjectIsUndetectable);
« no previous file with comments | « src/compiler/simplified-operator.cc ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698