1 // Check that the EnterJIT frame, added by the JIT trampoline and
2 // usable by a native unwinder to resume unwinding after encountering
3 // JIT code, is pushed as expected.
5 // This test assumes that it's starting on an empty profiler stack.
6 // (Note that the other profiler tests also assume the profiler
7 // isn't already started.)
8 Assert
.ok(!Services
.profiler
.IsActive());
11 Services
.profiler
.StartProfiler(10000, ms
, ["js"]);
13 function has_arbitrary_name_in_stack() {
14 // A frame for |arbitrary_name| has been pushed. Do a sequence of
15 // increasingly long spins until we get a sample.
18 info("loop: ms = " + delayMS
);
19 const then
= Date
.now();
22 // eslint-disable-next-line no-empty
23 while (--n
) {} // OSR happens here
24 // Spin in the hope of getting a sample.
25 } while (Date
.now() - then
< delayMS
);
26 let profile
= Services
.profiler
.getProfileData().threads
[0];
28 // Go through all of the stacks, and search for this function name.
29 for (const sample
of profile
.samples
.data
) {
30 const stack
= getInflatedStackLocations(profile
, sample
);
31 info(`The following stack was found: ${stack}`);
32 for (var i
= 0; i
< stack
.length
; i
++) {
33 if (stack
[i
].match(/arbitrary_name/)) {
34 // This JS sample was correctly found.
40 // Continue running this function with an increasingly long delay.
42 if (delayMS
> 30000) {
48 has_arbitrary_name_in_stack(),
49 "A JS frame was found before the test timeout."
51 Services
.profiler
.StopProfiler();