Skip to content

Commit 89dcb36

Browse files
committed
[JSC] Quickly scan whether we have OAS target nodes
https://bugs.webkit.org/show_bug.cgi?id=328245 rdar://190550681 Reviewed by Mark Lam and Keith Miller. Many JS code does not have candidates for OAS. So quickly scan and stop doing further when we do not have candidates for OAS. * Source/JavaScriptCore/dfg/DFGObjectAllocationSinkingPhase.cpp: Canonical link: https://commits.webkit.org/324299@main
1 parent 8e8cccb commit 89dcb36

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

‎Source/JavaScriptCore/dfg/DFGObjectAllocationSinkingPhase.cpp‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,8 +818,39 @@ class ObjectAllocationSinkingPhase : public Phase {
818818
}
819819

820820
private:
821+
bool hasAllocationToSink()
822+
{
823+
for (BasicBlock* block : m_graph.blocksInNaturalOrder()) {
824+
for (Node* node : *block) {
825+
switch (node->op()) {
826+
case NewObject:
827+
case NewFunction:
828+
case NewGeneratorFunction:
829+
case NewAsyncGeneratorFunction:
830+
case NewAsyncFunction:
831+
case NewInternalFieldObject:
832+
case NewRegExp:
833+
case NewPromise:
834+
case CreateActivation:
835+
return true;
836+
case NewButterflyWithSize:
837+
case NewArrayWithButterfly:
838+
if (Options::useArrayAllocationSinking())
839+
return true;
840+
break;
841+
default:
842+
break;
843+
}
844+
}
845+
}
846+
return false;
847+
}
848+
821849
bool performSinking()
822850
{
851+
if (!hasAllocationToSink())
852+
return false;
853+
823854
m_graph.computeRefCounts();
824855
m_graph.initializeNodeOwners();
825856
m_graph.ensureSSADominators();

0 commit comments

Comments
 (0)