summaryrefslogtreecommitdiffstats
path: root/tools/profiler/tests/xpcshell/test_enterjit_osr_disabling.js
blob: 2d4ffe5a109143bf68aa13cfe5ea51fe1f1dfb46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function run_test() {
  // Just skip the test if the profiler component isn't present.
  if (!AppConstants.MOZ_GECKO_PROFILER) {
    return;
  }

  Assert.ok(!Services.profiler.IsActive());

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