A small code review. Reviewers: Jakob,

Message:
PTAL

Description:
Properly close the CountOperation value/effect context after leaving the store
effect context.

Please review this at https://chromiumcodereview.appspot.com/23897003/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files +9, -11:
  M src/hydrogen.cc
  A + test/mjsunit/regress/post-increment-close-context.js


Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 25522e87ec0b128fd4f020486e4fbb06c5162a8a..2692b3f1b8cf1df2f02e4668e793e6643dfb4f28 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -7573,9 +7573,10 @@ void HOptimizedGraphBuilder::VisitCountOperation(CountOperation* expr) {
           EffectContext for_effect(this);
           Push(object);
           Push(after);
-          return BuildStoreNamed(expr, expr->id(), expr->position(),
- expr->AssignmentId(), prop, object, after);
+          BuildStoreNamed(expr, expr->id(), expr->position(),
+                          expr->AssignmentId(), prop, object, after);
         }
+        return ast_context()->ReturnValue(Pop());
       }

       return BuildStoreNamed(expr, expr->id(), expr->position(),
Index: test/mjsunit/regress/post-increment-close-context.js
diff --git a/test/mjsunit/compiler/increment-typefeedback.js b/test/mjsunit/regress/post-increment-close-context.js
similarity index 93%
copy from test/mjsunit/compiler/increment-typefeedback.js
copy to test/mjsunit/regress/post-increment-close-context.js
index 798959296c43014f252d65ae5dd11e00563bfd04..20569328233525b701efcecd1dd0ff617c590dc9 100644
--- a/test/mjsunit/compiler/increment-typefeedback.js
+++ b/test/mjsunit/regress/post-increment-close-context.js
@@ -27,13 +27,10 @@

 // Flags: --allow-natives-syntax

-function f(x) {
-  x++;
-  return x;
+var foo = {bar: 0};
+function crash() {
+    return !(foo.bar++);
 }
-
-f(0.5);
-f(0.5);
-%OptimizeFunctionOnNextCall(f);
-f(0.5);
-assertOptimized(f);
+crash();
+%OptimizeFunctionOnNextCall(crash);
+crash();


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to