Bug 1782188 - Use more reliable endStackAddress when profiling JIT/Wasm frames. r=iain

We were using the activation's exitFP for this, but that value isn't cleared
when we return to JIT code from C++ so we could use stale values if we're in JIT
code (or used `callWithABI` calls without an exit frame). This could result in
unsymbolicated frames or missing frames in profiles.

This patch changes the JIT and Wasm frame iterators to set `endStackAddress` from
their constructor. In the outer iterator we then keep track of the first value for
the current activation and use that instead of the activation's exitFP.

Adds an assertion to the single-step callback to check `frame.endStackAddress >= state.sp`
in simulator builds. This failed on many jit-tests before this patch and passes now.

Differential Revision: https://phabricator.services.mozilla.com/D153214
This commit is contained in:
Jan de Mooij
2022-08-01 11:10:52 +00:00
parent 85dcae1bb7
commit 2d245c757d
7 changed files with 48 additions and 5 deletions

View File

@@ -7437,6 +7437,8 @@ static void SingleStepCallback(void* arg, jit::Simulator* sim, void* pc) {
JS::ProfilingFrameIterator::Frame frames[16];
uint32_t nframes = i.extractStack(frames, 0, 16);
for (uint32_t i = 0; i < nframes; i++) {
// Assert endStackAddress never exceeds sp (bug 1782188).
MOZ_ASSERT(frames[i].endStackAddress >= state.sp);
if (frameNo > 0) {
if (!stack.append(",", 1)) {
oomUnsafe.crash("stack.append");