Closed Bug 1693027 Opened 3 years ago Closed 3 years ago

ScriptPreloader discards correctly decoded script incorrectly.

Categories

(Core :: XPConnect, defect)

defect

Tracking

()

RESOLVED FIXED
87 Branch
Tracking Status
firefox87 --- fixed

People

(Reporter: mgaudet, Assigned: mgaudet)

References

Details

(Keywords: perf-alert)

Attachments

(2 files)

In ScriptPreloader, when doing main thread decode we do the following:

  JS::RootedScript script(cx);
  if (JS::DecodeScript(cx, options, Range(), &script)) {
    mScript.Set(script);

    if (mCache.mSaveComplete) {
      FreeData();
    }
  }

The problem here is that JS::DecodeScript returns a JS::TranscodeResult, which has TranscodeResult_Ok = 0. In effect, regardless of whether or not we've successfully main-thread decoded a buffer, we will never set mScript to anything but null (assuming here that on failure cases the outparam isn't modified).

JS::TranscodeResult_Ok is defined to be zero; this means that during synchronous decode
of a script, regardless of if we succeed or fail we ultimately return a nullptr script.

Assignee: nobody → mgaudet
Status: NEW → ASSIGNED

Performance testing the first patch above (D105303) shows low impact in most tests, but a medium confidence 1% regression on four a11y tests .

(An alternate solution to this bug would be to just toss the main-thread decode entirely, and delete the lines highlighted in the original summary)

Attachment #9203404 - Attachment description: Bug 1693027 - Convert TranscodeResult to a strongly typed enum r?arai → Bug 1693027 - Convert TranscodeResult to a strongly typed enum r?arai!,kmag!

Updated performance result.

When I first submitted D105303 I had accidentally recapitulated the original bug in rewriting the expression.

These perf results show no impact; this problem was originally detected by seeing scripts that should have loaded from the ScriptPreloader instead coming from the StartupCache. Must not be a huge difference in which cache is serving the request, so long as one of them does?

Pushed by mgaudet@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b6113f461cb8
Explicitly check for JS::TranscodeResult_Ok r=kmag
https://hg.mozilla.org/integration/autoland/rev/1c32e8415dd6
Convert TranscodeResult to a strongly typed enum r=arai,kmag
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 87 Branch

== Change summary for alert #28880 (as of Tue, 23 Feb 2021 04:35:50 GMT) ==

Improvements:

Ratio Suite Test Platform Options Absolute values (old vs new)
10% cpstartup content-process-startup windows10-64-shippable-qr e10s stylo webrender 112.79 -> 101.42
9% cpstartup content-process-startup windows10-64-shippable-qr e10s stylo webrender-sw 112.04 -> 102.25
9% cpstartup content-process-startup windows10-64-shippable-qr e10s stylo webrender-sw 112.75 -> 103.17

For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=28880

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: