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

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 1409933003: [turbofan] Fix frame states for CountOperation (again). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index ae305d3f0479f94a1727d5330275fed4249447a1..ad17c2c781e8a74106bf3ef85f2c86e65fdb7494 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -2591,7 +2591,9 @@ void AstGraphBuilder::VisitCountOperation(CountOperation* expr) {
// Reserve space for result of postfix operation.
bool is_postfix = expr->is_postfix() && !ast_context()->IsEffect();
- if (is_postfix) environment()->Push(jsgraph()->UndefinedConstant());
+ if (is_postfix && assign_type != VARIABLE) {
+ environment()->Push(jsgraph()->ZeroConstant());
+ }
// Evaluate LHS expression and get old value.
Node* old_value = NULL;
@@ -2674,16 +2676,19 @@ void AstGraphBuilder::VisitCountOperation(CountOperation* expr) {
OutputFrameStateCombine::Push());
}
+ // Create a proper eager frame state for the stores.
+ environment()->Push(old_value);
+ FrameStateBeforeAndAfter store_states(this, expr->ToNumberId());
+ old_value = environment()->Pop();
+
// Save result for postfix expressions at correct stack depth.
if (is_postfix) {
- environment()->Poke(stack_depth, old_value);
- } else {
- environment()->Push(old_value);
+ if (assign_type != VARIABLE) {
+ environment()->Poke(stack_depth, old_value);
+ } else {
+ environment()->Push(old_value);
+ }
}
- // TODO(bmeurer): This might not match the fullcodegen in case of non VARIABLE
- // eager deoptimization; we will figure out when we get there.
- FrameStateBeforeAndAfter store_states(this, expr->ToNumberId());
- if (!is_postfix) old_value = environment()->Pop();
// Create node to perform +1/-1 operation.
Node* value;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698