Minor fixes to RegExp match indices after r273086
https://bugs.webkit.org/show_bug.cgi?id=222157
Reviewed by Yusuke Suzuki.
JSTests:
Added a new test to verify that all flag RegExp flag combinations work round tripping
from flags to flag proerties and back.
Added standalone versions of the updated regexp-match-indices from the PR
https://github.com/tc39/test262/pull/2934 as JSTest/stress test.
Disabled the regexp-match-indices feature test in test262 until the pull request
with updated tests land and we update the WebKit version.
This is tracked in https://bugs.webkit.org/show_bug.cgi?id=222142.
* stress/regexp-all-flags.js: Added.
(flagsFromVariation):
(setPropertiesForVariation):
(missingPropertiesForVariation):
(test.let.flagsSet.get call):
(test):
* stress/test262-indices-array-element.js: Added.
(assertSameValue):
* stress/test262-indices-array-matched.js: Added.
(assertSameValue):
(assertCompareArray):
* stress/test262-indices-array-non-unicode-match.js: Added.
(assertSameValue):
(assertCompareArray):
(assertDeepEqual):
(verifyProperty):
* stress/test262-indices-array-properties.js: Added.
(verifyProperty):
* stress/test262-indices-array-unicode-match.js: Added.
(assertSameValue):
(assertCompareArray):
(assertDeepEqual):
(verifyProperty):
* stress/test262-indices-array-unicode-property-names.js: Added.
(assertCompareArray):
* stress/test262-indices-array-unmatched.js: Added.
(assertSameValue):
* stress/test262-indices-array.js: Added.
(assert):
(assertSameValue):
* stress/test262-indices-groups-object-undefined.js: Added.
(verifyProperty):
* stress/test262-indices-groups-object-unmatched.js: Added.
(assertSameValue):
(assertCompareArray):
* stress/test262-indices-groups-object.js: Added.
(assertSameValue):
(assertCompareArray):
(verifyProperty):
* stress/test262-indices-groups-properties.js: Added.
(assertCompareArray):
(verifyProperty):
* stress/test262-indices-property.js: Added.
(assertSameValue):
(verifyProperty):
* test262/config.yaml:
Source/JavaScriptCore:
When hasIndices is true, but there aren't any named groups, the spec says that we should
create the indices.groups property is the value undefined.
Increased the size of FlagsString to 7 plus terminater to account for the new 'd' flags.
* runtime/RegExpMatchesArray.h:
(JSC::createRegExpMatchesArray):
* runtime/RegExpPrototype.cpp:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@273160 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index b346fbe..8d58a11 100644
--- a/Source/JavaScriptCore/ChangeLog
+++ b/Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,18 @@
+2021-02-19 Michael Saboff <msaboff@apple.com>
+
+ Minor fixes to RegExp match indices after r273086
+ https://bugs.webkit.org/show_bug.cgi?id=222157
+
+ Reviewed by Yusuke Suzuki.
+
+ When hasIndices is true, but there aren't any named groups, the spec says that we should
+ create the indices.groups property is the value undefined.
+ Increased the size of FlagsString to 7 plus terminater to account for the new 'd' flags.
+
+ * runtime/RegExpMatchesArray.h:
+ (JSC::createRegExpMatchesArray):
+ * runtime/RegExpPrototype.cpp:
+
2021-02-19 Yusuke Suzuki <ysuzuki@apple.com>
[JSC] Do not use toObject for options in new Intl constructors
diff --git a/Source/JavaScriptCore/runtime/RegExpMatchesArray.h b/Source/JavaScriptCore/runtime/RegExpMatchesArray.h
index 223b9c8..4c8ca15 100644
--- a/Source/JavaScriptCore/runtime/RegExpMatchesArray.h
+++ b/Source/JavaScriptCore/runtime/RegExpMatchesArray.h
@@ -106,7 +106,7 @@
Structure* indicesStructure = globalObject->regExpMatchesIndicesArrayStructure();
- indicesArray->putDirect(vm, RegExpMatchesIndicesGroupsPropertyOffset, indicesGroups);
+ indicesArray->putDirect(vm, RegExpMatchesIndicesGroupsPropertyOffset, indicesGroups ? indicesGroups : jsUndefined());
ASSERT(!indicesArray->butterfly()->indexingHeader()->preCapacity(indicesStructure));
auto indicesCapacity = indicesStructure->outOfLineCapacity();
diff --git a/Source/JavaScriptCore/runtime/RegExpPrototype.cpp b/Source/JavaScriptCore/runtime/RegExpPrototype.cpp
index e8f71b2..3080f90 100644
--- a/Source/JavaScriptCore/runtime/RegExpPrototype.cpp
+++ b/Source/JavaScriptCore/runtime/RegExpPrototype.cpp
@@ -162,7 +162,7 @@
return JSValue::encode(thisRegExp);
}
-typedef std::array<char, 6 + 1> FlagsString; // 6 different flags and a null character terminator.
+typedef std::array<char, 7 + 1> FlagsString; // 6 different flags and a null character terminator.
static inline FlagsString flagsString(JSGlobalObject* globalObject, JSObject* regexp)
{