⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 181487 in webkit


Ignore:
Timestamp:
Mar 13, 2015, 1:18:08 PM (11 years ago)
Author:
fpizlo@apple.com
Message:

DFG::PutStackSinkingPhase should eliminate GetStacks that have an obviously known source
https://bugs.webkit.org/show_bug.cgi?id=141624

Reviewed by Oliver Hunt.

This was an obvious omission from the original PutStackSinkingPhase. Previously, we would treat
GetStacks conservatively and assume that the stack slot escaped. That's pretty dumb, since a
GetStack is a local load of the stack. This change makes GetStack a no-op from the standpoint of
this phase's deferral analysis. At the end we either keep the GetStack (if there was no concrete
deferral) or we replace it with an identity over the value that would have been stored by the
deferred PutStack. Note that this might be a Phi that the phase creates, so this is strictly
stronger than what GCSE could do.

This is probably not a speed-up now, but it will be very useful for the varargs simplification
done in bug 141174.

  • dfg/DFGPutStackSinkingPhase.cpp:
Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r181486 r181487  
     12015-03-13  Filip Pizlo  <fpizlo@apple.com>
     2
     3        DFG::PutStackSinkingPhase should eliminate GetStacks that have an obviously known source
     4        https://bugs.webkit.org/show_bug.cgi?id=141624
     5
     6        Reviewed by Oliver Hunt.
     7       
     8        This was an obvious omission from the original PutStackSinkingPhase. Previously, we would treat
     9        GetStacks conservatively and assume that the stack slot escaped. That's pretty dumb, since a
     10        GetStack is a local load of the stack. This change makes GetStack a no-op from the standpoint of
     11        this phase's deferral analysis. At the end we either keep the GetStack (if there was no concrete
     12        deferral) or we replace it with an identity over the value that would have been stored by the
     13        deferred PutStack. Note that this might be a Phi that the phase creates, so this is strictly
     14        stronger than what GCSE could do.
     15       
     16        This is probably not a speed-up now, but it will be very useful for the varargs simplification
     17        done in bug 141174.
     18
     19        * dfg/DFGPutStackSinkingPhase.cpp:
     20
    1212015-03-12  Geoffrey Garen  <ggaren@apple.com>
    222
  • trunk/Source/JavaScriptCore/dfg/DFGPutStackSinkingPhase.cpp

    r180691 r181487  
    222222                    }
    223223                   
     224                    if (node->op() == GetStack) {
     225                        // A GetStack doesn't affect anything, since we know which local we are reading
     226                        // from.
     227                        continue;
     228                    }
     229                   
    224230                    auto escapeHandler = [&] (VirtualRegister operand) {
    225231                        if (operand.isHeader())
     
    391397                    break;
    392398                }
     399                   
     400                case GetStack: {
     401                    StackAccessData* data = node->stackAccessData();
     402                    FlushFormat format = deferred.operand(data->local);
     403                    if (!isConcrete(format)) {
     404                        // This means there is no deferral. No deferral means that the most
     405                        // authoritative value for this stack slot is what is stored in the stack. So,
     406                        // keep the GetStack.
     407                        break;
     408                    }
     409                   
     410                    // We have a concrete deferral, which means a PutStack that hasn't executed yet. It
     411                    // would have stored a value with a certain format. That format must match our
     412                    // format. But more importantly, we can simply use the value that the PutStack would
     413                    // have stored and get rid of the GetStack.
     414                    DFG_ASSERT(m_graph, node, format == data->format);
     415                   
     416                    Node* incoming = mapping.operand(data->local);
     417                    node->convertToIdentity();
     418                    node->child1() = incoming->defaultEdge();
     419                    break;
     420                }
    393421               
    394422                default: {
     
    419447                        m_graph, node, escapeHandler, escapeHandler,
    420448                        [&] (VirtualRegister, Node*) { });
    421                    
    422                     // If we're a GetStack, then we also create a mapping.
    423                     // FIXME: We should be able to just eliminate such GetLocals, when we know
    424                     // what their incoming value will be.
    425                     // https://bugs.webkit.org/show_bug.cgi?id=141624
    426                     if (node->op() == GetStack) {
    427                         StackAccessData* data = node->stackAccessData();
    428                         VirtualRegister operand = data->local;
    429                         mapping.operand(operand) = node;
    430                     }
    431449                    break;
    432450                } }
Note: See TracChangeset for help on using the changeset viewer.