Bug 1219757 - Part 4: Remove RegExpStatics* parameter from RegExpObject::create. r=till
authorTooru Fujisawa <arai_a@mac.com>
Wed, 25 Nov 2015 22:38:04 +0900
changeset 290051 3ba888fc9595655b04776d6e693f79943290747c
parent 290050 7bb43f9d76affc52ca45036424da6f33107929d5
child 290052 1090265b5b38d364569b950444194e4084908117
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstill
bugs1219757
milestone48.0a1
Bug 1219757 - Part 4: Remove RegExpStatics* parameter from RegExpObject::create. r=till
js/src/frontend/Parser.cpp
js/src/jsapi.cpp
js/src/vm/RegExpObject.cpp
js/src/vm/RegExpObject.h
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -8938,21 +8938,17 @@ Parser<ParseHandler>::newRegExp()
 {
     MOZ_ASSERT(!options().selfHostingMode);
     // Create the regexp even when doing a syntax parse, to check the regexp's syntax.
     const char16_t* chars = tokenStream.getTokenbuf().begin();
     size_t length = tokenStream.getTokenbuf().length();
     RegExpFlag flags = tokenStream.currentToken().regExpFlags();
 
     Rooted<RegExpObject*> reobj(context);
-    RegExpStatics* res = context->global()->getRegExpStatics(context);
-    if (!res)
-        return null();
-
-    reobj = RegExpObject::create(context, res, chars, length, flags, &tokenStream, alloc);
+    reobj = RegExpObject::create(context, chars, length, flags, &tokenStream, alloc);
     if (!reobj)
         return null();
 
     return handler.newRegExp(reobj, pos(), *this);
 }
 
 template <typename ParseHandler>
 typename ParseHandler::Node
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -5673,36 +5673,28 @@ JS_PUBLIC_API(JSObject*)
 JS_NewRegExpObject(JSContext* cx, HandleObject obj, const char* bytes, size_t length, unsigned flags)
 {
     AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
     ScopedJSFreePtr<char16_t> chars(InflateString(cx, bytes, &length));
     if (!chars)
         return nullptr;
 
-    RegExpStatics* res = obj->as<GlobalObject>().getRegExpStatics(cx);
-    if (!res)
-        return nullptr;
-
-    RegExpObject* reobj = RegExpObject::create(cx, res, chars, length,
+    RegExpObject* reobj = RegExpObject::create(cx, chars, length,
                                                RegExpFlag(flags), nullptr, cx->tempLifoAlloc());
     return reobj;
 }
 
 JS_PUBLIC_API(JSObject*)
 JS_NewUCRegExpObject(JSContext* cx, HandleObject obj, const char16_t* chars, size_t length,
                      unsigned flags)
 {
     AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
-    RegExpStatics* res = obj->as<GlobalObject>().getRegExpStatics(cx);
-    if (!res)
-        return nullptr;
-
-    return RegExpObject::create(cx, res, chars, length,
+    return RegExpObject::create(cx, chars, length,
                                 RegExpFlag(flags), nullptr, cx->tempLifoAlloc());
 }
 
 JS_PUBLIC_API(bool)
 JS_SetRegExpInput(JSContext* cx, HandleObject obj, HandleString input, bool multiline)
 {
     AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
--- a/js/src/vm/RegExpObject.cpp
+++ b/js/src/vm/RegExpObject.cpp
@@ -210,21 +210,20 @@ const Class RegExpObject::class_ = {
         nullptr,
         js::regexp_static_props,
         js::regexp_methods,
         js::regexp_properties
     }
 };
 
 RegExpObject*
-RegExpObject::create(ExclusiveContext* cx, RegExpStatics* res, const char16_t* chars, size_t length,
-                     RegExpFlag flags, TokenStream* tokenStream, LifoAlloc& alloc)
+RegExpObject::create(ExclusiveContext* cx, const char16_t* chars, size_t length, RegExpFlag flags,
+                     TokenStream* tokenStream, LifoAlloc& alloc)
 {
-    RegExpFlag staticsFlags = res->getFlags();
-    return createNoStatics(cx, chars, length, RegExpFlag(flags | staticsFlags), tokenStream, alloc);
+    return createNoStatics(cx, chars, length, flags, tokenStream, alloc);
 }
 
 RegExpObject*
 RegExpObject::createNoStatics(ExclusiveContext* cx, const char16_t* chars, size_t length, RegExpFlag flags,
                               TokenStream* tokenStream, LifoAlloc& alloc)
 {
     RootedAtom source(cx, AtomizeChars(cx, chars, length));
     if (!source)
--- a/js/src/vm/RegExpObject.h
+++ b/js/src/vm/RegExpObject.h
@@ -363,24 +363,19 @@ class RegExpObject : public NativeObject
     static const unsigned PRIVATE_SLOT = 3;
 
     static const Class class_;
 
     // The maximum number of pairs a MatchResult can have, without having to
     // allocate a bigger MatchResult.
     static const size_t MaxPairCount = 14;
 
-    /*
-     * Note: The regexp statics flags are OR'd into the provided flags,
-     * so this function is really meant for object creation during code
-     * execution, as opposed to during something like XDR.
-     */
     static RegExpObject*
-    create(ExclusiveContext* cx, RegExpStatics* res, const char16_t* chars, size_t length,
-           RegExpFlag flags, frontend::TokenStream* ts, LifoAlloc& alloc);
+    create(ExclusiveContext* cx, const char16_t* chars, size_t length, RegExpFlag flags,
+           frontend::TokenStream* ts, LifoAlloc& alloc);
 
     static RegExpObject*
     createNoStatics(ExclusiveContext* cx, const char16_t* chars, size_t length, RegExpFlag flags,
                     frontend::TokenStream* ts, LifoAlloc& alloc);
 
     static RegExpObject*
     createNoStatics(ExclusiveContext* cx, HandleAtom atom, RegExpFlag flags,
                     frontend::TokenStream* ts, LifoAlloc& alloc);