Bug 974350 part 3 - Inline getOrCreateMatchResultTemplateObject fast path. r=h4writer

--HG--
extra : rebase_source : f74684759973915c6a955ad8eddc3caee66a3851
This commit is contained in:
Jan de Mooij 2014-02-19 17:37:30 +01:00
parent 96e9365432
commit e39ecaf9e2
2 changed files with 9 additions and 4 deletions

View File

@ -655,10 +655,9 @@ RegExpCompartment::~RegExpCompartment()
}
JSObject *
RegExpCompartment::getOrCreateMatchResultTemplateObject(JSContext *cx)
RegExpCompartment::createMatchResultTemplateObject(JSContext *cx)
{
if (matchResultTemplateObject_)
return matchResultTemplateObject_;
JS_ASSERT(!matchResultTemplateObject_);
/* Create template array object */
RootedObject templateObject(cx, NewDenseUnallocatedArray(cx, 0, nullptr, TenuredObject));

View File

@ -325,6 +325,8 @@ class RegExpCompartment
*/
ReadBarriered<JSObject> matchResultTemplateObject_;
JSObject *createMatchResultTemplateObject(JSContext *cx);
public:
RegExpCompartment(JSRuntime *rt);
~RegExpCompartment();
@ -339,7 +341,11 @@ class RegExpCompartment
bool get(JSContext *cx, HandleAtom source, JSString *maybeOpt, RegExpGuard *g);
/* Get or create template object used to base the result of .exec() on. */
JSObject *getOrCreateMatchResultTemplateObject(JSContext *cx);
JSObject *getOrCreateMatchResultTemplateObject(JSContext *cx) {
if (matchResultTemplateObject_)
return matchResultTemplateObject_;
return createMatchResultTemplateObject(cx);
}
size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf);
};