Bug 1024132 - Add one slot cache for stripping leading and trailing .* from RegExps for test() calls, r=jandem.
This commit is contained in:
@@ -472,6 +472,22 @@ js::AtomizeString(ExclusiveContext *cx, JSString *str,
|
||||
: AtomizeAndCopyChars(cx, linear->twoByteChars(nogc), linear->length(), ib);
|
||||
}
|
||||
|
||||
JSAtom *
|
||||
js::AtomizeSubstring(ExclusiveContext *cx, JSString *str, size_t start, size_t length,
|
||||
InternBehavior ib /* = DoNotInternAtom */)
|
||||
{
|
||||
JS_ASSERT(start + length <= str->length());
|
||||
|
||||
JSLinearString *linear = str->ensureLinear(cx);
|
||||
if (!linear)
|
||||
return nullptr;
|
||||
|
||||
JS::AutoCheckCannotGC nogc;
|
||||
return linear->hasLatin1Chars()
|
||||
? AtomizeAndCopyChars(cx, linear->latin1Chars(nogc) + start, length, ib)
|
||||
: AtomizeAndCopyChars(cx, linear->twoByteChars(nogc) + start, length, ib);
|
||||
}
|
||||
|
||||
JSAtom *
|
||||
js::Atomize(ExclusiveContext *cx, const char *bytes, size_t length, InternBehavior ib)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user