Closed
Bug 1436065
Opened 7 years ago
Closed 7 years ago
Introduce JS_NewLatin1String
Categories
(Core :: JavaScript Engine, enhancement, P3)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla60
Tracking | Status | |
---|---|---|
firefox60 | --- | fixed |
People
(Reporter: hsivonen, Assigned: jandem)
Details
Attachments
(1 file)
(deleted),
patch
|
luke
:
review+
|
Details | Diff | Splinter Review |
Please introduce a Latin1 analog of JS_NewUCString(). Our XPConnect usage of AUTF8String is mostly ASCII, so it's a shame to inflate it to UTF-16 when returning strings to the JS engine.
encoding_rs::mem has code for checking if a UTF-8 string has code points only in the Latin1 range and code for converting UTF-8 directly to Latin1. The bug to expose these to C++ is likely going to be bug 1402247.
Assignee | ||
Comment 1•7 years ago
|
||
Just to be clear, you want the no-copy behavior right? (Although JS_NewUCString does copy when it deflates to Latin1).
If copying is okay, you could call JS_NewStringCopyN - it has a char* argument that we cast to Latin1Char* internally.
Reporter | ||
Comment 2•7 years ago
|
||
(In reply to Jan de Mooij [:jandem] from comment #1)
> Just to be clear, you want the no-copy behavior right? (Although
> JS_NewUCString does copy when it deflates to Latin1).
I was thinking of no-copy, yes.
> If copying is okay, you could call JS_NewStringCopyN - it has a char*
> argument that we cast to Latin1Char* internally.
I don't really know how performance-sensitive this stuff is. Maybe copying is good enough.
Updated•7 years ago
|
Priority: -- → P3
Assignee | ||
Comment 3•7 years ago
|
||
Updated•7 years ago
|
Attachment #8948754 -
Flags: review?(luke) → review+
Pushed by jandemooij@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/17704f81efef
Add JS_NewLatin1String API to create Latin1 strings without copying. r=luke
Comment 5•7 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox60:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
You need to log in
before you can comment on or make changes to this bug.
Description
•