Closed Bug 1730881 Opened 5 years ago Closed 4 years ago

Make CompilationInput work with Stencils Scope/Script in addition of Scope/BaseScript pointers.

Categories

(Core :: JavaScript Engine, task, P1)

task

Tracking

()

RESOLVED FIXED
96 Branch
Tracking Status
firefox96 --- fixed

People

(Reporter: nbp, Assigned: nbp)

References

Details

Attachments

(13 files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

Bug 1718102 and follow-up made it possible to abstract the nature of the GC object content of CompilationInput, this bug is about abstracting the inner parts to manipulate Scope and Script the same way independently of how they are represented.

To make it possible to create Stencil-based compilation, we should wrap the Scope/BaseScript pointer behind an interface which can also be used to manipulate ScopeStencil and ScriptData content from the Stencil used to provide contextual information.

In order to make CompilationInput accept Stencil instead of GC objects as
inputs, we have to create structure which are able to abstract over the GC Scope
pointer, the BaseScript pointer, and the manipulation of the the scopes.

This patch adds the structures used in all follow-up patches from Bug 1730881
which are implementing all the accessors necessary to make it possible to later
initialize a CompilationInput with a Stencil.

Stencil references are abstracted using a ScopeStencilRef /
ScriptStencilRef, to capture the CompilationStencil input and the index
which is a reference to an element within the CompilationStencil. These
structures are made to avoid accidental missuse of indexes with the wrong
stencil.

InputScope / InputScript are variants over the pointer to the GC object and
the equivalent Stencil reference. They are used to provide a common interface to
interpret GC / Stencil data.

This patchs adds an InputName structure. This structure is used to represent
names held by the GC or another Stencil, and isolate these names such that they
are properly interned before being used in the CompilationState of the existing
compilation.

InputName is a variant over a JSAtom* or a NameStencilRef. The NameStencilRef is
a TaggedParserAtomIndex from a CompilationStencil given as context.

A function is added as part of the ParserAtomsTable, such that
TaggedParserAtomIndex from another compilation can be interned as well. For
encoding where the atom is represented by the tag it-self, this is a no-op,
whereas for larger atoms, these have to be registered in the table. Identically,
another function is added to compare an InputName with an internalized name,
which would be necessary to convert ScopeContext::searchInEnclosingScope.

ParserBindingIter are updated to be initialized with a ScopeStencilRef, in a
similar way as already done with Scope*.

BindingIter and ParserBindingIter creation are wrapped behind the local
InputBindingIter function, used to return one or the other based on the input
type. Identically, InputName can be constructed from a scope and its matching
name type. These would be handy to convert ScopeContext methods to
InputScopeIter, while maintaining a single implementation of the binding
traversal, which would dispatch to one variant or the other based on the type of
the scope.

This change clone some of the functions used to initialize the
CompilationSyntaxParseCache. These are specialized to copy the minimal set of
information needed for skipping inner functions and for iterating over
closed-over-bindings.

Unforutnately, as opposed to what this structure was initialy designed for, we
are not yet able to reuse the Stencils from the InputScript as ParseAtomIndex of
the InputScript are in the context of the InputScript and not of the
CompilationState which wraps the CompilationSyntaxParseCache. Until we are
capable of reusing the same indexes of a previous compilation, we would have to
duplicate the Stencil structures. Thus, copyScriptInfo and
copyClosedOVerBindings are copied from the original functions and adapted to
work with Stencil inputs.

Pushed by npierron@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/0b465bad573c Add InputScope, InputScript and InputScopeIter. r=arai,tcampbell
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 96 Branch
Status: RESOLVED → REOPENED
Keywords: leave-open
Resolution: FIXED → ---

Ok, so this bug has to remain open as Lando UI made me push a single patch and not the full stack of patches.

Pushed by npierron@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/0c9b8c05685d Add InputName to handle JSAtom* and TaggedParserAtomIndex r=arai,tcampbell https://hg.mozilla.org/integration/autoland/rev/0235ef89cab9 Use InputScope in NameIsOnEnvironment. r=arai https://hg.mozilla.org/integration/autoland/rev/161a84941ce1 Use InputScope in ScopeContext::searchInEnclosingScope. r=tcampbell https://hg.mozilla.org/integration/autoland/rev/9d10b14da8b7 Use InputScope in ScopeContext::cacheEnclosingScopeBindingForEval. r=arai https://hg.mozilla.org/integration/autoland/rev/a757662f09f2 Use InputScope in ScopeContext::cachePrivateFieldsForEval. r=tcampbell https://hg.mozilla.org/integration/autoland/rev/ef3bf6168dc8 Use InputScope in ScopeContext::{determineEffectiveScope, computeThisBinding}. r=arai https://hg.mozilla.org/integration/autoland/rev/df21b41504c7 Use InputScope in ScopeContext::computeInScope. r=tcampbell https://hg.mozilla.org/integration/autoland/rev/43f36034758d Use InputScope in ScopeContext::computeThisEnvironment. r=arai https://hg.mozilla.org/integration/autoland/rev/47de8a20be39 Use InputScope in ScopeContext::cacheEnclosingScope. r=tcampbell https://hg.mozilla.org/integration/autoland/rev/479cda0e29bc Use InputScope for CompilationInput::enclosingScope. r=arai https://hg.mozilla.org/integration/autoland/rev/725958cae25f Use InputScript for CompilationInput::lazy_. r=tcampbell https://hg.mozilla.org/integration/autoland/rev/e304b65e2e22 Initialize CompilationSyntaxParseCache from InputScript variants. r=arai
Status: REOPENED → RESOLVED
Closed: 4 years ago → 4 years ago
Keywords: leave-open
Resolution: --- → FIXED
See Also: → 1982263
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: