Index: src/compiler/js-typed-lowering.cc |
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc |
index 04b9b8cefde22dc5904ab8d3dcb390151c03efeb..78a0687d15a9ebe8cd339f3e9fd7c20f43f99e1b 100644 |
--- a/src/compiler/js-typed-lowering.cc |
+++ b/src/compiler/js-typed-lowering.cc |
@@ -830,6 +830,14 @@ Reduction JSTypedLowering::ReduceJSToBoolean(Node* node) { |
node->TrimInputCount(1); |
NodeProperties::ChangeOp(node, simplified()->BooleanNot()); |
return Changed(node); |
+ } else if (input_type->Is(Type::Number())) { |
+ // JSToBoolean(x:number) => NumberLessThan(#0,NumberAbs(x)) |
+ RelaxEffectsAndControls(node); |
+ node->ReplaceInput(0, jsgraph()->ZeroConstant()); |
+ node->ReplaceInput(1, graph()->NewNode(simplified()->NumberAbs(), input)); |
+ node->TrimInputCount(2); |
+ NodeProperties::ChangeOp(node, simplified()->NumberLessThan()); |
+ return Changed(node); |
} else if (input_type->Is(Type::String())) { |
// JSToBoolean(x:string) => NumberLessThan(#0,x.length) |
FieldAccess const access = AccessBuilder::ForStringLength(); |