summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/non-extensible-elements4.js
blob: 6b14b97c6f1d4144b0594c785ca45ffabdf5fdef (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
// When an already-non-extensible object is frozen, its Shape doesn't change.
// Make sure SetElement ICs handle this correctly.

function doStore(a) {
    for (var i = 0; i < 100; i++) {
        a[1] = i;
    }
}
function test() {
    with(this) {} // Don't Ion-compile.

    var a = {0: 0, 1: 1};
    Object.preventExtensions(a);
    doStore(a);
    assertEq(a[1], 99);

    a[1] = 0;
    Object.freeze(a);
    doStore(a);
    assertEq(a[1], 0);
}

setJitCompilerOption("ion.forceinlineCaches", 1);
test();

setJitCompilerOption("ion.forceinlineCaches", 0);
test();