Bug 1219757 - Part 3: Rename Self-hosting regexp_construct_no_statics to regexp_construct. r=till
authorTooru Fujisawa <arai_a@mac.com>
Wed, 25 Nov 2015 22:38:04 +0900
changeset 289991 7bb43f9d76affc52ca45036424da6f33107929d5
parent 289990 c158afbc85abaa8352e8341fd197023073157d45
child 289992 3ba888fc9595655b04776d6e693f79943290747c
push id30112
push usercbook@mozilla.com
push dateWed, 23 Mar 2016 15:25:32 +0000
treeherdermozilla-central@6202ade0e6d6 [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 3: Rename Self-hosting regexp_construct_no_statics to regexp_construct. r=till
js/src/builtin/Intl.js
js/src/builtin/RegExp.cpp
js/src/builtin/RegExp.h
js/src/vm/SelfHosting.cpp
--- a/js/src/builtin/Intl.js
+++ b/js/src/builtin/Intl.js
@@ -76,17 +76,17 @@ internalIntlRegExps.currencyDigitsRE = n
  * match the extension production in RFC 5646, where the singleton component is
  * "u".
  *
  * Spec: ECMAScript Internationalization API Specification, 6.2.1.
  */
 function getUnicodeLocaleExtensionSequenceRE() {
     return internalIntlRegExps.unicodeLocaleExtensionSequenceRE ||
            (internalIntlRegExps.unicodeLocaleExtensionSequenceRE =
-            regexp_construct_no_statics("-u(?:-[a-z0-9]{2,8})+"));
+            regexp_construct("-u(?:-[a-z0-9]{2,8})+"));
 }
 
 
 /**
  * Removes Unicode locale extension sequences from the given language tag.
  */
 function removeUnicodeExtensions(locale) {
     // A wholly-privateuse locale has no extension sequences.
@@ -210,18 +210,17 @@ function getLanguageTagRE() {
     var langtag = language + "(?:-" + script + ")?(?:-" + region + ")?(?:-" +
                   variant + ")*(?:-" + extension + ")*(?:-" + privateuse + ")?";
     // Language-Tag  = langtag             ; normal language tags
     //               / privateuse          ; private use tag
     //               / grandfathered       ; grandfathered tags
     var languageTag = "^(?:" + langtag + "|" + privateuse + "|" + grandfathered + ")$";
 
     // Language tags are case insensitive (RFC 5646 section 2.1.1).
-    return (internalIntlRegExps.languageTagRE =
-            regexp_construct_no_statics(languageTag, "i"));
+    return (internalIntlRegExps.languageTagRE = regexp_construct(languageTag, "i"));
 }
 
 
 function getDuplicateVariantRE() {
     if (internalIntlRegExps.duplicateVariantRE)
         return internalIntlRegExps.duplicateVariantRE;
 
     // RFC 5234 section B.1
@@ -257,18 +256,17 @@ function getDuplicateVariantRE() {
 
     // Language tags are case insensitive (RFC 5646 section 2.1.1).  Using
     // character classes covering both upper- and lower-case characters nearly
     // addresses this -- but for the possibility of variant repetition with
     // differing case, e.g. "en-variant-Variant".  Use a case-insensitive
     // regular expression to address this.  (Note that there's no worry about
     // case transformation accepting invalid characters here: users have
     // already verified the string is alphanumeric Latin plus "-".)
-    return (internalIntlRegExps.duplicateVariantRE =
-            regexp_construct_no_statics(duplicateVariant, "i"));
+    return (internalIntlRegExps.duplicateVariantRE = regexp_construct(duplicateVariant, "i"));
 }
 
 
 function getDuplicateSingletonRE() {
     if (internalIntlRegExps.duplicateSingletonRE)
         return internalIntlRegExps.duplicateSingletonRE;
 
     // RFC 5234 section B.1
@@ -303,18 +301,17 @@ function getDuplicateSingletonRE() {
 
     // Language tags are case insensitive (RFC 5646 section 2.1.1).  Using
     // character classes covering both upper- and lower-case characters nearly
     // addresses this -- but for the possibility of singleton repetition with
     // differing case, e.g. "en-u-foo-U-foo".  Use a case-insensitive regular
     // expression to address this.  (Note that there's no worry about case
     // transformation accepting invalid characters here: users have already
     // verified the string is alphanumeric Latin plus "-".)
-    return (internalIntlRegExps.duplicateSingletonRE =
-            regexp_construct_no_statics(duplicateSingleton, "i"));
+    return (internalIntlRegExps.duplicateSingletonRE = regexp_construct(duplicateSingleton, "i"));
 }
 
 
 /**
  * Verifies that the given string is a well-formed BCP 47 language tag
  * with no duplicate variant or singleton subtags.
  *
  * Spec: ECMAScript Internationalization API Specification, 6.2.2.
@@ -609,18 +606,17 @@ function DefaultLocale() {
 
 /**
  * Verifies that the given string is a well-formed ISO 4217 currency code.
  *
  * Spec: ECMAScript Internationalization API Specification, 6.3.1.
  */
 function getIsWellFormedCurrencyCodeRE() {
     return internalIntlRegExps.isWellFormedCurrencyCodeRE ||
-           (internalIntlRegExps.isWellFormedCurrencyCodeRE =
-            regexp_construct_no_statics("[^A-Z]"));
+           (internalIntlRegExps.isWellFormedCurrencyCodeRE = regexp_construct("[^A-Z]"));
 }
 function IsWellFormedCurrencyCode(currency) {
     var c = ToString(currency);
     var normalized = toASCIIUpperCase(c);
     if (normalized.length !== 3)
         return false;
     return !regexp_test_no_statics(getIsWellFormedCurrencyCodeRE(), normalized);
 }
@@ -1935,18 +1931,17 @@ var currencyDigits = {
 
 /**
  * Returns the number of decimal digits to be used for the given currency.
  *
  * Spec: ECMAScript Internationalization API Specification, 11.1.1.
  */
 function getCurrencyDigitsRE() {
     return internalIntlRegExps.currencyDigitsRE ||
-           (internalIntlRegExps.currencyDigitsRE =
-            regexp_construct_no_statics("^[A-Z]{3}$"));
+           (internalIntlRegExps.currencyDigitsRE = regexp_construct("^[A-Z]{3}$"));
 }
 function CurrencyDigits(currency) {
     assert(typeof currency === "string", "CurrencyDigits");
     assert(regexp_test_no_statics(getCurrencyDigitsRE(), currency), "CurrencyDigits");
 
     if (callFunction(std_Object_hasOwnProperty, currencyDigits, currency))
         return currencyDigits[currency];
     return 2;
--- a/js/src/builtin/RegExp.cpp
+++ b/js/src/builtin/RegExp.cpp
@@ -430,17 +430,17 @@ js::regexp_construct(JSContext* cx, unsi
         return false;
     regexp->zeroLastIndex(cx);
 
     args.rval().setObject(*regexp);
     return true;
 }
 
 bool
-js::regexp_construct_no_statics(JSContext* cx, unsigned argc, Value* vp)
+js::regexp_construct_self_hosting(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     MOZ_ASSERT(args.length() == 1 || args.length() == 2);
     MOZ_ASSERT(args[0].isString());
     MOZ_ASSERT_IF(args.length() == 2, args[1].isString());
     MOZ_ASSERT(!args.isConstructing());
 
--- a/js/src/builtin/RegExp.h
+++ b/js/src/builtin/RegExp.h
@@ -71,24 +71,24 @@ regexp_exec_no_statics(JSContext* cx, un
  * Behaves like regexp.test(string), but doesn't set RegExp statics.
  *
  * Usage: does_match = regexp_test_no_statics(regexp, string)
  */
 extern bool
 regexp_test_no_statics(JSContext* cx, unsigned argc, Value* vp);
 
 /*
- * Behaves like RegExp(string) or RegExp(string, string), but doesn't use
- * RegExp statics.
+ * Behaves like RegExp(string) or RegExp(string, string), for self-hosted JS.
+ * pattern and flags should be string, and should be called without |new|.
  *
  * Usage: re = regexp_construct(pattern)
  *        re = regexp_construct(pattern, flags)
  */
 extern bool
-regexp_construct_no_statics(JSContext* cx, unsigned argc, Value* vp);
+regexp_construct_self_hosting(JSContext* cx, unsigned argc, Value* vp);
 
 extern bool
 IsRegExp(JSContext* cx, HandleValue value, bool* result);
 
 // RegExp ClassSpec members used in RegExpObject.cpp.
 extern bool
 regexp_construct(JSContext* cx, unsigned argc, Value* vp);
 extern const JSPropertySpec regexp_static_props[];
--- a/js/src/vm/SelfHosting.cpp
+++ b/js/src/vm/SelfHosting.cpp
@@ -2267,17 +2267,17 @@ static const JSFunctionSpec intrinsic_fu
     JS_INLINABLE_FN("RegExpMatcher", RegExpMatcher, 4,0,
                     RegExpMatcher),
     JS_INLINABLE_FN("RegExpTester", RegExpTester, 4,0,
                     RegExpTester),
 
     // See builtin/RegExp.h for descriptions of the regexp_* functions.
     JS_FN("regexp_exec_no_statics", regexp_exec_no_statics, 2,0),
     JS_FN("regexp_test_no_statics", regexp_test_no_statics, 2,0),
-    JS_FN("regexp_construct_no_statics", regexp_construct_no_statics, 2,0),
+    JS_FN("regexp_construct", regexp_construct_self_hosting, 2,0),
 
     JS_FN("IsModule", intrinsic_IsInstanceOfBuiltin<ModuleObject>, 1, 0),
     JS_FN("CallModuleMethodIfWrapped",
           CallNonGenericSelfhostedMethod<Is<ModuleObject>>, 2, 0),
     JS_FN("HostResolveImportedModule", intrinsic_HostResolveImportedModule, 2, 0),
     JS_FN("GetModuleEnvironment", intrinsic_GetModuleEnvironment, 1, 0),
     JS_FN("CreateModuleEnvironment", intrinsic_CreateModuleEnvironment, 1, 0),
     JS_FN("CreateImportBinding", intrinsic_CreateImportBinding, 4, 0),