Title: [252514] trunk
- Revision
- 252514
- Author
- [email protected]
- Date
- 2019-11-15 17:25:21 -0800 (Fri, 15 Nov 2019)
Log Message
[JSC] DFG strength reduction should define "groups" for RegExp constant-folded result
https://bugs.webkit.org/show_bug.cgi?id=204264
Reviewed by Michael Saboff.
JSTests:
* stress/dfg-strength-reduction-for-regexp-should-include-groups-property.js: Added.
(shouldBe):
(test):
Source/_javascript_Core:
We always define "groups" property in the result of RegExp matching.
But we do not define it when DFG performs strength-reduction for the RegExp matching node.
This patch adds "groups" field correctly.
* dfg/DFGStrengthReductionPhase.cpp:
(JSC::DFG::StrengthReductionPhase::handleNode):
* runtime/RegExpMatchesArray.cpp:
(JSC::createEmptyRegExpMatchesArray):
Modified Paths
Added Paths
Diff
Modified: trunk/JSTests/ChangeLog (252513 => 252514)
--- trunk/JSTests/ChangeLog 2019-11-16 00:44:30 UTC (rev 252513)
+++ trunk/JSTests/ChangeLog 2019-11-16 01:25:21 UTC (rev 252514)
@@ -1,5 +1,16 @@
2019-11-15 Yusuke Suzuki <[email protected]>
+ [JSC] DFG strength reduction should define "groups" for RegExp constant-folded result
+ https://bugs.webkit.org/show_bug.cgi?id=204264
+
+ Reviewed by Michael Saboff.
+
+ * stress/dfg-strength-reduction-for-regexp-should-include-groups-property.js: Added.
+ (shouldBe):
+ (test):
+
+2019-11-15 Yusuke Suzuki <[email protected]>
+
Wasm error message should be cross-thread-copied
https://bugs.webkit.org/show_bug.cgi?id=204143
Added: trunk/JSTests/stress/dfg-strength-reduction-for-regexp-should-include-groups-property.js (0 => 252514)
--- trunk/JSTests/stress/dfg-strength-reduction-for-regexp-should-include-groups-property.js (rev 0)
+++ trunk/JSTests/stress/dfg-strength-reduction-for-regexp-should-include-groups-property.js 2019-11-16 01:25:21 UTC (rev 252514)
@@ -0,0 +1,14 @@
+function shouldBe(actual, expected) {
+ if (actual !== expected)
+ throw new Error('bad value: ' + actual);
+}
+noInline(shouldBe);
+
+function test()
+{
+ this.x = 'a'.match(/a/)['groups'];
+ shouldBe(this.x, undefined);
+}
+noInline(test);
+for (let i=0; i<100000; i++)
+ test();
Modified: trunk/Source/_javascript_Core/ChangeLog (252513 => 252514)
--- trunk/Source/_javascript_Core/ChangeLog 2019-11-16 00:44:30 UTC (rev 252513)
+++ trunk/Source/_javascript_Core/ChangeLog 2019-11-16 01:25:21 UTC (rev 252514)
@@ -1,5 +1,21 @@
2019-11-15 Yusuke Suzuki <[email protected]>
+ [JSC] DFG strength reduction should define "groups" for RegExp constant-folded result
+ https://bugs.webkit.org/show_bug.cgi?id=204264
+
+ Reviewed by Michael Saboff.
+
+ We always define "groups" property in the result of RegExp matching.
+ But we do not define it when DFG performs strength-reduction for the RegExp matching node.
+ This patch adds "groups" field correctly.
+
+ * dfg/DFGStrengthReductionPhase.cpp:
+ (JSC::DFG::StrengthReductionPhase::handleNode):
+ * runtime/RegExpMatchesArray.cpp:
+ (JSC::createEmptyRegExpMatchesArray):
+
+2019-11-15 Yusuke Suzuki <[email protected]>
+
Wasm error message should be cross-thread-copied
https://bugs.webkit.org/show_bug.cgi?id=204143
Modified: trunk/Source/_javascript_Core/dfg/DFGStrengthReductionPhase.cpp (252513 => 252514)
--- trunk/Source/_javascript_Core/dfg/DFGStrengthReductionPhase.cpp 2019-11-16 00:44:30 UTC (rev 252513)
+++ trunk/Source/_javascript_Core/dfg/DFGStrengthReductionPhase.cpp 2019-11-16 01:25:21 UTC (rev 252514)
@@ -669,8 +669,10 @@
UniquedStringImpl* indexUID = vm().propertyNames->index.impl();
UniquedStringImpl* inputUID = vm().propertyNames->input.impl();
+ UniquedStringImpl* groupsUID = vm().propertyNames->groups.impl();
unsigned indexIndex = m_graph.identifiers().ensure(indexUID);
unsigned inputIndex = m_graph.identifiers().ensure(inputUID);
+ unsigned groupsIndex = m_graph.identifiers().ensure(groupsUID);
unsigned firstChild = m_graph.m_varArgChildren.size();
m_graph.m_varArgChildren.append(
@@ -698,6 +700,14 @@
data->m_properties.append(
PromotedLocationDescriptor(NamedPropertyPLoc, inputIndex));
+ // FIXME: https://bugs.webkit.org/show_bug.cgi?id=176464
+ // Implement strength reduction optimization for named capture groups.
+ m_graph.m_varArgChildren.append(
+ m_insertionSet.insertConstantForUse(
+ m_nodeIndex, origin, jsUndefined(), UntypedUse));
+ data->m_properties.append(
+ PromotedLocationDescriptor(NamedPropertyPLoc, groupsIndex));
+
auto materializeString = [&] (const String& string) -> Node* {
if (string.isNull())
return nullptr;
Modified: trunk/Source/_javascript_Core/runtime/RegExpMatchesArray.cpp (252513 => 252514)
--- trunk/Source/_javascript_Core/runtime/RegExpMatchesArray.cpp 2019-11-16 00:44:30 UTC (rev 252513)
+++ trunk/Source/_javascript_Core/runtime/RegExpMatchesArray.cpp 2019-11-16 01:25:21 UTC (rev 252514)
@@ -67,6 +67,7 @@
array->putDirectWithoutBarrier(RegExpMatchesArrayIndexPropertyOffset, jsNumber(-1));
array->putDirectWithoutBarrier(RegExpMatchesArrayInputPropertyOffset, input);
+ array->putDirectWithoutBarrier(RegExpMatchesArrayGroupsPropertyOffset, jsUndefined());
return array;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes