bug1782003.js (840B)
1 function getStack() { 2 enableGeckoProfiling(); 3 let stack = readGeckoProfilingStack(); 4 // The number of frames depends on JIT flags, but there must be at least 5 // one frame for the caller and at most 3 total (the global script, 'testFun' 6 // and 'getStack'). 7 assertEq(stack.length > 0, true); 8 assertEq(stack.length <= 3, true); 9 assertEq(JSON.stringify(stack).includes('"testFun ('), true); 10 disableGeckoProfiling(); 11 } 12 function testFun() { 13 // Loop until this is a JIT frame. 14 while (true) { 15 let isJitFrame = inJit(); 16 if (typeof isJitFrame === "string") { 17 return; // JIT disabled. 18 } 19 if (isJitFrame) { 20 break; 21 } 22 } 23 24 // Now call getStack to check this frame is on the profiler's JIT stack. 25 getStack(); 26 getStack(); 27 } 28 testFun();