Index: src/compiler/ast-graph-builder.cc |
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc |
index 57cf360ed46483298aa782dbb97268be8d660bda..6d4dacf26df53408803b4096def3a9df8593f60f 100644 |
--- a/src/compiler/ast-graph-builder.cc |
+++ b/src/compiler/ast-graph-builder.cc |
@@ -3641,8 +3641,10 @@ Node* AstGraphBuilder::BuildToBoolean(Node* input) { |
// TODO(bmeurer, mstarzinger): Refactor this into a separate optimization |
// method. |
switch (input->opcode()) { |
- case IrOpcode::kNumberConstant: |
- return jsgraph_->BooleanConstant(!NumberMatcher(input).Is(0)); |
+ case IrOpcode::kNumberConstant: { |
+ NumberMatcher m(input); |
+ return jsgraph_->BooleanConstant(!m.Is(0) && !m.IsNaN()); |
+ } |
case IrOpcode::kHeapConstant: { |
Handle<HeapObject> object = HeapObjectMatcher(input).Value().handle(); |
return jsgraph_->BooleanConstant(object->BooleanValue()); |