Closed Bug 1741404 Opened 2 years ago Closed 2 years ago

Clone ExtensibleCompilationStencil

Categories

(Core :: JavaScript Engine, task, P2)

task

Tracking

()

RESOLVED FIXED
98 Branch
Tracking Status
firefox98 --- fixed

People

(Reporter: nbp, Assigned: nbp)

References

Details

Attachments

(3 files)

After parsing off-thread, we want to delazify off-thread. To do so we have to duplicate the ExtensibleCompilationStencil, such that the main-thread can use a pristine stencil for instantiation and encoding of used stencils, while the helper thread can mutate its own extensible stencil with eagerly delazified functions.

Without a cloned stencil, we risk:

  • Adding unused functions to the bytecode cache, increasing disk space.
  • Only delazify before the execution, thus no opportunity to delazify the functions of the last script ahead of its execution.

As of today, converting a CompilationStencil to an ExtensibleCompilationStencil
is only done with UniquePtr<..>, which is fine. However, as we are attempting to
cache RefPtr<CompilationStencil>, we should be careful when cloning that we are
not stealing data which might still be referenced from else-where.

This patch add the CompilationStencil::isShared function which checks whether
the data referenced is borrowed, or if it is referenced multiple times. If so,
we default to cloning the CompilationStencil instead of stealing its' LifoAlloc.

Assignee: nobody → nicolas.b.pierron
Status: NEW → ASSIGNED

As we want to delazify functions, in addition of being able to instantiate the
top-level parsed content. We need an ExtensibleCompilationStencil for the
CompilationStencilMerger.

This patch adds clone functions to ExtensibleCompilationStencil, to clone from
either a CompilationStencil or from an ExtensibleCompilationStencil.

With off-thread delazification, the parser created and destroyed its
CompilationInput. Thus we have to carry the compilation information to the
cloned ExtensibleCompilationStencil.

This patch adds a new constructor to ExtensibleCompilationStencil which can be
constructed with CompileOptions and a ScriptSource pointer.

Attachment #9259676 - Attachment description: Bug 1741404 - Consider RefCount when stealing CompilationStencil. → Bug 1741404 - Clone SharedDataContainer when needed.
Attachment #9259677 - Attachment description: Bug 1741404 - Add ExtensibleCompilationStencil::clone functions. → Bug 1741404 - Add ExtensibleCompilationStencil::cloneFrom functions.
Pushed by npierron@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5d2c54085c67
Clone SharedDataContainer when needed. r=arai
https://hg.mozilla.org/integration/autoland/rev/be5163574112
Add ExtensibleCompilationStencil::cloneFrom functions. r=arai
https://hg.mozilla.org/integration/autoland/rev/9e69cc757fc4
Make ExtensibleCompilationStencil constructible without CompilationInput. r=arai
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 98 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: