Closed Bug 1606113 Opened 3 months ago Closed 3 months ago

Move JSScript/LazyScript finalization/tracing to js::BaseScript

Categories

(Core :: JavaScript Engine, task, P1)

task

Tracking

()

RESOLVED FIXED
mozilla73
Tracking Status
firefox73 --- fixed

People

(Reporter: tcampbell, Assigned: tcampbell)

References

Details

Attachments

(4 files)

The trace/finalize logic should be moved to the BaseScript to prepare for unifying the GC arena.

Care must be taken with side-table data used for JSScripts. We can add a BaseScript::hasBytecode() method that looks for the presence of sharedData_ to determine if side-tables needed to be traced or updated. These side-tables are only used for successfully compiled scripts, so checking for bytecode is a reasonable mechanism.

The script->lazy and lazy->script tracing is not moved to BaseScript because those fields will be removed shortly.

Associated tables like DebuggerScripts still need access to bytecode, so make
sure we finalize the script's actual fields last.

Assignee: nobody → tcampbell
Status: NEW → ASSIGNED

The trace logic is already part of BaseScript so move the finalization logic.
Use a down-cast to JSScript now since only JSScripts have bytecode and
JitScripts. This lets us avoid rewriting a lot of helper methods just yet.

Depends on D58300

Move the code from JSScript to BaseScript and rename freeScriptData to
freeSharedData.

Depends on D58301

A number of side-tables exist that are keyed by JSScript pointers. This patch
moves the tracing and finalization of these from JSScript to BaseScript to
support combining LazyScript/JSScript GC arena. This patch eliminates the
LazyScript and JSScript finalize method specializations.

A BaseScript::hasBytecode() method is added to determine if a BaseScript was
a JSScript that was successfully compiled with bytecode. Only these scripts
may be used as keys in side-tables so we check this in finalize methods. A
down-cast to JSScript is used once again to avoid rewriting all the accessor
methods yet.

Depends on D58303

Priority: -- → P1
Pushed by tcampbell@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7b0110552618
Finalize JSScript fields after associated data. r=jandem
https://hg.mozilla.org/integration/autoland/rev/96d2a50a56a6
Move BaseScript::warmUpData tracing/finalizing to BaseScript. r=jandem
https://hg.mozilla.org/integration/autoland/rev/33ae0330cbe4
Move BaseScript::sharedData tracing/finalizing to BaseScript. r=jandem
https://hg.mozilla.org/integration/autoland/rev/710e512a7352
Trace/finalize script side-tables from BaseScript. r=jandem
You need to log in before you can comment on or make changes to this bug.