Closed Bug 1566803 Opened 6 months ago Closed 6 months ago

Use a common base class for JSScript / LazyScript


(Core :: JavaScript Engine, task, P2)




Tracking Status
firefox70 --- fixed


(Reporter: tcampbell, Assigned: tcampbell)


(Blocks 1 open bug)



(4 files)

If Bug 1566607 lands, then both LazyScript and JSScript start with jitCodeRaw_ and have about 10 common fields. We should use a common base class and try to standardize accessors, particularly for immutable/mutable flags.

This is the common base class of JSScript and LazyScript. This begins
with the common jitCodeRaw_ field which both types require to have as
first memory word of structure. Follow-up patches will move more fields
and accessors that are common to the two classes.

This is defined in gc/Marking.cpp since the eager LazyScript marking
code must match the definition.

Depends on D38503

Move various fields for source positions to BaseScript. The
lineno/column have minimal treatment because it is a larger project to
make the two more uniformly set in the frontend.

In the debugger, there is still clumsy code to access both lazy and
non-lazy scripts, but this will become simplified when the two types
fully merge.

Depends on D38505

These patches introduce the new base class and move the first 8 fields. Another patch will be needed to move the flags and their accessors but that patch bit rots quickly (largely my fault) so I want to get feedback and land the basics first.

Pushed by
Add a js::BaseScript type. r=jandem
Add js::BaseScript::traceChildren. r=sfink
Move scriptSource_ to js::BaseScript. r=jandem
Move sourceStart, etc to js::BaseScript. r=jandem,jimb
You need to log in before you can comment on or make changes to this bug.