blob: f989db1542ff7880d4273855f08806c8f7aa06f9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
// Always use the per-element barrier.
gczeal(12);
function f() {
var arr = [];
for (var i = 0; i < 1000; i++)
arr.push(i);
gc(); // Ensure arr is tenured.
// Now store a nursery object somewhere in the array, shift elements,
// trigger a GC, and check the post barrier kept the object alive.
for (var i = 0; i < 20; i++)
arr.shift();
for (var i = 0; i < 40; i++)
arr[900] = {x: i};
for (var i = 0; i < 10; i++)
arr.shift();
gc();
assertEq(arr[890].x, 39);
}
f();
|