Closed Bug 1843030 Opened 2 years ago Closed 2 years ago

Provide a public API to allocate the underlying buffer for InstantiationStorage off-main-thread

Categories

(Core :: JavaScript Engine, task)

task

Tracking

()

RESOLVED FIXED
117 Branch
Tracking Status
firefox117 --- fixed

People

(Reporter: arai, Assigned: arai)

Details

Attachments

(4 files)

The current off-thread API allocates vectors in CompilationGCOutput (JS::InstantiationStorage) and passes it to the main-thread via JS::FinishOffThreadStencil out-parameter.

The equivalent needs to be supported for JS::FrontendContext API, but without requiring tracing.
Possible solution would be the following:

  • Add Vector::reserve variant that receives raw buffer and use it if it needs to allocate memory
  • Add a struct that holds the raw buffers
  • Add public API that returns the new struct, reserved for the script data and scope data
  • Add public API that moves the new struct's buffer to JS::InstantiationStorage

actually, we don't need to use Vector.
in all cases, the size of the collection is known at the beginning of the instantiation, and it doesn't change.
we can use raw buffer instead.

Also, JS::InstantiationStorage doesn't have to wrap CompilationGCOutput, but it need to wrap the underlying buffer by the new struct.

Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED
Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/aed4882e9850 Part 1: Cleanup include in HelperThreadState.h. r=nbp https://hg.mozilla.org/integration/autoland/rev/8cece5c78d43 Part 2: Cleanup include in CompilationStencil.h. r=nbp https://hg.mozilla.org/integration/autoland/rev/b836986e6f89 Part 3: Add PreAllocateableGCArray and use it in CompilationGCOutput. r=nbp https://hg.mozilla.org/integration/autoland/rev/65de67ceb4f8 Part 4: Add PreallocatedCompilationGCOutput. r=nbp
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: