Closed Bug 1698427 Opened 4 years ago Closed 4 years ago

Refactor JS frame extraction out of MergeStacks

Categories

(Core :: Gecko Profiler, task, P2)

task

Tracking

()

RESOLVED FIXED
88 Branch
Tracking Status
firefox88 --- fixed

People

(Reporter: mozbugz, Assigned: mozbugz)

References

Details

Attachments

(3 files)

This small task moves the JS frame extraction code out of MergeStacks.
This ExtractJsFrames function will be called before MergeStacks, and even before stack-walking.

A later task will extract more data from JS frames, to be passed to stack walkers, to help them resume native walking past JIT frames.

Some changes after the previous just-move-the-code refactoring:

  • Updated functon comment for clarity.
  • Moved samplePosInBuffer computation to where it's first needed. Bonus: It won't happen anymore if there is no JS stack.
  • Construct jsIter as first for statement, it's clearer that it's the main loop iterator.
  • Moved MAX_JS_FRAMES checks into the loop body, and only when needed.
  • Moved context retrieval closer to first use. Same in MergeStacks; Note that aRegisteredThread.GetJSContext() is only reading a member variable, so it's cheap enough use it again there if needed, it may even be better overall than storing it in a register or on the stack (if the compiler couldn't optimize it already before).

Depends on D108415

In a later bug, ExtractJsFrames will retrieve more information about the JS frames, which will be given to stack walkers in order to resume native sampling past JIT stacks.

Depends on D108416

Pushed by gsquelart@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9129f0dc9f38 ExtractJsFrames factored out of MergeStacks - r=canaltinova https://hg.mozilla.org/integration/autoland/rev/314767eb5be5 Clean and optimize ExtractJsFrames - r=canaltinova https://hg.mozilla.org/integration/autoland/rev/e90eebb4095d Call ExtractJsFrames outside of MergeStacks, before native stackwalk (if present) - r=canaltinova
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 88 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: