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

Unified Diff: src/compiler/typer.cc

Issue 2681273002: [turbofan] Utilize the fact that empty string is canonicalized. (Closed)
Patch Set: Feedback. Cleanup. 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
« no previous file with comments | « src/compiler/typer.h ('k') | src/compiler/types.h » ('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 500c71aca1dd99059fe5610eea12c3513f932058..5fb20da9a5df17e8f6edf4cb87e1666dfa8aaa75 100644
--- a/src/compiler/typer.cc
+++ b/src/compiler/typer.cc
@@ -43,13 +43,14 @@ Typer::Typer(Isolate* isolate, Flags flags, Graph* graph)
Zone* zone = this->zone();
Factory* const factory = isolate->factory();
- singleton_false_ = Type::HeapConstant(factory->false_value(), zone);
- singleton_true_ = Type::HeapConstant(factory->true_value(), zone);
- singleton_the_hole_ = Type::HeapConstant(factory->the_hole_value(), zone);
+ singleton_empty_string_ = Type::HeapConstant(factory->empty_string(), zone);
+ singleton_false_ = operation_typer_.singleton_false();
+ singleton_true_ = operation_typer_.singleton_true();
falsish_ = Type::Union(
Type::Undetectable(),
Type::Union(Type::Union(singleton_false_, cache_.kZeroish, zone),
- singleton_the_hole_, zone),
+ Type::Union(singleton_empty_string_, Type::Hole(), zone),
+ zone),
zone);
truish_ = Type::Union(
singleton_true_,
@@ -908,8 +909,7 @@ Type* Typer::Visitor::JSStrictEqualTyper(Type* lhs, Type* rhs, Typer* t) {
(lhs->Max() < rhs->Min() || lhs->Min() > rhs->Max())) {
return t->singleton_false_;
}
- if ((lhs->Is(t->singleton_the_hole_) || rhs->Is(t->singleton_the_hole_)) &&
- !lhs->Maybe(rhs)) {
+ if ((lhs->Is(Type::Hole()) || rhs->Is(Type::Hole())) && !lhs->Maybe(rhs)) {
return t->singleton_false_;
}
if (lhs->IsHeapConstant() && rhs->Is(lhs)) {
« no previous file with comments | « src/compiler/typer.h ('k') | src/compiler/types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698