Index: src/compiler/typer.cc |
diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc |
index 5270be010cf6c476c318aa47b8d1f1c31038730b..6778c8d3b3a8e4e8207f9cf65013663447f9f9bd 100644 |
--- a/src/compiler/typer.cc |
+++ b/src/compiler/typer.cc |
@@ -57,10 +57,8 @@ Typer::Typer(Isolate* isolate, Graph* graph, Flags flags, |
unsigned32ish_ = Type::Union(Type::Unsigned32(), truncating_to_zero, zone); |
falsish_ = Type::Union( |
Type::Undetectable(), |
- Type::Union( |
- Type::Union(Type::Union(singleton_false_, cache_.kZeroish, zone), |
- Type::NullOrUndefined(), zone), |
- singleton_the_hole_, zone), |
+ Type::Union(Type::Union(singleton_false_, cache_.kZeroish, zone), |
+ singleton_the_hole_, zone), |
zone); |
truish_ = Type::Union( |
singleton_true_, |
@@ -248,6 +246,7 @@ class Typer::Visitor : public Reducer { |
static Type* ObjectIsNumber(Type*, Typer*); |
static Type* ObjectIsReceiver(Type*, Typer*); |
static Type* ObjectIsSmi(Type*, Typer*); |
+ static Type* ObjectIsUndetectable(Type*, Typer*); |
static Type* JSAddRanger(RangeType*, RangeType*, Typer*); |
static Type* JSSubtractRanger(RangeType*, RangeType*, Typer*); |
@@ -473,7 +472,9 @@ Type* Typer::Visitor::ToObject(Type* type, Typer* t) { |
// ES6 section 7.1.13 ToObject ( argument ) |
if (type->Is(Type::Receiver())) return type; |
if (type->Is(Type::Primitive())) return Type::OtherObject(); |
- if (!type->Maybe(Type::Undetectable())) return Type::DetectableReceiver(); |
+ if (!type->Maybe(Type::OtherUndetectable())) { |
+ return Type::DetectableReceiver(); |
+ } |
return Type::Receiver(); |
} |
@@ -537,6 +538,13 @@ Type* Typer::Visitor::ObjectIsSmi(Type* type, Typer* t) { |
} |
+Type* Typer::Visitor::ObjectIsUndetectable(Type* type, Typer* t) { |
+ if (type->Is(Type::Undetectable())) return t->singleton_true_; |
+ if (!type->Maybe(Type::Undetectable())) return t->singleton_false_; |
+ return Type::Boolean(); |
+} |
+ |
+ |
// ----------------------------------------------------------------------------- |
@@ -1175,7 +1183,7 @@ Type* Typer::Visitor::JSTypeOfTyper(Type* type, Typer* t) { |
return Type::Constant(f->string_string(), t->zone()); |
} else if (type->Is(Type::Symbol())) { |
return Type::Constant(f->symbol_string(), t->zone()); |
- } else if (type->Is(Type::Union(Type::Undefined(), Type::Undetectable(), |
+ } else if (type->Is(Type::Union(Type::Undefined(), Type::OtherUndetectable(), |
t->zone()))) { |
return Type::Constant(f->undefined_string(), t->zone()); |
} else if (type->Is(Type::Null())) { |
@@ -1926,6 +1934,11 @@ Type* Typer::Visitor::TypeObjectIsSmi(Node* node) { |
} |
+Type* Typer::Visitor::TypeObjectIsUndetectable(Node* node) { |
+ return TypeUnaryOp(node, ObjectIsUndetectable); |
+} |
+ |
+ |
// Machine operators. |
Type* Typer::Visitor::TypeLoad(Node* node) { return Type::Any(); } |