Closed
Bug 1500927
Opened 2 years ago
Closed 2 years ago
Add copy-free jsstring support to perfecthash.py
Categories
(Core :: XPCOM, enhancement)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla65
Tracking | Status | |
---|---|---|
firefox65 | --- | fixed |
People
(Reporter: nika, Assigned: nika)
References
Details
Attachments
(2 files)
This is needed for bug 1500926, and could generally be advantageous for XPIDL as well, to avoid copies when looking up xpcom interfaces by name. The approach I took was to split the codegen logic out into a helper object. This object has separate methods for generating each piece, and has separate methods for generating a WebIDL lookup method and a bytes lookup method. If a component needs both the native string and JSString lookup methods, it will have 2 copies of the bases table. Fortunately these tables are usually fairly small for our code at the moment. If it proves to be an issue, we can perform a refactoring to avoid this restriction.
Assignee | ||
Comment 1•2 years ago
|
||
This is needed for bug 1500926. It takes the approach of taking a JSFlatString and using AutoAssertCannotGC to read the memory directly from the JS heap. This lets us avoid re-encoding strings when performing lookups, which can be advantageous. Only ASCII strings are supported by this handler, and wide strings are hashed as though they contain only values under 0x7f. This is OK as invalid keys to perfecthash may return any hashtable entry.
Assignee | ||
Comment 2•2 years ago
|
||
This is an example generated file from bug 1500926
Pushed by nika@thelayzells.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/fbb568aa121e Add copy-free jsstring support to perfecthash.py, r=bzbarsky
Comment 4•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/fbb568aa121e
Status: NEW → RESOLVED
Closed: 2 years ago
status-firefox65:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
You need to log in
before you can comment on or make changes to this bug.
Description
•