Closed Bug 1933787 Opened 1 year ago Closed 9 months ago

Implement object previews/grips in C++

Categories

(DevTools :: Debugger, enhancement, P3)

enhancement

Tracking

(firefox143 fixed)

RESOLVED FIXED
143 Branch
Tracking Status
firefox143 --- fixed

People

(Reporter: alexical, Assigned: alexical)

References

Details

Attachments

(7 files)

Basically, creating previews for objects is rather expensive, and can be made much faster if implemented in C++. Simply migrating the existing JS logic into C++ is a significant speedup, but there's also more work we can do by serializing the preview into a binary representation which can be more efficiently passed to the parent process and included in profiles / elsewhere. This bug tracks at least the first part of this, and it may be most expedient to just do the serialization work as part of this.

Priority: -- → P3

The lastest mozilla-central patch can be tested by settting devtools.performance.recording.ui-base-url to https://deploy-preview-5363--perf-html.netlify.app/.
Doing this help use a custom profiler frontend that supports showing arg values, which comes from the following pull request:
https://github.com/firefox-devtools/profiler/pull/5363

With such setup, you can record traces that look like this:
https://deploy-preview-5363--perf-html.netlify.app/public/rxabzrr1e4fcb8f05aavnbm7vsgcp4cn2hg7mtr/stack-chart/?globalTrackOrder=a0w9&hiddenGlobalTracks=1w8&hiddenLocalTracksByPid=4612-0w4~4636-0~4617-0&thread=f&timelineType=category&v=10
See the popups when mouse overing the frames in the stack chart.

Adding a screenshot for posterity

This looks very promising :)

(Looks like the profiler might need to handle overflowing in the tooltip)

I just tried it, pretty cool. One question, will we be able to see arguments (and possibly return values) into native calls? Like not only to functions, but to CanvasRenderingContext2D.fillText for example

I crafted a WIP patch on top of :alexical's one against the profiler frontend in order to show the previews via DevTools Reps (React component used by the console to render any arbitraty JS value nicely):
https://github.com/firefox-devtools/profiler/pull/5394
(More info on github about the challenges of integrating reps into the profiler frontend)

Using the same mozilla-central patch attached on this bug: https://phabricator.services.mozilla.com/D236936
and then setting devtools.performance.recording.ui-base-url to https://deploy-preview-5394--perf-html.netlify.app/,
you should be able to see tracer values like on this profiler record:
https://deploy-preview-5394--perf-html.netlify.app/public/rxabzrr1e4fcb8f05aavnbm7vsgcp4cn2hg7mtr/stack-chart/?globalTrackOrder=a0w9&hiddenGlobalTracks=1w8&hiddenLocalTracksByPid=4612-0w4~4636-0~4617-0&implementation=js&search=activity-s&thread=f&timelineType=category&v=10

Depends on: 1953821
Depends on: 1953891
Attachment #9464196 - Attachment description: WIP: Bug 1933787 - Record arg values in tracer-generated profiles → Bug 1933787 - Record arg values in tracer-generated profiles r?arai
Attachment #9471276 - Attachment description: WIP: Bug 1933787 - Record basic DOM types in execution tracer → Bug 1933787 - Record basic DOM types in execution tracer r?arai
Attachment #9471277 - Attachment description: WIP: Bug 1933787 - Ingest traced values from profiler backend → Bug 1933787 - Ingest traced values from profiler backend r?aabh
Attachment #9471276 - Attachment description: Bug 1933787 - Record basic DOM types in execution tracer r?arai → WIP: Bug 1933787 - Record basic DOM types in execution tracer r?arai
Attachment #9471277 - Attachment description: Bug 1933787 - Ingest traced values from profiler backend r?aabh → Bug 1933787 - Ingest traced values from profiler backend r?canaltinova

Quick update on this: work still ongoing, but I should have a big update to the followup patches for DOM types and the profiler integration later today, together with an integration test that tests both the JS and DOM side of things.

Attachment #9471276 - Attachment description: WIP: Bug 1933787 - Record basic DOM types in execution tracer r?arai → Bug 1933787 - Record basic DOM types in execution tracer r?arai

This does not represent the finalized form for a lot of the entries in the
snapshot since some types are still not handled, but this at least lets us
exercise the code paths and ensure future additions don't change the
representations of any existing covered types. I would also like to move
the serialization code here into a module we can include from Firefox and
the profiler frontend but that's for a future patch.

Pushed by smolnar@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/dc4ef273dd82 https://hg.mozilla.org/integration/autoland/rev/ab1f4f1be64d Revert "Bug 1933787 - Test traced values with JSObjectsTestUtils r=ochameau,devtools-reviewers,profiler-reviewers,canaltinova" for causing build bustages @ ExecutionTracer.h
Pushed by abutkovits@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/d0928a3847b5 https://hg.mozilla.org/integration/autoland/rev/22eb2254b7a9 Revert "Bug 1933787 - Test traced values with JSObjectsTestUtils r=ochameau,devtools-reviewers,profiler-reviewers,canaltinova" for causing failures at test_feature_java.js.
Flags: needinfo?(dothayer)
Depends on: 1980432
Regressions: 1980583
QA Whiteboard: [qa-triage-done-c144/b143]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: