summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/profiler/getter-setter-ic.js
blob: 225d69895e23d3bebd074f5bf2ef7280cc7464a1 (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
30
31
32
// Ensure readGeckoProfilingStack() doesn't crash with Ion
// getter/setter ICs on the stack.
function getObjects() {
    var objs = [];
    objs.push({x: 0, get prop() {
	readGeckoProfilingStack();
	return ++this.x;
    }, set prop(v) {
	readGeckoProfilingStack();
	this.x = v + 2;
    }});
    objs.push({x: 0, y: 0, get prop() {
	readGeckoProfilingStack();
	return this.y;
    }, set prop(v) {
	readGeckoProfilingStack();
	this.y = v;
    }});
    return objs;
}
function f() {
    var objs = getObjects();
    var res = 0;
    for (var i=0; i<100; i++) {
	var o = objs[i % objs.length];
	res += o.prop;
	o.prop = i;
    }
    assertEq(res, 4901);
}
enableGeckoProfiling();
f();