Bug 1028866 part 5 - Make NewString deflate to Latin1 if Latin1 strings are enabled and add NewStringDontDeflate. r=luke

This commit is contained in:
Jan de Mooij
2014-06-25 10:12:17 +02:00
parent 90c4f4aa96
commit bbca5e04f9
5 changed files with 85 additions and 44 deletions

View File

@@ -480,6 +480,11 @@ js::Atomize(ExclusiveContext *cx, const char *bytes, size_t length, InternBehavi
if (!JSString::validateLength(cx, length))
return nullptr;
if (EnableLatin1Strings) {
const Latin1Char *chars = reinterpret_cast<const Latin1Char*>(bytes);
return AtomizeAndCopyChars(cx, chars, length, ib);
}
static const unsigned ATOMIZE_BUF_MAX = 32;
if (length < ATOMIZE_BUF_MAX) {
/*