Title: [285462] branches/safari-612-branch
- Revision
- 285462
- Author
- [email protected]
- Date
- 2021-11-08 17:09:06 -0800 (Mon, 08 Nov 2021)
Log Message
Cherry-pick r283818. rdar://problem/85173568
RegExpExec can't statically prove which of the two structures it will get in AI by just looking at the RegExp*
https://bugs.webkit.org/show_bug.cgi?id=231382
<rdar://83722151>
Reviewed by Mark Lam.
JSTests:
* stress/reg-exp-exec-cant-prove-which-structure-it-produces-in-ai.js: Added.
(foo):
Source/_javascript_Core:
Because of the RegExp.prototype.compile API, we don't know if the RegExp
produced by RegExpExec will have indices or not, because that bit of
information can be reset by the RegExp.prototype.compile API. So, we
conservatively say that it can produce either structure.
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283818 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Added Paths
Diff
Modified: branches/safari-612-branch/JSTests/ChangeLog (285461 => 285462)
--- branches/safari-612-branch/JSTests/ChangeLog 2021-11-09 01:09:04 UTC (rev 285461)
+++ branches/safari-612-branch/JSTests/ChangeLog 2021-11-09 01:09:06 UTC (rev 285462)
@@ -1,5 +1,44 @@
2021-11-08 Kocsen Chung <[email protected]>
+ Cherry-pick r283818. rdar://problem/85173568
+
+ RegExpExec can't statically prove which of the two structures it will get in AI by just looking at the RegExp*
+ https://bugs.webkit.org/show_bug.cgi?id=231382
+ <rdar://83722151>
+
+ Reviewed by Mark Lam.
+
+ JSTests:
+
+ * stress/reg-exp-exec-cant-prove-which-structure-it-produces-in-ai.js: Added.
+ (foo):
+
+ Source/_javascript_Core:
+
+ Because of the RegExp.prototype.compile API, we don't know if the RegExp
+ produced by RegExpExec will have indices or not, because that bit of
+ information can be reset by the RegExp.prototype.compile API. So, we
+ conservatively say that it can produce either structure.
+
+ * dfg/DFGAbstractInterpreterInlines.h:
+ (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283818 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-10-08 Saam Barati <[email protected]>
+
+ RegExpExec can't statically prove which of the two structures it will get in AI by just looking at the RegExp*
+ https://bugs.webkit.org/show_bug.cgi?id=231382
+ <rdar://83722151>
+
+ Reviewed by Mark Lam.
+
+ * stress/reg-exp-exec-cant-prove-which-structure-it-produces-in-ai.js: Added.
+ (foo):
+
+2021-11-08 Kocsen Chung <[email protected]>
+
Cherry-pick r283623. rdar://problem/85167292
Run backwards propagation before we prune the graph after ForceOSRExit nodes in BytecodeParser
Added: branches/safari-612-branch/JSTests/stress/reg-exp-exec-cant-prove-which-structure-it-produces-in-ai.js (0 => 285462)
--- branches/safari-612-branch/JSTests/stress/reg-exp-exec-cant-prove-which-structure-it-produces-in-ai.js (rev 0)
+++ branches/safari-612-branch/JSTests/stress/reg-exp-exec-cant-prove-which-structure-it-produces-in-ai.js 2021-11-09 01:09:06 UTC (rev 285462)
@@ -0,0 +1,12 @@
+// This should not crash.
+
+function foo() {
+ let r = /a/;
+ r.compile(undefined, ...'d');
+ let a = r.exec(/b/);
+ a.x;
+}
+
+for (let i = 0; i < 1000; i++) {
+ foo();
+}
Modified: branches/safari-612-branch/Source/_javascript_Core/ChangeLog (285461 => 285462)
--- branches/safari-612-branch/Source/_javascript_Core/ChangeLog 2021-11-09 01:09:04 UTC (rev 285461)
+++ branches/safari-612-branch/Source/_javascript_Core/ChangeLog 2021-11-09 01:09:06 UTC (rev 285462)
@@ -1,5 +1,49 @@
2021-11-08 Kocsen Chung <[email protected]>
+ Cherry-pick r283818. rdar://problem/85173568
+
+ RegExpExec can't statically prove which of the two structures it will get in AI by just looking at the RegExp*
+ https://bugs.webkit.org/show_bug.cgi?id=231382
+ <rdar://83722151>
+
+ Reviewed by Mark Lam.
+
+ JSTests:
+
+ * stress/reg-exp-exec-cant-prove-which-structure-it-produces-in-ai.js: Added.
+ (foo):
+
+ Source/_javascript_Core:
+
+ Because of the RegExp.prototype.compile API, we don't know if the RegExp
+ produced by RegExpExec will have indices or not, because that bit of
+ information can be reset by the RegExp.prototype.compile API. So, we
+ conservatively say that it can produce either structure.
+
+ * dfg/DFGAbstractInterpreterInlines.h:
+ (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283818 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-10-08 Saam Barati <[email protected]>
+
+ RegExpExec can't statically prove which of the two structures it will get in AI by just looking at the RegExp*
+ https://bugs.webkit.org/show_bug.cgi?id=231382
+ <rdar://83722151>
+
+ Reviewed by Mark Lam.
+
+ Because of the RegExp.prototype.compile API, we don't know if the RegExp
+ produced by RegExpExec will have indices or not, because that bit of
+ information can be reset by the RegExp.prototype.compile API. So, we
+ conservatively say that it can produce either structure.
+
+ * dfg/DFGAbstractInterpreterInlines.h:
+ (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
+
+2021-11-08 Kocsen Chung <[email protected]>
+
Cherry-pick r283623. rdar://problem/85167292
Run backwards propagation before we prune the graph after ForceOSRExit nodes in BytecodeParser
Modified: branches/safari-612-branch/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h (285461 => 285462)
--- branches/safari-612-branch/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h 2021-11-09 01:09:04 UTC (rev 285461)
+++ branches/safari-612-branch/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h 2021-11-09 01:09:06 UTC (rev 285462)
@@ -2615,24 +2615,9 @@
if (JSGlobalObject* globalObject = jsDynamicCast<JSGlobalObject*>(m_vm, globalObjectValue)) {
if (!globalObject->isHavingABadTime()) {
m_graph.watchpoints().addLazily(globalObject->havingABadTimeWatchpoint());
-
- RegExp* regExp = nullptr;
- if (node->op() == RegExpExec) {
- if (Node* regExpObjectNode = node->child2().node()) {
- if (RegExpObject* regExpObject = regExpObjectNode->dynamicCastConstant<RegExpObject*>(m_vm))
- regExp = regExpObject->regExp();
- else if (regExpObjectNode->op() == NewRegexp)
- regExp = regExpObjectNode->castOperand<RegExp*>();
- }
- } else if (node->op() == RegExpExecNonGlobalOrSticky)
- regExp = node->castOperand<RegExp*>();
-
RegisteredStructureSet structureSet;
- // If regExp is unknown, we need to put both regExp MatchesArray structure variants in our set.
- if (!regExp || !regExp->hasIndices())
- structureSet.add(m_graph.registerStructure(globalObject->regExpMatchesArrayStructure()));
- if (!regExp || regExp->hasIndices())
- structureSet.add(m_graph.registerStructure(globalObject->regExpMatchesArrayWithIndicesStructure()));
+ structureSet.add(m_graph.registerStructure(globalObject->regExpMatchesArrayStructure()));
+ structureSet.add(m_graph.registerStructure(globalObject->regExpMatchesArrayWithIndicesStructure()));
setForNode(node, structureSet);
forNode(node).merge(SpecOther);
break;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes