Bug 1415161 - Get rid of slow JSContext::findVersion calls when parsing regular expressions. r=anba
authorJan de Mooij <jdemooij@mozilla.com>
Tue, 07 Nov 2017 17:40:12 +0100
changeset 443786 d82266d06a5b236b75a8b204a1d4be558c403441
parent 443785 e4397a936799bd165755a946c29fb41a4d8040bc
child 443787 7ca31c599c21b769c66e1a842a614866a791ed06
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersanba
bugs1415161
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1415161 - Get rid of slow JSContext::findVersion calls when parsing regular expressions. r=anba
js/src/builtin/RegExp.cpp
js/src/vm/RegExpObject.cpp
--- a/js/src/builtin/RegExp.cpp
+++ b/js/src/builtin/RegExp.cpp
@@ -173,17 +173,17 @@ js::ExecuteRegExpLegacy(JSContext* cx, R
     }
 
     return CreateRegExpMatchResult(cx, input, matches, rval);
 }
 
 static bool
 CheckPatternSyntax(JSContext* cx, HandleAtom pattern, RegExpFlag flags)
 {
-    CompileOptions options(cx);
+    CompileOptions options(cx, JSVERSION_DEFAULT);
     frontend::TokenStream dummyTokenStream(cx, options, nullptr, 0, nullptr);
     return irregexp::ParsePatternSyntax(dummyTokenStream, cx->tempLifoAlloc(), pattern,
                                         flags & UnicodeFlag);
 }
 
 enum RegExpSharedUse {
     UseRegExpShared,
     DontUseRegExpShared
--- a/js/src/vm/RegExpObject.cpp
+++ b/js/src/vm/RegExpObject.cpp
@@ -237,17 +237,17 @@ RegExpObject::create(JSContext* cx, cons
 
 RegExpObject*
 RegExpObject::create(JSContext* cx, HandleAtom source, RegExpFlag flags,
                      const ReadOnlyCompileOptions* options, TokenStream* tokenStream,
                      LifoAlloc& alloc, NewObjectKind newKind)
 {
     Maybe<CompileOptions> dummyOptions;
     if (!tokenStream && !options) {
-        dummyOptions.emplace(cx);
+        dummyOptions.emplace(cx, JSVERSION_DEFAULT);
         options = dummyOptions.ptr();
     }
     Maybe<TokenStream> dummyTokenStream;
     if (!tokenStream) {
         dummyTokenStream.emplace(cx, *options,
                                    (const char16_t*) nullptr, 0,
                                    (frontend::StrictModeGetter*) nullptr);
         tokenStream = dummyTokenStream.ptr();
@@ -982,17 +982,17 @@ RegExpShared::compile(JSContext* cx, Mut
 
 /* static */ bool
 RegExpShared::compile(JSContext* cx, MutableHandleRegExpShared re, HandleAtom pattern,
                       HandleLinearString input, CompilationMode mode, ForceByteCodeEnum force)
 {
     if (!re->ignoreCase() && !StringHasRegExpMetaChars(pattern))
         re->canStringMatch = true;
 
-    CompileOptions options(cx);
+    CompileOptions options(cx, JSVERSION_DEFAULT);
     frontend::TokenStream dummyTokenStream(cx, options, nullptr, 0, nullptr);
 
     LifoAllocScope scope(&cx->tempLifoAlloc());
 
     /* Parse the pattern. */
     irregexp::RegExpCompileData data;
     if (!irregexp::ParsePattern(dummyTokenStream, cx->tempLifoAlloc(), pattern,
                                 re->multiline(), mode == MatchOnly, re->unicode(),