зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1351357 - Use the ReadOnlyCompileOptions from the HelperThread while decoding RegExp. r=bhackett
This commit is contained in:
Родитель
f00e2cd24e
Коммит
d676a8001e
|
@ -9387,7 +9387,7 @@ Parser<ParseHandler, CharT>::newRegExp()
|
|||
RegExpFlag flags = tokenStream.currentToken().regExpFlags();
|
||||
|
||||
Rooted<RegExpObject*> reobj(context);
|
||||
reobj = RegExpObject::create(context, chars, length, flags, &tokenStream, alloc);
|
||||
reobj = RegExpObject::create(context, chars, length, flags, nullptr, &tokenStream, alloc);
|
||||
if (!reobj)
|
||||
return null();
|
||||
|
||||
|
|
|
@ -6095,8 +6095,8 @@ JS_NewRegExpObject(JSContext* cx, const char* bytes, size_t length, unsigned fla
|
|||
if (!chars)
|
||||
return nullptr;
|
||||
|
||||
RegExpObject* reobj = RegExpObject::create(cx, chars, length,
|
||||
RegExpFlag(flags), nullptr, cx->tempLifoAlloc());
|
||||
RegExpObject* reobj = RegExpObject::create(cx, chars, length, RegExpFlag(flags),
|
||||
nullptr, nullptr, cx->tempLifoAlloc());
|
||||
return reobj;
|
||||
}
|
||||
|
||||
|
@ -6105,8 +6105,8 @@ JS_NewUCRegExpObject(JSContext* cx, const char16_t* chars, size_t length, unsign
|
|||
{
|
||||
AssertHeapIsIdle();
|
||||
CHECK_REQUEST(cx);
|
||||
return RegExpObject::create(cx, chars, length,
|
||||
RegExpFlag(flags), nullptr, cx->tempLifoAlloc());
|
||||
return RegExpObject::create(cx, chars, length, RegExpFlag(flags),
|
||||
nullptr, nullptr, cx->tempLifoAlloc());
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
|
|
|
@ -238,24 +238,29 @@ const Class RegExpObject::protoClass_ = {
|
|||
|
||||
RegExpObject*
|
||||
RegExpObject::create(JSContext* cx, const char16_t* chars, size_t length, RegExpFlag flags,
|
||||
TokenStream* tokenStream, LifoAlloc& alloc)
|
||||
const ReadOnlyCompileOptions* options, TokenStream* tokenStream,
|
||||
LifoAlloc& alloc)
|
||||
{
|
||||
RootedAtom source(cx, AtomizeChars(cx, chars, length));
|
||||
if (!source)
|
||||
return nullptr;
|
||||
|
||||
return create(cx, source, flags, tokenStream, alloc);
|
||||
return create(cx, source, flags, options, tokenStream, alloc);
|
||||
}
|
||||
|
||||
RegExpObject*
|
||||
RegExpObject::create(JSContext* cx, HandleAtom source, RegExpFlag flags,
|
||||
TokenStream* tokenStream, LifoAlloc& alloc)
|
||||
const ReadOnlyCompileOptions* options, TokenStream* tokenStream,
|
||||
LifoAlloc& alloc)
|
||||
{
|
||||
Maybe<CompileOptions> dummyOptions;
|
||||
if (!tokenStream && !options) {
|
||||
dummyOptions.emplace(cx);
|
||||
options = dummyOptions.ptr();
|
||||
}
|
||||
Maybe<TokenStream> dummyTokenStream;
|
||||
if (!tokenStream) {
|
||||
dummyOptions.emplace(cx);
|
||||
dummyTokenStream.emplace(cx, *dummyOptions,
|
||||
dummyTokenStream.emplace(cx, *options,
|
||||
(const char16_t*) nullptr, 0,
|
||||
(frontend::StrictModeGetter*) nullptr);
|
||||
tokenStream = dummyTokenStream.ptr();
|
||||
|
@ -1457,8 +1462,11 @@ js::XDRScriptRegExpObject(XDRState<mode>* xdr, MutableHandle<RegExpObject*> objp
|
|||
return false;
|
||||
if (mode == XDR_DECODE) {
|
||||
RegExpFlag flags = RegExpFlag(flagsword);
|
||||
RegExpObject* reobj = RegExpObject::create(xdr->cx(), source, flags, nullptr,
|
||||
xdr->lifoAlloc());
|
||||
const ReadOnlyCompileOptions* options = nullptr;
|
||||
if (xdr->hasOptions())
|
||||
options = &xdr->options();
|
||||
RegExpObject* reobj = RegExpObject::create(xdr->cx(), source, flags,
|
||||
options, nullptr, xdr->lifoAlloc());
|
||||
if (!reobj)
|
||||
return false;
|
||||
|
||||
|
@ -1481,7 +1489,8 @@ js::CloneScriptRegExpObject(JSContext* cx, RegExpObject& reobj)
|
|||
RootedAtom source(cx, reobj.getSource());
|
||||
cx->markAtom(source);
|
||||
|
||||
return RegExpObject::create(cx, source, reobj.getFlags(), nullptr, cx->tempLifoAlloc());
|
||||
return RegExpObject::create(cx, source, reobj.getFlags(),
|
||||
nullptr, nullptr, cx->tempLifoAlloc());
|
||||
}
|
||||
|
||||
JS_FRIEND_API(bool)
|
||||
|
|
|
@ -74,11 +74,11 @@ class RegExpObject : public NativeObject
|
|||
|
||||
static RegExpObject*
|
||||
create(JSContext* cx, const char16_t* chars, size_t length, RegExpFlag flags,
|
||||
frontend::TokenStream* ts, LifoAlloc& alloc);
|
||||
const ReadOnlyCompileOptions* options, frontend::TokenStream* ts, LifoAlloc& alloc);
|
||||
|
||||
static RegExpObject*
|
||||
create(JSContext* cx, HandleAtom atom, RegExpFlag flags,
|
||||
frontend::TokenStream* ts, LifoAlloc& alloc);
|
||||
const ReadOnlyCompileOptions* options, frontend::TokenStream* ts, LifoAlloc& alloc);
|
||||
|
||||
/*
|
||||
* Compute the initial shape to associate with fresh RegExp objects,
|
||||
|
|
|
@ -3061,7 +3061,8 @@ CloneObject(JSContext* cx, HandleNativeObject selfHostedObject)
|
|||
RegExpObject& reobj = selfHostedObject->as<RegExpObject>();
|
||||
RootedAtom source(cx, reobj.getSource());
|
||||
MOZ_ASSERT(source->isPermanentAtom());
|
||||
clone = RegExpObject::create(cx, source, reobj.getFlags(), nullptr, cx->tempLifoAlloc());
|
||||
clone = RegExpObject::create(cx, source, reobj.getFlags(),
|
||||
nullptr, nullptr, cx->tempLifoAlloc());
|
||||
} else if (selfHostedObject->is<DateObject>()) {
|
||||
clone = JS::NewDateObject(cx, selfHostedObject->as<DateObject>().clippedTime());
|
||||
} else if (selfHostedObject->is<BooleanObject>()) {
|
||||
|
|
|
@ -2126,7 +2126,7 @@ JSStructuredCloneReader::startRead(MutableHandleValue vp)
|
|||
if (!atom)
|
||||
return false;
|
||||
|
||||
RegExpObject* reobj = RegExpObject::create(context(), atom, flags, nullptr,
|
||||
RegExpObject* reobj = RegExpObject::create(context(), atom, flags, nullptr, nullptr,
|
||||
context()->tempLifoAlloc());
|
||||
if (!reobj)
|
||||
return false;
|
||||
|
|
Загрузка…
Ссылка в новой задаче