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

Unified Diff: src/compiler/typer.cc

Issue 2697063002: Fix typeof optimization for undetectable (Closed)
Patch Set: Add TypeOfIsFunction to EscapeStatusAnalysis Created 3 years, 10 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
Index: src/compiler/typer.cc
diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc
index 5fb20da9a5df17e8f6edf4cb87e1666dfa8aaa75..b670f52fbbec1003cbbd1db1cc51aaceb9b96f8e 100644
--- a/src/compiler/typer.cc
+++ b/src/compiler/typer.cc
@@ -291,6 +291,7 @@ class Typer::Visitor : public Reducer {
static Type* ObjectIsSmi(Type*, Typer*);
static Type* ObjectIsString(Type*, Typer*);
static Type* ObjectIsUndetectable(Type*, Typer*);
+ static Type* TypeOfIsFunction(Type*, Typer*);
static ComparisonOutcome JSCompareTyper(Type*, Type*, Typer*);
@@ -546,6 +547,11 @@ Type* Typer::Visitor::ObjectIsUndetectable(Type* type, Typer* t) {
return Type::Boolean();
}
+Type* Typer::Visitor::TypeOfIsFunction(Type* type, Typer* t) {
+ if (type->Is(Type::Function())) return t->singleton_true_;
+ if (!type->Maybe(Type::Function())) return t->singleton_false_;
+ return Type::Boolean();
+}
// -----------------------------------------------------------------------------
@@ -1926,6 +1932,10 @@ Type* Typer::Visitor::TypeObjectIsUndetectable(Node* node) {
return TypeUnaryOp(node, ObjectIsUndetectable);
}
+Type* Typer::Visitor::TypeTypeOfIsFunction(Node* node) {
+ return TypeUnaryOp(node, TypeOfIsFunction);
+}
+
Type* Typer::Visitor::TypeNewUnmappedArgumentsElements(Node* node) {
return Type::OtherInternal();
}

Powered by Google App Engine
This is Rietveld 408576698