Bug 839376 (part 3) - Some low-hanging exact rooting fruit. sfink.

This commit is contained in:
Nicholas Nethercote
2013-02-11 14:04:25 -08:00
parent eec898f8f6
commit 430f3e6106
9 changed files with 17 additions and 19 deletions

View File

@@ -377,7 +377,6 @@ js::Atomize(JSContext *cx, const char *bytes, size_t length, InternBehavior ib)
if (!JSString::validateLength(cx, length))
return NULL;
UnrootedAtom atom;
static const unsigned ATOMIZE_BUF_MAX = 32;
if (length < ATOMIZE_BUF_MAX) {
/*
@@ -390,15 +389,13 @@ js::Atomize(JSContext *cx, const char *bytes, size_t length, InternBehavior ib)
jschar inflated[ATOMIZE_BUF_MAX];
size_t inflatedLength = ATOMIZE_BUF_MAX - 1;
InflateStringToBuffer(cx, bytes, length, inflated, &inflatedLength);
atom = AtomizeAndCopyStableChars<CanGC>(cx, inflated, inflatedLength, ib);
} else {
jschar *tbcharsZ = InflateString(cx, bytes, &length);
if (!tbcharsZ)
return UnrootedAtom();
atom = AtomizeAndTakeOwnership(cx, StableCharPtr(tbcharsZ, length), length, ib);
return AtomizeAndCopyStableChars<CanGC>(cx, inflated, inflatedLength, ib);
}
return atom;
jschar *tbcharsZ = InflateString(cx, bytes, &length);
if (!tbcharsZ)
return UnrootedAtom();
return AtomizeAndTakeOwnership(cx, StableCharPtr(tbcharsZ, length), length, ib);
}
template <AllowGC allowGC>