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

Unified Diff: src/hydrogen.cc

Issue 5871002: Fix issue 979. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge/build/ia32
Patch Set: Created 10 years 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/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index e6e7e1978fe7621b04cf6ded66704d720215672a..f34beed50c1cc349312fe030325be6da491e5468 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -4533,26 +4533,25 @@ void HGraphBuilder::VisitCountOperation(CountOperation* expr) {
VISIT_FOR_VALUE(target);
- HValue* value = Pop();
- HInstruction* instr = BuildIncrement(value, inc);
- AddInstruction(instr);
-
- if (expr->is_prefix()) {
- Push(instr);
- } else {
- Push(value);
- }
+ // Match the full code generator stack by simulating an extra stack
+ // element for postfix operations in a non-effect context.
+ bool has_extra = expr->is_postfix() && !ast_context()->IsEffect();
+ HValue* before = has_extra ? Top() : Pop();
+ HInstruction* after = BuildIncrement(before, inc);
+ AddInstruction(after);
+ Push(after);
if (var->is_global()) {
HandleGlobalVariableAssignment(var,
- instr,
+ after,
expr->position(),
expr->AssignmentId());
} else {
ASSERT(var->IsStackAllocated());
- Bind(var, instr);
+ Bind(var, after);
}
- ast_context()->ReturnValue(Pop());
+ Drop(has_extra ? 2 : 1);
+ ast_context()->ReturnValue(expr->is_postfix() ? before : after);
} else if (prop != NULL) {
prop->RecordTypeFeedback(oracle());
@@ -4561,7 +4560,7 @@ void HGraphBuilder::VisitCountOperation(CountOperation* expr) {
// Named property.
// Match the full code generator stack by simulating an extra stack
- // element for postfix operations in a value context.
+ // element for postfix operations in a non-effect context.
bool has_extra = expr->is_postfix() && !ast_context()->IsEffect();
if (has_extra) Push(graph_->GetConstantUndefined());
@@ -4602,7 +4601,7 @@ void HGraphBuilder::VisitCountOperation(CountOperation* expr) {
// Keyed property.
// Match the full code generator stack by simulate an extra stack element
- // for postfix operations in a value context.
+ // for postfix operations in a non-effect context.
bool has_extra = expr->is_postfix() && !ast_context()->IsEffect();
if (has_extra) Push(graph_->GetConstantUndefined());
« 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