summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/cacheir/bug1757634.js
blob: 97ea3a87f4c35fb19ba66aac082c43d59ca7b5a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function testSmallIndex() {
   var proto = Object.create(null);
   var arr = [];
   Object.setPrototypeOf(arr, proto);

   proto[0] = 123;
   Object.freeze(proto);

   for (var i = 0; i < 20; i++) {
      arr[0] = 321;
   }
   assertEq(arr[0], 123);
}
testSmallIndex();

function testLargeIndex() {
   var proto = Object.create(null);
   var arr = [];
   Object.setPrototypeOf(arr, proto);

   proto[98765432] = 123;
   Object.freeze(proto);

   for (var i = 0; i < 20; i++) {
      arr[98765432] = 321;
   }
   assertEq(arr[98765432], 123);
}
testLargeIndex();