Closed Bug 1633425 Opened 9 months ago Closed 9 months ago

Cleanup the IonScript data structure


(Core :: JavaScript Engine: JIT, task, P3)




Tracking Status
firefox77 --- fixed


(Reporter: tcampbell, Assigned: tcampbell)




(6 files)

This is a complex data structure with ten different trailing arrays. We can clean it up similar to what we did for ImmutableScriptData.

  • Introduce a js::TrailingArray mixin class to share the offsetToPointer related helpers.
  • Cleanup IonScript using this.
  • Add CodegenSafepointIndex to avoid wasted space in SafepointIndex that is stored in the IonScript. This also simplifies the code.

This saves 8-bytes per SafepointIndex and 32-bytes per IonScript.

This is used during codegen only so we can simplify the SafepointIndex that
is stored in the IonScript. The resolve method is replaced by a constructor
from CodegenSafepointIndex to SafepointIndex.

This type is a mixin with helper methods for casting and initializing arrays
that follow a struct in the same allocation. Use this for existing JitScript,
PrivateScriptData, RuntimeScriptData, ImmutableScriptData types.

Depends on D72671

Also initialize more of the required fields in the constructor directly
instead of the New method.

Depends on D72672

Order the trailing arrays by descending alignment requirements and use a
similar approach to JitScript for computing sizes and initializing.

Depends on D72673

Use helper methods to access the size and length of each trailing array.
We shave 40 bytes off each IonScript by using the difference between two
arrays to compute size rather than storing a dedicated size field.

Depends on D72674

Pushed by
Add js::jit::CodegenSafepointIndex type. r=jandem
Add js::TrailingArray type for script data structures. r=jandem
Use field initializers for js::jit::IonScript. r=jandem
Reorder IonScript arrays to avoid padding. r=jandem
Use offsets to delimit arrays in IonScript. r=jandem
Cleanup IonScript parameter name mismatches. r=jandem
Blocks: 1633741
You need to log in before you can comment on or make changes to this bug.