Index: src/compiler/js-typed-lowering.cc |
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc |
index de471c9e9e1a9c6ea75ef5cff2832d7c8ab369be..23f37c3055ed7ea11162417f95987fe0e4a7430c 100644 |
--- a/src/compiler/js-typed-lowering.cc |
+++ b/src/compiler/js-typed-lowering.cc |
@@ -528,6 +528,13 @@ JSTypedLowering::JSTypedLowering(Editor* editor, |
dependencies_(dependencies), |
flags_(flags), |
jsgraph_(jsgraph), |
+ pointer_comparable_type_(Type::Union( |
+ Type::Oddball(), |
+ Type::Union( |
+ Type::SymbolOrReceiver(), |
+ Type::HeapConstant(factory()->empty_string(), graph()->zone()), |
+ graph()->zone()), |
+ graph()->zone())), |
type_cache_(TypeCache::Get()) { |
for (size_t k = 0; k < arraysize(shifted_int32_ranges_); ++k) { |
double min = kMinInt / (1 << k); |
@@ -1010,7 +1017,7 @@ Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node, bool invert) { |
if (r.BothInputsAre(Type::Unique())) { |
return r.ChangeToPureOperator(simplified()->ReferenceEqual(), invert); |
} |
- if (r.OneInputIs(Type::NonStringUniqueOrHole())) { |
+ if (r.OneInputIs(pointer_comparable_type_)) { |
return r.ChangeToPureOperator(simplified()->ReferenceEqual(), invert); |
} |
if (r.IsInternalizedStringCompareOperation()) { |
@@ -1074,6 +1081,14 @@ Reduction JSTypedLowering::ReduceJSToBoolean(Node* node) { |
node->TrimInputCount(1); |
NodeProperties::ChangeOp(node, simplified()->BooleanNot()); |
return Changed(node); |
+ } else if (input_type->Is(Type::String())) { |
+ // JSToBoolean(x:string) => BooleanNot(ReferenceEqual(x,"")) |
+ node->ReplaceInput(0, |
+ graph()->NewNode(simplified()->ReferenceEqual(), input, |
+ jsgraph()->EmptyStringConstant())); |
+ node->TrimInputCount(1); |
+ NodeProperties::ChangeOp(node, simplified()->BooleanNot()); |
+ return Changed(node); |
} |
return NoChange(); |
} |