Closed Bug 1799806 Opened 3 years ago Closed 3 years ago

Profiler misreports Ion frames as Baseline frames

Categories

(Core :: JavaScript Engine: JIT, defect, P2)

defect

Tracking

()

RESOLVED FIXED
109 Branch
Tracking Status
firefox109 --- fixed

People

(Reporter: mayankleoboy1, Assigned: jandem)

References

(Blocks 3 open bugs)

Details

Attachments

(1 file)

Go to https://codepen.io/Mamboleoo/pen/NWYQMwR

Profile: https://share.firefox.dev/3UHtv9G
I was looking at the "copy" function that profiler suggests spends 85% time in Baseline

Looking at this locally in the profiler, that copy function does seem to be a bit weird even though it's a tiny and trivial function.

I'll take a closer look later this week to see if it's there's anything weird going on.

Flags: needinfo?(jdemooij)

I looked at this more. What's happening is that the profiler gets confused when the sampler pc is in Ion IC code. At the end of JSJitProfilingFrameIterator::JSJitProfilingFrameIterator we then assume it's Baseline code.

We should probably add an IonEntry to the profiler's jitcode table for Ion IC code.

I can reproduce with something like this:

function g(o) {
    o.x = 1;
    o.y = 2;
}
function f() {
    with (this) {};
    for (var i = 0; i < 100_000_000; i++) {
        var o = {};
        var p = {a: 1};
        g(o);
        g(p);
    }
}
f();

I also noticed something unexpected with the profiler UI: if I go to the stack chart, invert the stack, and hover over a JS function stack frame, sometimes the popup displays "Category: JavaScript" instead of the sub category (for example "Category: JavaScript: JIT (Baseline)").

I don't understand yet what's causing that.

Component: JavaScript Engine → Gecko Profiler

Let's keep this in the JS component because the issue in comment 2 will require a JS engine fix.

Component: Gecko Profiler → JavaScript Engine: JIT
Severity: -- → S4
Type: task → defect
Priority: -- → P2
Summary: Codepen demo appears to spend large time in Baseline → Profiler miss reports Ion frames as Baseline frames
Duplicate of this bug: 1801436
Depends on: 1801875

Profile after bug 1801875: https://share.firefox.dev/3VosuUh
I am guessing there is more work required here.

(In reply to Mayank Bansal from comment #6)

Profile after bug 1801875: https://share.firefox.dev/3VosuUh
I am guessing there is more work required here.

Yeah that bug is just a refactoring, it shouldn't have any observable differences.

Depends on: 1802309
Summary: Profiler miss reports Ion frames as Baseline frames → Profiler misreports Ion frames as Baseline frames

This fixes an issue where the profiler reported samples in Ion IC code as Baseline code.

This patch is based on bug 1614622 part 1, where we removed similar code for the old
Ion IC system, but a bit simplified after changes in bug 1801875 and other bugs.

There might be similar issues with trampoline code. Eventually it would be nice to
report time in Baseline IC code, Ion IC code, and Trampoline code separately in the
profiler, but that needs some refactoring of how frames are reported.

Assignee: nobody → jdemooij
Status: NEW → ASSIGNED
Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ce553434720c Add entries for Ion IC code to the profiler's code table. r=iain

Could there be cases where the profiler misreports that we are spending time in Ion, but we are not?

(In reply to Mayank Bansal from comment #10)

Could there be cases where the profiler misreports that we are spending time in Ion, but we are not?

Not that I'm aware of, but the profiler has some code that's hard to reason about.

Flags: needinfo?(jdemooij)
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 109 Branch

Profile with latest Nightly: https://share.firefox.dev/3OJNN0o

See Also: → 1803781
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: