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

Unified Diff: src/compiler/typer.cc

Issue 807663006: [turbofan] Improve typing of ToBoolean. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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') | no next file » | 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 58e6c37ab51a2e5229c8d3f4e669fab78dd3cefc..b33ee0c863d26da882553dd5e7ace770d658c249 100644
--- a/src/compiler/typer.cc
+++ b/src/compiler/typer.cc
@@ -187,6 +187,9 @@ Typer::Typer(Graph* graph, MaybeHandle<Context> context)
Type::Union(Type::Union(singleton_false, zeroish, zone),
undefined_or_null, zone),
zone);
+ truish = Type::Union(
+ singleton_true,
+ Type::Union(Type::DetectableReceiver(), Type::Symbol(), zone), zone);
integer = Type::Range(minusinfinity, infinity, zone);
weakint = Type::Union(integer, nan_or_minuszero, zone);
@@ -513,8 +516,8 @@ Type* Typer::Visitor::ToPrimitive(Type* type, Typer* t) {
Type* Typer::Visitor::ToBoolean(Type* type, Typer* t) {
if (type->Is(Type::Boolean())) return type;
if (type->Is(t->falsish)) return t->singleton_false;
- if (type->Is(Type::DetectableReceiver())) return t->singleton_true;
- if (type->Is(Type::OrderedNumber()) && (type->Max() < 0 || 0 < type->Min())) {
+ if (type->Is(t->truish)) return t->singleton_true;
+ if (type->Is(Type::PlainNumber()) && (type->Max() < 0 || 0 < type->Min())) {
return t->singleton_true; // Ruled out nan, -0 and +0.
}
return Type::Boolean();
« no previous file with comments | « src/compiler/typer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698