Changeset 253350 in webkit for trunk/Source/JavaScriptCore/dfg


Ignore:
Timestamp:
Dec 10, 2019, 3:08:04 PM (5 years ago)
Author:
[email protected]
Message:

methodOfGettingAValueProfileFor should return argument value profiles even when node and operandNode are the same origin
https://bugs.webkit.org/show_bug.cgi?id=205083

Reviewed by Yusuke Suzuki.

Inside methodOfGettingAValueProfileFor, we only grab profiles when the child
node and the parent node were from different code origins. This policy doesn't
make sense when the child node is the load of an argument value. In that case,
we can always just grab the argument profile.

We might want to reconsider this policy in general, since it's common for a
node to emit a GetLocal to grab its incoming arguments (this is frequently
done in the DFG when reloading locals across basic blocks).

This fixes an OSR exit compile loop inside Speedometer 2's React-Redux-TodoMVC
benchmark. That benchmark would repeatedly exit inside CompareStrictEq by
repeatedly speculating Object. That node would run with 95% incoming Objects,
and 5% incoming strings, and because we didn't grab the argument value profile
during exit, we never updated the profile with the String type information.

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::methodOfGettingAValueProfileFor):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGGraph.cpp

    r252789 r253350  
    16341634
    16351635    for (Node* node = operandNode; node;) {
     1636        if (node->accessesStack(*this)) {
     1637            if (m_form != SSA && node->local().isArgument()) {
     1638                int argument = node->local().toArgument();
     1639                Node* argumentNode = m_rootToArguments.find(block(0))->value[argument];
     1640                // FIXME: We should match SetArgumentDefinitely nodes at other entrypoints as well:
     1641                // https://bugs.webkit.org/show_bug.cgi?id=175841
     1642                if (argumentNode && node->variableAccessData() == argumentNode->variableAccessData()) {
     1643                    CodeBlock* profiledBlock = baselineCodeBlockFor(node->origin.semantic);
     1644                    return &profiledBlock->valueProfileForArgument(argument);
     1645                }
     1646            }
     1647        }
     1648
    16361649        // currentNode is null when we're doing speculation checks for checkArgumentTypes().
    16371650        if (!currentNode || node->origin.semantic != currentNode->origin.semantic || !currentNode->hasResult()) {
     
    16391652
    16401653            if (node->accessesStack(*this)) {
    1641                 if (m_form != SSA && node->local().isArgument()) {
    1642                     int argument = node->local().toArgument();
    1643                     Node* argumentNode = m_rootToArguments.find(block(0))->value[argument];
    1644                     // FIXME: We should match SetArgumentDefinitely nodes at other entrypoints as well:
    1645                     // https://bugs.webkit.org/show_bug.cgi?id=175841
    1646                     if (argumentNode && node->variableAccessData() == argumentNode->variableAccessData())
    1647                         return &profiledBlock->valueProfileForArgument(argument);
    1648                 }
    1649 
    16501654                if (node->op() == GetLocal) {
    16511655                    return MethodOfGettingAValueProfile::fromLazyOperand(
Note: See TracChangeset for help on using the changeset viewer.