Closed Bug 1774454 Opened 2 years ago Closed 2 years ago

Replace self-hosted module implementation with C++

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED
104 Branch
Tracking Status
firefox104 --- fixed

People

(Reporter: jonco, Assigned: jonco)

References

(Blocks 2 open bugs)

Details

Attachments

(7 files)

A large portion of the modules implementation in SpiderMonkey is written in self-hosted JS (js/src/builtin/Module.js). There were good reasons to do this at the time, but this hasn't really been a win overall.

Moving this code to C++ would improve:

  • security: prototype pollution attacks would not be possible
  • efficiency: currently execution bounces repeatedly between JS and native code which is not optimal, and all data must uses JS types even when native types would be preferable=
  • debugging: currently there's no debugger support for backtraces through JS stack frames making it harder to investigate issues in the module implementation

Reimplement ModuleGetExportedNames in C++ and remove from self-hosted code.
This adds an intrinsic for it so that the remaining self-hosted code can call
it. This will be removed eventually.

This also renames it GatherAvailableModuleAncestors which is what it's called
in the spec now.

Depends on D149885

Blocks: 1786204
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: