Bug 1219757 - Part 2: Remove RegExpStaticsUse parameter from RegExpInitialize. r=till
authorTooru Fujisawa <arai_a@mac.com>
Wed, 25 Nov 2015 22:38:04 +0900
changeset 289949 c158afbc85abaa8352e8341fd197023073157d45
parent 289948 e5ae8475e40e2dd74033f3163e42811e1fc6de88
child 289950 7bb43f9d76affc52ca45036424da6f33107929d5
push id74045
push userarai_a@mac.com
push dateWed, 23 Mar 2016 04:58:59 +0000
treeherdermozilla-inbound@604a180b6cc0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstill
bugs1219757
milestone48.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 1219757 - Part 2: Remove RegExpStaticsUse parameter from RegExpInitialize. r=till
js/src/builtin/RegExp.cpp
js/src/builtin/RegExp.h
--- a/js/src/builtin/RegExp.cpp
+++ b/js/src/builtin/RegExp.cpp
@@ -153,18 +153,17 @@ js::ExecuteRegExpLegacy(JSContext* cx, R
 }
 
 /*
  * ES6 21.2.3.2.2.  Because this function only ever returns |obj| in the spec,
  * provided by the user, we omit it and just return the usual success/failure.
  */
 static bool
 RegExpInitializeIgnoringLastIndex(JSContext* cx, Handle<RegExpObject*> obj,
-                                  HandleValue patternValue, HandleValue flagsValue,
-                                  RegExpStaticsUse staticsUse)
+                                  HandleValue patternValue, HandleValue flagsValue)
 {
     RootedAtom pattern(cx);
     if (patternValue.isUndefined()) {
         /* Step 1. */
         pattern = cx->names().empty;
     } else {
         /* Steps 2-3. */
         pattern = ToAtom<CanGC>(cx, patternValue);
@@ -189,23 +188,16 @@ RegExpInitializeIgnoringLastIndex(JSCont
     CompileOptions options(cx);
     frontend::TokenStream dummyTokenStream(cx, options, nullptr, 0, nullptr);
     if (!irregexp::ParsePatternSyntax(dummyTokenStream, cx->tempLifoAlloc(), pattern,
                                       flags & UnicodeFlag))
     {
         return false;
     }
 
-    if (staticsUse == UseRegExpStatics) {
-        RegExpStatics* res = cx->global()->getRegExpStatics(cx);
-        if (!res)
-            return false;
-        flags = RegExpFlag(flags | res->getFlags());
-    }
-
     /* Steps 11-13. */
     obj->initIgnoringLastIndex(pattern, flags);
     return true;
 }
 
 MOZ_ALWAYS_INLINE bool
 IsRegExpObject(HandleValue v)
 {
@@ -284,17 +276,17 @@ regexp_compile_impl(JSContext* cx, const
         // Step 5, minus lastIndex zeroing.
         regexp->initIgnoringLastIndex(sourceAtom, flags);
     } else {
         // Step 4.
         RootedValue P(cx, patternValue);
         RootedValue F(cx, args.get(1));
 
         // Step 5, minus lastIndex zeroing.
-        if (!RegExpInitializeIgnoringLastIndex(cx, regexp, P, F, UseRegExpStatics))
+        if (!RegExpInitializeIgnoringLastIndex(cx, regexp, P, F))
             return false;
     }
 
     if (regexp->lookupPure(cx->names().lastIndex)->writable()) {
         regexp->zeroLastIndex(cx);
     } else {
         RootedValue zero(cx, Int32Value(0));
         if (!SetProperty(cx, regexp, cx->names().lastIndex, zero))
@@ -429,17 +421,17 @@ js::regexp_construct(JSContext* cx, unsi
     if (!GetPrototypeFromCallableConstructor(cx, args, &proto))
         return false;
 
     Rooted<RegExpObject*> regexp(cx, RegExpAlloc(cx, proto));
     if (!regexp)
         return false;
 
     // Step 10.
-    if (!RegExpInitializeIgnoringLastIndex(cx, regexp, P, F, UseRegExpStatics))
+    if (!RegExpInitializeIgnoringLastIndex(cx, regexp, P, F))
         return false;
     regexp->zeroLastIndex(cx);
 
     args.rval().setObject(*regexp);
     return true;
 }
 
 bool
@@ -454,17 +446,17 @@ js::regexp_construct_no_statics(JSContex
 
     /* Steps 1-6 are not required since pattern is always string. */
 
     /* Steps 7-10. */
     Rooted<RegExpObject*> regexp(cx, RegExpAlloc(cx));
     if (!regexp)
         return false;
 
-    if (!RegExpInitializeIgnoringLastIndex(cx, regexp, args[0], args.get(1), DontUseRegExpStatics))
+    if (!RegExpInitializeIgnoringLastIndex(cx, regexp, args[0], args.get(1)))
         return false;
     regexp->zeroLastIndex(cx);
 
     args.rval().setObject(*regexp);
     return true;
 }
 
 /* ES6 draft rev32 21.2.5.4. */
--- a/js/src/builtin/RegExp.h
+++ b/js/src/builtin/RegExp.h
@@ -18,19 +18,16 @@ namespace js {
 
 JSObject*
 InitRegExpClass(JSContext* cx, HandleObject obj);
 
 // Whether RegExp statics should be updated with the input and results of a
 // regular expression execution.
 enum RegExpStaticsUpdate { UpdateRegExpStatics, DontUpdateRegExpStatics };
 
-// Whether RegExp statics should be used to create a RegExp instance.
-enum RegExpStaticsUse { UseRegExpStatics, DontUseRegExpStatics };
-
 /*
  * Legacy behavior of ExecuteRegExp(), which is baked into the JSAPI.
  *
  * |res| may be nullptr if the RegExpStatics are not to be updated.
  * |input| may be nullptr if there is no JSString corresponding to
  * |chars| and |length|.
  */
 bool