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

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

Issue 10905232: Fixed bounds check removal by restricting it to int32 indexes (and reenabled both ABCR and index de… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added test. Created 8 years, 3 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/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 0ab30963261a4d995fa8523af589384d51c191ca..a69dae658d1c1b2fe69838a570f44b8c2468f3e6 100644
--- a/test/mjsunit/array-bounds-check-removal.js
+++ b/test/mjsunit/array-bounds-check-removal.js
@@ -29,6 +29,35 @@
var a = new Int32Array(1024);
+// Test that we do not assert if the accessed index has not an int32 rep.
+{
+ var v = [0, 1, 2, 3, 4, 5, 6, 7,8, 9];
Toon Verwaest 2012/09/12 15:51:47 nit: The indentation seems to be off. There's no s
+
+ function test(vector, base) {
+ var r = 0;
+ var a1 = base + 1;
+ var a2 = base + 2;
+ var a3 = base + 3;
+ var a4 = base + 4;
+ if (a1 == 2) {
+ r += vector[a1];
+ r += vector[a4];
+ r += vector[a2];
+ r += vector[a3];
+ } else {
+ return r;
Toon Verwaest 2012/09/12 15:51:47 nit: We can just drop the else branch.
+ }
+ return r;
+ }
+
+ test(v,1);
+ test(v,1);
+ test(v,"a");
+ test(v,"a");
+ %OptimizeFunctionOnNextCall(test);
+ test(v,0);
+}
+
function test_base(base,cond) {
a[base + 1] = 1;
a[base + 4] = 2;
« no previous file with comments | « src/hydrogen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698