Remove JSop::Def{Var,Let,Const,Fun} opcodes
Categories
(Core :: JavaScript Engine, task, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox85 | --- | fixed |
People
(Reporter: tcampbell, Assigned: tcampbell)
Details
Attachments
(4 files)
For global/eval scripts, we emit both CheckGlobalOrEvalDecl
and a list of Def{Var,Let,Const}
ops in prologue.
The implementations of these ops the JITs are simply CallVM
and the distinct opcode per-binding does not gain us anything. The list of bindings can also be derived directly from the js::Scope
binding list.
In an example like the large JS bundle on GMail that is compiled from Clojure, there are over 11,000 bindings in the prologue which consumes at least 12% of the top-level script bytecode.
Introducing a GlobalOrEvalDeclInstantiation
operation would reduce the amount of bytecode and simplify code. It also is a bit closer to the spec which performs the redeclaration check and initialization in same internal method.
Assignee | ||
Comment 1•4 years ago
|
||
(This also frees up three opcode IDs)
Assignee | ||
Comment 2•4 years ago
|
||
This replaces CheckGlobalOrEvalDecl with an operation that also performs the
initialization. This let's us remove Def{Var,Let,Const} opcodes from our
prologue which can generate amount of duplicate data on complex sites that
are translated from languages such as Clojure. Subsequent patches will remove
the Def* opcodes altogether.
This change only applies to global/eval scripts and the existing JIT
behaviour (for example with eager flag) used a CallVM for each binding, so
we are no worse off performance-wise.
Assignee | ||
Comment 3•4 years ago
|
||
Depends on D97214
Assignee | ||
Comment 4•4 years ago
|
||
We should also remove DefFun
in a similar way. The top-level function indices are contiguous, so the GlobalOrEvalDeclInstantiation opcode can take a start/end index into the gcthings array.
Updated•4 years ago
|
Assignee | ||
Comment 5•4 years ago
|
||
Subsequent patches will absorb the Def* opcodes into this one to be better
align with the ECMAScript spec. We add a GCThingIndex argument as well that
will later be used to identify top-level function declarations.
Assignee | ||
Comment 6•4 years ago
|
||
This refactors the generation of Def*
opcodes into a single
emitDeclarationInstantiation
method. This will allow the Def* opcodes to be
later be removed entirely.
NOTE: In the sloppy-eval case with lexicals, this change results in the
GlobalOrEvalDeclInstantiation
opcode being emitted after the eval lexical
environment is emitted.
Depends on D97502
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Pushed by tcampbell@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/fd55f1950eb4 Rename JSOp::CheckGlobalOrEvalDecl to GlobalOrEvalDeclInstantiation. r=jandem https://hg.mozilla.org/integration/autoland/rev/a25a8624af26 Add BytecodeEmitter::emitDeclarationInstantiation. r=jandem https://hg.mozilla.org/integration/autoland/rev/443b10f29275 Allow JSOp::GlobalOrEvalDeclInstantiation to initialize bindings. r=jandem https://hg.mozilla.org/integration/autoland/rev/3fc26b5eba84 Remove JSOp::Def{Var,Let,Const,Fun} opcodes. r=jandem
Comment 8•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/fd55f1950eb4
https://hg.mozilla.org/mozilla-central/rev/a25a8624af26
https://hg.mozilla.org/mozilla-central/rev/443b10f29275
https://hg.mozilla.org/mozilla-central/rev/3fc26b5eba84
Description
•