Closed Bug 1743519 Opened 2 years ago Closed 2 years ago

Minimize remaining uses XDR outside of StencilXDR code

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED
96 Branch
Tracking Status
firefox96 --- fixed

People

(Reporter: tcampbell, Assigned: tcampbell)

References

(Blocks 1 open bug)

Details

Attachments

(7 files)

Now that legacy-XDR is fully removed, there is more cleanup that can be down to remove uses of Xdr.h in various parts of the engine and better organize the code. We previously introduced the StencilXDR type to act as a namespace for the serialization code and avoid any Stencil types from being directly aware of XDR.

With the removal of BinAST and the addition of Stencil, the ScriptSource no
longer has any GC references in the incremental-encoder. We can now remove the
early cleanup and rely on the normal ScriptSource destructor, even if this
happens off-main-thread.

Use the deserializeStencils API for the ScriptDecodeTask to avoid needing to
used the XDR decoder directly.

Depends on D132424

Remove a few methods that were forgotten when we removed "legacy" XDR in favour
of only StencilXDR. Also use deserializeStencils helper instead of directly
using the XDRStencilDecoder to reduce coupling.

Depends on D132425

Later patches will move the methods from ScriptSource type to the StencilXDR to
reduce coupling with XDR internal functions.

Move the SourceRetrievable definition to a shared location. Also change the
value of No to be falsey to be less surprising even though this is an
enum-class.

Depends on D132426

The StencilXDR class contains the transcoding function for Stencil data types
and so it makes sense for ScriptSource XDR code to move there as well.

Depends on D132427

In order to remove the dependency of JSScript.h on the XDR files, move what was
the XDRIncrementalStencilEncoder to JSScript.h. Since it only contains a single
pointer, remove the UniquePtr<T> around it to avoid a silly indirection.

This also removes a superfluous check for asmjs that is already in the caller.
Also remove the outdated linearize helper.

Depends on D132428

In the future it may make sense to move the rest of Xdr.cpp as well, but for now
we move the most relevant code.

Depends on D132429

Pushed by tcampbell@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f33f012d62e8
Remove ScriptSource::finalizeGCData. r=arai
https://hg.mozilla.org/integration/autoland/rev/15f92ec0c7c9
Avoid using Xdr.h from HelperThreads.cpp r=arai
https://hg.mozilla.org/integration/autoland/rev/1217cb018f18
Remove unused XDR code. r=arai
https://hg.mozilla.org/integration/autoland/rev/c153c537eb05
Move ScriptSource XDR code from JSScript.cpp to StencilXdr.cpp r=arai
https://hg.mozilla.org/integration/autoland/rev/a5a0e0b528a9
Move ScriptSource::XDR methods to the StencilXDR type. r=arai
https://hg.mozilla.org/integration/autoland/rev/64cf7017f49f
Replace XDRIncrementalStencilEncoder. r=arai
https://hg.mozilla.org/integration/autoland/rev/46de2b4b4c8d
Move XDRStencilEncoder/Decoder to StencilXdr.h/cpp. r=arai
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: