Index: src/compiler/ast-graph-builder.cc |
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc |
index 9be3349bf085a1f0a76485b2ba956c5486451a5f..4dc3acdfa1339c1252bd73a1ecc080e5784ae1bd 100644 |
--- a/src/compiler/ast-graph-builder.cc |
+++ b/src/compiler/ast-graph-builder.cc |
@@ -3011,8 +3011,9 @@ void AstGraphBuilder::VisitTypeof(UnaryOperation* expr) { |
void AstGraphBuilder::VisitNot(UnaryOperation* expr) { |
VisitForValue(expr->expression()); |
Node* operand = environment()->Pop(); |
- // TODO(mstarzinger): Possible optimization when we are in effect context. |
- Node* value = NewNode(javascript()->UnaryNot(), operand); |
+ Node* input = BuildToBoolean(operand); |
+ Node* value = NewNode(common()->Select(kMachAnyTagged), input, |
+ jsgraph()->FalseConstant(), jsgraph()->TrueConstant()); |
ast_context()->ProduceValue(value); |
} |
@@ -3960,7 +3961,6 @@ Node* AstGraphBuilder::TryFastToBoolean(Node* input) { |
case IrOpcode::kJSLessThanOrEqual: |
case IrOpcode::kJSGreaterThan: |
case IrOpcode::kJSGreaterThanOrEqual: |
- case IrOpcode::kJSUnaryNot: |
case IrOpcode::kJSToBoolean: |
case IrOpcode::kJSDeleteProperty: |
case IrOpcode::kJSHasProperty: |