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

Unified Diff: test/mjsunit/allocation-folding.js

Issue 22915007: Clear next map word when folding allocations into js arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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 | « src/objects-inl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/allocation-folding.js
diff --git a/test/mjsunit/allocation-folding.js b/test/mjsunit/allocation-folding.js
index fe5fa6d855e5894c2a3f136db2c14a3a865fbe40..ec07392f2c223687f3e6c4bcd6d0df8cabde59f4 100644
--- a/test/mjsunit/allocation-folding.js
+++ b/test/mjsunit/allocation-folding.js
@@ -56,7 +56,7 @@ function doubles() {
doubles(); doubles(); doubles();
%OptimizeFunctionOnNextCall(doubles);
-var result = doubles();
+result = doubles();
gc();
@@ -72,8 +72,31 @@ function doubles_int() {
doubles_int(); doubles_int(); doubles_int();
%OptimizeFunctionOnNextCall(doubles_int);
-var result = doubles_int();
+result = doubles_int();
gc();
assertEquals(result[1], 3.1);
+
+// Test allocation folding over a branch.
+
+function branch_int(left) {
+ var elem1 = [1, 2];
+ var elem2;
+ if (left) {
+ elem2 = [3, 4];
+ } else {
+ elem2 = [5, 6];
+ }
+ return elem2;
+}
+
+branch_int(1); branch_int(1); branch_int(1);
+%OptimizeFunctionOnNextCall(branch_int);
+result = branch_int(1);
+var result2 = branch_int(0);
+
+gc();
+
+assertEquals(result[1], 4);
+assertEquals(result2[1], 6);
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698