summaryrefslogtreecommitdiffstats
path: root/tools/profiler/tests/test_enterjit_osr_enabling.js
blob: ae696057b7b8943578a4232b4b7d83684e6739a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function run_test() {
    let p = Cc["@mozilla.org/tools/profiler;1"];
    // Just skip the test if the profiler component isn't present.
    if (!p)
	return;
    p = p.getService(Ci.nsIProfiler);
    if (!p)
	return;

    do_check_true(!p.IsActive());

    // The function is entered with the profiler disabled.
    (function (){
	p.StartProfiler(100, 10, ["js"], 1);
	let n = 10000;
	while (--n); // OSR happens here with the profiler enabled.
	// An assertion will fail when this function returns, if the
	// SPS stack was misbalanced.
    })();
    p.StopProfiler();
}