Open Bug 1848580 Opened 1 year ago Updated 9 months ago

Add JSPropertySpec macro variant for value with WellKnownAtomId and replace JS_STRING_PS and JS_STRING_SYM_PS consumers

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

ASSIGNED

People

(Reporter: arai, Assigned: arai)

References

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

Details

(Whiteboard: [sp3])

Attachments

(1 file)

JSPropertySpec with string value holds const char* pointer and converts to JSAtom when defining the property.

https://searchfox.org/mozilla-central/search?q=JS_STRING_PS&path=
https://searchfox.org/mozilla-central/search?q=JS_STRING_SYM_PS&path=&case=false&regexp=false

https://searchfox.org/mozilla-central/rev/4647149548182ba7eb5c447d5a93abfca2f6acd6/js/src/jsapi.cpp#1984,1989-1991

JS_PUBLIC_API bool JSPropertySpec::getValue(JSContext* cx,
...
    case ValueWrapper::Type::String: {
      Rooted<JSAtom*> atom(cx,
                           Atomize(cx, u.value.string, strlen(u.value.string)));

In most case, the property is Symbol.toStringTag and the value is a member of proto key, which exists in well-known atom, and we don't have to perform extra atomization here.

bug 1847677 and related bugs will refactor the JSPropertySpec, in order to introduce well-known atom and embedding extension to the property key (not value),
so this can be done after that.

Whiteboard: [sp3]
See Also: → 1862128
Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED
Flags: needinfo?(macros-templates)
Flags: needinfo?(macros-templates)
a11y-review: requested → ---
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: