Debian Codegraph @

js/src/jit-test/tests/basic/non-extensible-elements4.js

raw
1 // When an already-non-extensible object is frozen, its Shape doesn't change.
2 // Make sure SetElement ICs handle this correctly.
3
4 function doStore(a) {
5 for (var i = 0; i < 100; i++) {
6 a[1] = i;
7 }
8 }
9 function test() {
10 with(this) {} // Don't Ion-compile.
11
12 var a = {0: 0, 1: 1};
13 Object.preventExtensions(a);
14 doStore(a);
15 assertEq(a[1], 99);
16
17 a[1] = 0;
18 Object.freeze(a);
19 doStore(a);
20 assertEq(a[1], 0);
21 }
22
23 setJitCompilerOption("ion.forceinlineCaches", 1);
24 test();
25
26 setJitCompilerOption("ion.forceinlineCaches", 0);
27 test();