Open
Bug 1151573
Opened 10 years ago
Updated 2 years ago
Remove string interning from JSAPI
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
NEW
People
(Reporter: sfink, Unassigned)
References
(Blocks 1 open bug)
Details
jsids may be created from interned strings via INTERNED_STRING_TO_JSID, where
"interned" here means the JSAPI notion, which I believe is what would
ordinarily be called "pinned": they cannot be moved in memory or collected
until unpinned.
The JSAPI exposes
JS_StringHasBeenInterned
JS_Intern*String*
JS_GetLatin1InternedStringChars
JS_GetTwoByteInternedStringChars
The notion of "interning" (pinning) is dangerous to expose. It makes it easy to create uncollectable garbage. It's even somewhat dangerous, given that we have a notion of unpinning these strings (pinning is not permanent). Unpinning could cause them to be collected unexpectedly or orphaned, if we implement moving GC for strings.
![]() |
||
Comment 1•10 years ago
|
||
The places where we use this right now in DOM/xpconnect code are:
1) We preemptively intern a string being used as the value of a property, because shortly after that we use that same string as a property name (which atomizes anyway); this way we don't end up with two copies of the string around.
2) We intern some strings that we then INTERNED_STRING_TO_JSID and store the jsid for later use.
We don't ever need the chars-getting APIs or JS_StringHasBeenInterned in DOM code. But we do need a way to produce jsids that we can then have hanging around for later, as things stand: just using strings all the time is too slow because it has to reatomize over and over.
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•