Closed Bug 1614041 Opened 8 months ago Closed 2 months ago

Allow parsing modules using stencils rather than GC objects.

Categories

(Core :: JavaScript Engine, task, P2)

task

Tracking

()

RESOLVED FIXED
mozilla80
Tracking Status
firefox80 --- fixed

People

(Reporter: mgaudet, Assigned: tcampbell)

References

Details

Attachments

(5 files, 1 obsolete file)

We need to be able to parse modules without requiring the allocation of GC'd objects.

Depends on: 1614061
Depends on: 1592105

The ModuleObject allocation needs to be handled, but this is similar to the standalone JSFunction case and should be straightforward.

The import/export map is currently built of JSObjects that are allocated in the middle of parsing. We need a stencil abstraction for the following types:

  • RequestedModuleObject
  • ImportEntryObject
  • ExportEntryObject
    These are currently aggregated into ArrayObjects that are attached to the ModuleObject.

Some sort of Import/ExportMap Stencil data structure probably needs to be defined.

Assignee: nobody → tcampbell

Introduce StencilModuleEntry type to replace {Import,Export}EntryObject
during parsing. Avoid allocating those GC objects until the initModule call.

Defer the ModuleObject::functionDeclarations list initiailization until after
parsing.

Depends on D83206

Attachment #9162956 - Attachment description: Bug 1614041 - Defer module function declaration list → Bug 1614041 - Do not allocate ModuleObject until after parsing
Attachment #9162956 - Attachment is obsolete: true
Attachment #9162955 - Attachment description: Bug 1614041 - Defer ModuleBuilder object allocations → Bug 1614041 - Defer ModuleBuilder GC allocations

Similar to what is done for FunctionScope, defer the initialization of
ModuleScope::Data::module field until creating concrete scope.

Depends on D83206

Use StencilModuleMetadata to hold module function-declarations list so that a
ModuleObject is no longer needed to perform parsing.

Depends on D83269

The binding name is by definition the explicitName of the JSFunction so do
not store a copy of it. This avoids needing to trace that anymore.

Depends on D83269

Pushed by tcampbell@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5db78863ff43
Defer ModuleBuilder GC allocations r=arai
https://hg.mozilla.org/integration/autoland/rev/73a1977876d1
Stop using ModuleObject* in ScopeCreationData r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/c66757095dd4
Stop storing binding name in module function-decl list r=arai
https://hg.mozilla.org/integration/autoland/rev/24520be1a1ce
Store FunctionDeclarations in StencilModuleMetadata r=arai
https://hg.mozilla.org/integration/autoland/rev/32d800de8502
Move ModuleObject allocation into Stencil instantiation r=arai

JS_SetElement cannot be used on helper-threads, so I have restored the behaviour to use NativeObject::initDenseElement. I also modified the AssertHeapIsIdle check to disallow helper threads and verify no further issues. I will open a bug to permanently land these checks since they would have caught the problem sooner.

Flags: needinfo?(tcampbell)
Pushed by tcampbell@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/deb22e4b7e1e
Defer ModuleBuilder GC allocations r=arai
https://hg.mozilla.org/integration/autoland/rev/7d5c34919a24
Stop using ModuleObject* in ScopeCreationData r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/ec3d556893bc
Stop storing binding name in module function-decl list r=arai
https://hg.mozilla.org/integration/autoland/rev/0776aaa8e255
Store FunctionDeclarations in StencilModuleMetadata r=arai
https://hg.mozilla.org/integration/autoland/rev/7eaf75ab590a
Move ModuleObject allocation into Stencil instantiation r=arai

(In reply to Ted Campbell [:tcampbell] from comment #10)

I also modified the AssertHeapIsIdle check to disallow helper threads and verify no further issues.

See also the CHECK_THREAD macro where we explicitly allow helper thread contexts... Maybe it's time to change that. But all this is why I'm pushing for removing helper thread JSContexts completely in the future.

Pushed by tcampbell@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a9af5a14e497
Defer ModuleBuilder GC allocations r=arai
https://hg.mozilla.org/integration/autoland/rev/8823ae6243b7
Stop using ModuleObject* in ScopeCreationData r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/e08aadd71f4d
Stop storing binding name in module function-decl list r=arai
https://hg.mozilla.org/integration/autoland/rev/5927f5feaebf
Store FunctionDeclarations in StencilModuleMetadata r=arai
https://hg.mozilla.org/integration/autoland/rev/29ff06b4a609
Move ModuleObject allocation into Stencil instantiation r=arai
Flags: needinfo?(tcampbell)
You need to log in before you can comment on or make changes to this bug.