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

Unified Diff: test/mjsunit/array-bounds-check-removal.js

Issue 11486007: Fix for when array bounds check elimination tries to modify a phi index. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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
« src/hydrogen.cc ('K') | « src/hydrogen.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/array-bounds-check-removal.js
diff --git a/test/mjsunit/array-bounds-check-removal.js b/test/mjsunit/array-bounds-check-removal.js
index df7988bdaa38597e581ad759032adeabaa784bdf..7a7cb304def2d79879770cb2f27232f08406d94f 100644
--- a/test/mjsunit/array-bounds-check-removal.js
+++ b/test/mjsunit/array-bounds-check-removal.js
@@ -178,5 +178,29 @@ short_test(a, 0);
assertTrue(%GetOptimizationStatus(short_test) != 1);
+// A test for when we would modify a phi index.
+var data_phi = [0, 1, 2, 3, 4, 5, 6, 7, 8];
+function test_phi(a, base, check) {
+ var index;
+ if (check) {
+ index = base + 1;
+ } else {
+ index = base + 2;
+ }
+ var result = a[index];
+ result += a[index + 1];
+ result += a[index - 1];
+ return result;
+}
+var result_phi = 0;
+result_phi = test_phi(data_phi, 3, true);
+assertEquals(12, result_phi);
+result_phi = test_phi(data_phi, 3, true);
+assertEquals(12, result_phi);
+%OptimizeFunctionOnNextCall(test_phi);
+result_phi = test_phi(data_phi, 3, true);
+assertEquals(12, result_phi);
+
+
gc();
« src/hydrogen.cc ('K') | « src/hydrogen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698