Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 016d768958b2eee454036029faa4be30290ba9b7..0be9dfbc0a6719b1daca562313c1e1e0b6cb9043 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -4363,7 +4363,12 @@ void HOptimizedGraphBuilder::VisitReturnStatement(ReturnStatement* stmt) { |
TestContext* test = TestContext::cast(context); |
VisitForControl(stmt->expression(), test->if_true(), test->if_false()); |
} else if (context->IsEffect()) { |
- CHECK_ALIVE(VisitForEffect(stmt->expression())); |
+ // Visit in value context and ignore the result. This is needed to keep |
+ // environment in sync with full-codegen since some visitors (e.g. |
+ // VisitCountOperation) use the operand stack differently depending on |
+ // context. |
+ CHECK_ALIVE(VisitForValue(stmt->expression())); |
+ Pop(); |
Goto(function_return(), state); |
} else { |
ASSERT(context->IsValue()); |