Closed Bug 1687338 Opened 4 years ago Closed 4 years ago

Move ScriptSource XDR-encoding to the linearize step of Stencil-XDR

Categories

(Core :: JavaScript Engine, task, P1)

task

Tracking

()

RESOLVED FIXED
86 Branch
Tracking Status
firefox86 --- fixed

People

(Reporter: tcampbell, Assigned: tcampbell)

References

(Blocks 1 open bug)

Details

Attachments

(5 files)

When encoding a script for the bytecode cache in incremental mode, we currently transcode the ScriptSource in the initial encoding. This work is done on main-thread, during page load.

Another consequence, is that since this is so early, there is rarely a chance for source compression to have taken effect (which the transcoder supports) and we end up with larger cache files and more time in IPC and I/O.

Since the incremental encoder is associated with a ScriptSource, it will still always be available to us during the linearize step. We can instead perform the encoding of scriptsource here which has numerous benefits.

  • ScriptSources have more opportunities to compress
  • Duplicate copies of source aren't kept in memory during page load
  • If encoding is aborted before saved to cache, the scriptsource encoding is also avoided.

Instead of transcoding the ScriptSource immediately when the
incremental-encoder is started, we should defer until the 'linearize' step
which still has access to the ScriptSource. This moves work from page-load to
idle, and gives the GC a chance to compress the source and reduce XDR size
(and thus IPC and I/O time).

Attachment #9197817 - Attachment description: Bug 1687338 - Pass the ScriptSource into the XDR lineare method → Bug 1687338 - Pass the ScriptSource into the XDR linearize method

After some experimentation, it seems that source compression still occurs much later. Regardless, I think the patches will simply some code and more work out of page load, so I'll clean them up for review.

Attachment #9197816 - Attachment description: Bug 1687338 - Inline XDRCompilationInput into callers → Bug 1687338 - Inline XDRCompilationInput into callers. r?arai!
Attachment #9197817 - Attachment description: Bug 1687338 - Pass the ScriptSource into the XDR linearize method → Bug 1687338 - Pass the ScriptSource into the XDR linearize method. r?arai!
Attachment #9197784 - Attachment description: Bug 1687338 - StencilXDR encoding should defer encoding source until linearize step → Bug 1687338 - StencilXDR should defer header encoding until linearize step. r?arai!
Attachment #9197818 - Attachment description: Bug 1687338 - Refactor XDR-Stencil header trancoding code → Bug 1687338 - Refactor XDR-Stencil header trancoding code. r?arai!
Pushed by tcampbell@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1e7377b38967 Inline XDRCompilationInput into callers. r=arai https://hg.mozilla.org/integration/autoland/rev/c67b08bb068a Pass the ScriptSource into the XDR linearize method. r=arai https://hg.mozilla.org/integration/autoland/rev/170807435f02 StencilXDR should defer header encoding until linearize step. r=arai https://hg.mozilla.org/integration/autoland/rev/913817e57a91 Refactor XDR-Stencil header trancoding code. r=arai https://hg.mozilla.org/integration/autoland/rev/5f941b574274 Transcode XDR-Stencil header directly to target buffer. r=arai
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: