Bug 661770: Avoid call overhead atomizing from js_AtomizeChars. (r=njn)

--HG--
extra : rebase_source : 0bcacc47c6171886e6d200c1de093df5aa326e8d
This commit is contained in:
Chris Leary 2011-06-03 15:36:07 -07:00
parent db8f0665e7
commit dae433fed7

View File

@ -459,9 +459,10 @@ enum OwnCharsBehavior
* memory can be used as a new JSAtom's buffer without copying. When this flag
* is set, the contract is that callers will free *pchars iff *pchars == NULL.
*/
JS_ALWAYS_INLINE
static JSAtom *
Atomize(JSContext *cx, const jschar **pchars, size_t length,
InternBehavior ib, OwnCharsBehavior ocb = CopyChars)
AtomizeInline(JSContext *cx, const jschar **pchars, size_t length,
InternBehavior ib, OwnCharsBehavior ocb = CopyChars)
{
const jschar *chars = *pchars;
@ -512,6 +513,13 @@ Atomize(JSContext *cx, const jschar **pchars, size_t length,
return key->morphAtomizedStringIntoAtom();
}
static JSAtom *
Atomize(JSContext *cx, const jschar **pchars, size_t length,
InternBehavior ib, OwnCharsBehavior ocb = CopyChars)
{
return AtomizeInline(cx, pchars, length, ib, ocb);
}
JSAtom *
js_AtomizeString(JSContext *cx, JSString *str, InternBehavior ib)
{
@ -595,7 +603,7 @@ js_AtomizeChars(JSContext *cx, const jschar *chars, size_t length, InternBehavio
if (!CheckStringLength(cx, length))
return NULL;
return Atomize(cx, &chars, length, ib);
return AtomizeInline(cx, &chars, length, ib);
}
JSAtom *