Closed Bug 1847862 Opened 1 year ago Closed 9 months ago

pre-calculate hash for WebIDLNameTableEntry

Categories

(Core :: DOM: Bindings (WebIDL), task, P3)

task

Tracking

()

RESOLVED DUPLICATE of bug 1850344

People

(Reporter: arai, Assigned: arai)

References

(Blocks 1 open bug)

Details

WebIDLNameTableEntry entry is used for creating atoms.
the string hash is calculated inside the API, but the hash is known at compile time and bindgen can generate mozilla::HashStringKnownLength call for it.

https://searchfox.org/mozilla-central/rev/0058dbdd1c2eb9164e195082d18f3a657f291824/dom/bindings/WebIDLGlobalNameHash.cpp#181-183,193-194

bool WebIDLGlobalNameHash::GetNames(JSContext* aCx, JS::Handle<JSObject*> aObj,
                                    NameType aNameType,
                                    JS::MutableHandleVector<jsid> aNames) {
...
      JSString* str = JS_AtomizeStringN(aCx, BindingName(entry.mNameOffset),
                                        entry.mNameLength);

https://searchfox.org/mozilla-central/rev/0058dbdd1c2eb9164e195082d18f3a657f291824/dom/bindings/WebIDLGlobalNameHash.h#24,30-31

struct WebIDLNameTableEntry {
...
  BindingNamesOffset mNameOffset;
  uint16_t mNameLength;

https://searchfox.org/mozilla-central/source/__GENERATED__/__linux64__/dom/bindings/RegisterBindings.cpp#699-702

const WebIDLNameTableEntry WebIDLGlobalNameHash::sEntries[] = {
  {
    /* mNameOffset */ BindingNamesOffset::Plugin,
    /* mNameLength */ 6,
Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED

this might become unnecessary if we can extend the well-known atoms with gecko atoms in bug 1848278.

See Also: → 1848278

This will be handled as a part of bug 1850344, by replacing the atomization code with extended-known atom.

Status: ASSIGNED → RESOLVED
Closed: 9 months ago
Duplicate of bug: 1850344
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.