gecko-dev/xpcom
Henri Sivonen 3edc601325 Bug 1402247 - Use encoding_rs for XPCOM string encoding conversions. r=Nika,erahm,froydnj.
Correctness improvements:

 * UTF errors are handled safely per spec instead of dangerously truncating
   strings.

 * There are fewer converter implementations.

Performance improvements:

 * The old code did exact buffer length math, which meant doing UTF math twice
   on each input string (once for length calculation and another time for
   conversion). Exact length math is more complicated when handling errors
   properly, which the old code didn't do. The new code does UTF math on the
   string content only once (when converting) but risks allocating more than
   once. There are heuristics in place to lower the probability of
   reallocation in cases where the double math avoidance isn't enough of a
   saving to absorb an allocation and memcpy.

 * Previously, in UTF-16 <-> UTF-8 conversions, an ASCII prefix was optimized
   but a single non-ASCII code point pessimized the rest of the string. The
   new code tries to get back on the fast ASCII path.

 * UTF-16 to Latin1 conversion guarantees less about handling of out-of-range
   input to eliminate an operation from the inner loop on x86/x86_64.

 * When assigning to a pre-existing string, the new code tries to reuse the
   old buffer instead of first releasing the old buffer and then allocating a
   new one.

 * When reallocating from the new code, the memcpy covers only the data that
   is part of the logical length of the old string instead of memcpying the
   whole capacity. (For old callers old excess memcpy behavior is preserved
   due to bogus callers. See bug 1472113.)

 * UTF-8 strings in XPConnect that are in the Latin1 range are passed to
   SpiderMonkey as Latin1.

New features:

 * Conversion between UTF-8 and Latin1 is added in order to enable faster
   future interop between Rust code (or otherwise UTF-8-using code) and text
   node and SpiderMonkey code that uses Latin1.

MozReview-Commit-ID: JaJuExfILM9
2018-08-14 14:43:42 +03:00
..
base Bug 1402247 - Use encoding_rs for XPCOM string encoding conversions. r=Nika,erahm,froydnj. 2018-08-14 14:43:42 +03:00
build Bug 1479641 - Don't record counting allocator amount, r=froydnj. 2018-07-31 19:22:54 +00:00
components Bug 1479945: Part 5 - Remove the 'allowbootstrap' directive flag. r=froydnj 2018-07-31 16:44:52 -07:00
doc
ds Bug 1402247 - Use encoding_rs for XPCOM string encoding conversions. r=Nika,erahm,froydnj. 2018-08-14 14:43:42 +03:00
glue Bug 1402247 - Use encoding_rs for XPCOM string encoding conversions. r=Nika,erahm,froydnj. 2018-08-14 14:43:42 +03:00
idl-parser Bug 1474739 - Part 3: Linting fixes on a CLOSED TREE, a=bustage 2018-08-01 18:23:21 -04:00
io Bug 1090497 - Re-enable warnings as errors on clang-cl. r=froydnj 2018-07-31 22:10:07 +09:00
libxpt/xptcall Bug 1403959, part 2 - Automatically generated eslint fixes. r=froydnj 2017-09-28 15:49:04 -07:00
reflect Bug 1480624 - Part 1: Add XPT_FOR_EACH_*_TYPE macros to xptinfo.h, r=mccr8 2018-08-03 15:55:13 -04:00
rust Bug 1482011 - Make Bench_Cpp_MozHashSet more idiomatic. r=froydnj 2018-08-14 08:52:38 +10:00
string Bug 1402247 - Use encoding_rs for XPCOM string encoding conversions. r=Nika,erahm,froydnj. 2018-08-14 14:43:42 +03:00
system Bug 1348273 - Convert crash annotations into a machine-readable list of constants; r=ted.mielczarek,njn,dholbert,mak,cpearce,mcmanus,froydnj,Dexter,jrmuizel,jchen,jimm,bz,surkov 2018-07-05 15:42:11 +02:00
tests Bug 1402247 - Use encoding_rs for XPCOM string encoding conversions. r=Nika,erahm,froydnj. 2018-08-14 14:43:42 +03:00
threads Bug 1090497 - Re-enable warnings as errors on clang-cl. r=froydnj 2018-07-31 22:10:07 +09:00
typelib Bug 1471620 - Skip python-tests locally that don't run with python 3 in CI r=davehunt 2018-06-27 11:10:02 -04:00
windbgdlg Bug 1090497 - Re-enable warnings as errors on clang-cl. r=froydnj 2018-07-31 22:10:07 +09:00
xpidl Bug 1459721 - part 7 - remove dist_idl install manifest; r=chmanchester 2018-05-15 10:05:23 -04:00
moz.build Bug 1444745 - Part 1: Clear out xptinfo and typelib to make way for the this patch, r=mccr8 2018-04-17 19:20:50 -04:00
xpcom-config.h.in
xpcom-private.h.in Bug 1423846 - Remove configure script checks for iconv and mbrtowc/tcrtomb. r=glandium 2017-12-07 14:06:53 +02:00