Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Unified Diff: src/hydrogen.cc

Issue 132453009: Binary operation deoptimization fix. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Minor tweaks + added test Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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());

Powered by Google App Engine
This is Rietveld 408576698