Debian Codegraph @

js/src/jit-test/tests/cacheir/bug1488786.js

raw
1 setJitCompilerOption('ion.forceinlineCaches', 1);
2
3 var A = Array(2**18);
4 A[0] = "A";
5 A[1] = "B";
6 A[2**14] = "C";
7 A[2**31-1] = "D";
8 A[-1] = "E";
9
10 function get_thee(a,x) {
11 return a[x];
12 }
13
14 // Warmup IC
15 for (var i = 0; i < 30; i++) {
16 get_thee(A, i % A.length);
17 }
18
19 // numberToDouble always returns a double-typed Number, so helps
20 // us ensure we're accessing the array with a double-typed Number index.
21 var y = numberToDouble(1);
22 var z = 2**31-1;
23 // Ensure we handle negative indices.
24 var a = -1;
25
26 function test() {
27 for (var i = 0; i < 30; i++) {
28 assertEq(get_thee(A,y), "B");
29 assertEq(get_thee(A,z), "D");
30 assertEq(get_thee(A,a), "E");
31 }
32 }
33 test();
34
35 if (!('oomTest' in this))
36 quit();
37
38 oomTest(test);