Chromium Code Reviews| Index: src/hydrogen.cc |
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
| index 1593301e2ec715f7e67f0bfb17446f9941ad9fb0..0c9c1cbeae9af06687464e293f9063b84e4ad3f6 100644 |
| --- a/src/hydrogen.cc |
| +++ b/src/hydrogen.cc |
| @@ -6066,7 +6066,8 @@ void HOptimizedGraphBuilder::HandleCompoundAssignment(Assignment* expr) { |
| HValue* right = Pop(); |
| HValue* left = Pop(); |
| - Push(BuildBinaryOperation(operation, left, right)); |
| + Push(BuildBinaryOperation(operation, left, right, PUSH_BEFORE_SIMULATE)); |
| + |
| BuildStore(expr, prop, expr->id(), |
| expr->AssignmentId(), expr->IsUninitialized()); |
| } else { |
| @@ -9045,7 +9046,8 @@ HValue* HGraphBuilder::TruncateToNumber(HValue* value, Type** expected) { |
| HValue* HOptimizedGraphBuilder::BuildBinaryOperation( |
| BinaryOperation* expr, |
| HValue* left, |
| - HValue* right) { |
| + HValue* right, |
| + PushBeforeSimulateBehavior pushSimResult) { |
| Type* left_type = expr->left()->bounds().lower; |
| Type* right_type = expr->right()->bounds().lower; |
| Type* result_type = expr->bounds().lower; |
| @@ -9069,9 +9071,14 @@ HValue* HOptimizedGraphBuilder::BuildBinaryOperation( |
| // after phis, which are the result of BuildBinaryOperation when we |
| // inlined some complex subgraph. |
| if (result->HasObservableSideEffects() || result->IsPhi()) { |
| - Push(result); |
| - Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE); |
| - Drop(1); |
| + if (pushSimResult == NO_PUSH_BEFORE_SIMULATE) { |
| + Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE); |
| + } else { |
| + ASSERT(pushSimResult == PUSH_BEFORE_SIMULATE); |
| + Push(result); |
| + Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE); |
| + Drop(1); |
| + } |
| } |
| return result; |
| } |
| @@ -9451,7 +9458,11 @@ void HOptimizedGraphBuilder::VisitArithmeticExpression(BinaryOperation* expr) { |
| SetSourcePosition(expr->position()); |
| HValue* right = Pop(); |
| HValue* left = Pop(); |
| - HValue* result = BuildBinaryOperation(expr, left, right); |
| + HValue* result = |
| + BuildBinaryOperation(expr, left, right, |
| + ast_context()->IsEffect() |
|
Jakob Kummerow
2014/02/06 08:33:41
nit: preferred formatting:
ast_context(
|
| + ? NO_PUSH_BEFORE_SIMULATE |
| + : PUSH_BEFORE_SIMULATE); |
| if (FLAG_emit_opt_code_positions && result->IsBinaryOperation()) { |
| HBinaryOperation::cast(result)->SetOperandPositions( |
| zone(), expr->left()->position(), expr->right()->position()); |