Chromium Code Reviews| 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; |