Closed Bug 1760334 Opened 3 years ago Closed 2 years ago

Fix concurrent delazification of `undefined` in a module.

Categories

(Core :: JavaScript Engine, defect, P2)

defect

Tracking

()

RESOLVED FIXED
116 Branch
Tracking Status
firefox116 --- fixed

People

(Reporter: nbp, Assigned: nbp)

References

(Blocks 1 open bug)

Details

(Whiteboard: [sp3])

Attachments

(2 files)

When using concurrent delazification with a module, the delazification crashes as names are not found on the scope chain.

At the moment, concurrent delazification is not enabled, nor is it available for modules.

After many hours of instrumentation and investigation, it happens that module functions depend on the global scope chain, which is not part of the Stencil.

When delazifying inner module functions on-demand, the JSObject global is
defined as the enclosing scope. This scope is set by the
CompilationStencil::instantiateStencilAfterPreparation, as it is shared
between all instantiated modules.

The problem is that the Global scope is not explicit in the Stencil. Thus, when
doing a concurrent delazification from a Stencil, the global scope is not listed
as the enclosing scope of the module.

This patch, hacks the InputScope to work-around the lack of enclosing scope of
Modules, to artificially add a fake-EmptyGlobalScope, which is later used by all
other functions, such as ScopeContext::seachInEnclosingScope used to resolve
named values such as undefined.

Blocks: 1833464
Whiteboard: [sp3]
Attachment #9268492 - Attachment description: Bug 1760334 - Add fake EmptyGlobal scope for parsing inner module functions. → Bug 1760334 - Add FakeStencilGlobalScope for parsing inner module functions.
Pushed by npierron@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/998204890aed JS Shell: Add option argument to offThreadCompileModuleToStencil. r=arai https://hg.mozilla.org/integration/autoland/rev/bbd5d4b8e2eb Add FakeStencilGlobalScope for parsing inner module functions. r=arai https://hg.mozilla.org/integration/autoland/rev/5a4374cfd962 apply code formatting via Lando
Depends on: 1836964
Pushed by npierron@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/acc5a2aef3c1 JS Shell: Add option argument to offThreadCompileModuleToStencil. r=arai https://hg.mozilla.org/integration/autoland/rev/d609354ffacf Add FakeStencilGlobalScope for parsing inner module functions. r=arai https://hg.mozilla.org/integration/autoland/rev/20edf5ff2283 apply code formatting via Lando
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 116 Branch
Flags: needinfo?(nicolas.b.pierron)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: