mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 14:45:29 +00:00
Bug 974350 part 3 - Inline getOrCreateMatchResultTemplateObject fast path. r=h4writer
--HG-- extra : rebase_source : f74684759973915c6a955ad8eddc3caee66a3851
This commit is contained in:
parent
96e9365432
commit
e39ecaf9e2
@ -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));
|
||||
|
@ -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);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user