Index: src/ia32/full-codegen-ia32.cc |
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc |
index a5c94c6bf56e6d8abc332473548dba823ebab9c3..d32e9aa87732c40716de28fbb8ec0e154ac614bc 100644 |
--- a/src/ia32/full-codegen-ia32.cc |
+++ b/src/ia32/full-codegen-ia32.cc |
@@ -3782,17 +3782,22 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
case Token::NOT: { |
Comment cmnt(masm_, "[ UnaryOperation (NOT)"); |
- |
- Label materialize_true, materialize_false; |
- Label* if_true = NULL; |
- Label* if_false = NULL; |
- Label* fall_through = NULL; |
- // Notice that the labels are swapped. |
- context()->PrepareTest(&materialize_true, &materialize_false, |
- &if_false, &if_true, &fall_through); |
- if (context()->IsTest()) ForwardBailoutToChild(expr); |
- VisitForControl(expr->expression(), if_true, if_false, fall_through); |
- context()->Plug(if_false, if_true); // Labels swapped. |
+ if (context()->IsEffect()) { |
+ // Unary NOT has no side effects so it's only necessary to visit the |
+ // subexpression. Match the optimizing compiler by not branching. |
+ VisitForEffect(expr->expression()); |
+ } else { |
+ Label materialize_true, materialize_false; |
+ Label* if_true = NULL; |
+ Label* if_false = NULL; |
+ Label* fall_through = NULL; |
+ // Notice that the labels are swapped. |
+ context()->PrepareTest(&materialize_true, &materialize_false, |
+ &if_false, &if_true, &fall_through); |
+ if (context()->IsTest()) ForwardBailoutToChild(expr); |
+ VisitForControl(expr->expression(), if_true, if_false, fall_through); |
+ context()->Plug(if_false, if_true); // Labels swapped. |
+ } |
break; |
} |