Open Bug 1847677 Opened 1 year ago Updated 11 months ago

Add well-known-ids variant to JSPropertySpec

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

ASSIGNED

People

(Reporter: arai, Assigned: arai)

References

(Depends on 1 open bug, Blocks 2 open bugs)

Details

Attachments

(18 files, 5 obsolete files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

If a JSPropertySpec contains a name that's well-known-id, putting WellKnownAtomId into JSPropertySpec allows the atomization be done with GetWellKnownAtom call.

Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED

In order to expose js::WellKnownAtomId as part of JSPropertySpec::Name,
the underlying data source in CommonPropertyNames.h also needs to be exposed.

Depends on D185730

What percentage of JSPropertySpec names that we atomize at runtime can now use the well known atom id?

I'm wondering if this is worth doing with the current set, or if we should think about implementing global static atoms first so we can include ~all names in that?

Flags: needinfo?(arai.unmht)

it's applied to 473 specs which is 34% of SpiderMonkey internal, but only 2% in the entire browser, given most specs are auto-generated and outside of SpiderMonkey.

(In reply to Tooru Fujisawa [:arai] from bug 1847672 comment #10)

there are 3,632 static JSPropertySpec or JSFunctionSpec arrays (206 in SpiderMonkey, and remaining in bindings),
and 20,288 static JSPropertySpec or JSFunctionSpec instances there (1,394 in SpiderMonkey, and remaining in bindings).

so, yeah, having the equivalent of well-known atom outside of SpiderMonkey will make this more effectful.

Flags: needinfo?(arai.unmht)
Depends on: 1848322
Blocks: 1848580

(In reply to Tooru Fujisawa [:arai] from comment #7)

so, yeah, having the equivalent of well-known atom outside of SpiderMonkey will make this more effectful.

Would this help bug 1846110? https://share.firefox.dev/3seR1lp spends a fair amount of time in PropertySpecNameToId.

(In reply to Markus Stange [:mstange] from comment #8)

(In reply to Tooru Fujisawa [:arai] from comment #7)

so, yeah, having the equivalent of well-known atom outside of SpiderMonkey will make this more effectful.

Would this help bug 1846110? https://share.firefox.dev/3seR1lp spends a fair amount of time in PropertySpecNameToId.

Yes, bug 1848278 is going to make the well-known atom extensible, and that will move the atomization from each JS_DefineProperties to initialization step in JS::InitSelfHostedCode, with statically calculating the length and hash.

Attachment #9348034 - Attachment is obsolete: true
Attachment #9348035 - Attachment is obsolete: true
Attachment #9348036 - Attachment is obsolete: true
Attachment #9348037 - Attachment is obsolete: true
Attachment #9348038 - Attachment is obsolete: true

Alphabetical order, ignore case, with an exception for *8, *16 *32 suffixes

Depends on D186307

self-hosting intrinsics needs some more work to use the JS::WellKnownAtomId, because it currently uses the string content for search.

https://searchfox.org/mozilla-central/rev/f1f50693655c093d974f026bd37860d939cd5529/js/src/vm/SelfHosting.cpp#1893

static const JSFunctionSpec intrinsic_functions[] = {

https://searchfox.org/mozilla-central/rev/f1f50693655c093d974f026bd37860d939cd5529/js/src/vm/SelfHosting.cpp#2297-2299

static void CheckSelfHostedIntrinsics() {
  // The `intrinsic_functions` list must be sorted so that we can use
  // mozilla::BinarySearch to do lookups on demand.

https://searchfox.org/mozilla-central/rev/f1f50693655c093d974f026bd37860d939cd5529/js/src/vm/SelfHosting.cpp#2343

const JSFunctionSpec* js::FindIntrinsicSpec(js::PropertyName* name) {

Also add JSOp::GetIntrinsicFunc to use the index into intrinsic_functions:

  • JSOp::GetIntrinsicFunc is 2 bytes shorter than JSOp::GetIntrinsic
  • JSOp::GetIntrinsicFunc doesn't perform binary search during runtime
Blocks: 1850197
Attachment #9349136 - Attachment description: WIP: Bug 1847677 - Part 0: Simplify JSFunctionSpec macro. r?jandem! → Bug 1847677 - Part 0: Simplify JSFunctionSpec macro. r?jandem!
Attachment #9349137 - Attachment description: WIP: Bug 1847677 - Part 1: Add JS::GetWellKnownAtom and JS::GetWellKnownAtomKey. r?jandem! → Bug 1847677 - Part 1: Add JS::GetWellKnownAtom and JS::GetWellKnownAtomKey. r?jandem!
Attachment #9349138 - Attachment description: WIP: Bug 1847677 - Part 2: Add JS::WellKnownAtomId variant to JSPropertySpec::Name. r?jandem! → Bug 1847677 - Part 2: Add JS::WellKnownAtomId variant to JSPropertySpec::Name. r?jandem!
Attachment #9349139 - Attachment description: WIP: Bug 1847677 - Part 3: Sort CommonPropertyNames. r?jandem! → Bug 1847677 - Part 3: Sort CommonPropertyNames. r?jandem!
Attachment #9349140 - Attachment description: WIP: Bug 1847677 - Part 4: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in Array, BigInt, Boolean, Number, Object, RegExp, String, and Symbol. r?jandem! → Bug 1847677 - Part 4: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in Array, BigInt, Boolean, Number, Object, RegExp, String, and Symbol. r?jandem!
Attachment #9349141 - Attachment description: WIP: Bug 1847677 - Part 5: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in Map, Set, WeakMap, WeakSet. r?jandem! → Bug 1847677 - Part 5: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in Map, Set, WeakMap, WeakSet. r?jandem!
Attachment #9349142 - Attachment description: WIP: Bug 1847677 - Part 6: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in Date, Math, JSON, and Errors. r?jandem! → Bug 1847677 - Part 6: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in Date, Math, JSON, and Errors. r?jandem!
Attachment #9349143 - Attachment description: WIP: Bug 1847677 - Part 7: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in functions and Promise. r?jandem! → Bug 1847677 - Part 7: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in functions and Promise. r?jandem!
Attachment #9349144 - Attachment description: WIP: Bug 1847677 - Part 8: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in TypedArrays. r?jandem! → Bug 1847677 - Part 8: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in TypedArrays. r?jandem!
Attachment #9349145 - Attachment description: WIP: Bug 1847677 - Part 9: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in Reflect, Proxy, and ShadowRealm. r?jandem! → Bug 1847677 - Part 9: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in Reflect, Proxy, and ShadowRealm. r?jandem!
Attachment #9349146 - Attachment description: WIP: Bug 1847677 - Part 10: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in WeakRef. r?jandem! → Bug 1847677 - Part 10: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in WeakRef. r?jandem!
Attachment #9349147 - Attachment description: WIP: Bug 1847677 - Part 11: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in Intl. r?jandem! → Bug 1847677 - Part 11: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in Intl. r?jandem!
Attachment #9349148 - Attachment description: WIP: Bug 1847677 - Part 12: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in WebAssembly. r?jandem! → Bug 1847677 - Part 12: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in WebAssembly. r?jandem!
Attachment #9349149 - Attachment description: WIP: Bug 1847677 - Part 13: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in Temporal. r?jandem! → Bug 1847677 - Part 13: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in Temporal. r?jandem!
Attachment #9349150 - Attachment description: WIP: Bug 1847677 - Part 14: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in Tuple. r?jandem! → Bug 1847677 - Part 14: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in Tuple. r?jandem!
Attachment #9349151 - Attachment description: WIP: Bug 1847677 - Part 15: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in Debugger where possible. r?jandem! → Bug 1847677 - Part 15: Use JS::WellKnownAtomId variant of JSPropertySpec/JSFunctionSpec in Debugger where possible. r?jandem!
See Also: → 1863467
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: