Changeset 228073 in webkit


Ignore:
Timestamp:
Feb 4, 2018 9:30:44 PM (6 years ago)
Author:
jmarcell@apple.com
Message:

Cherry-pick r228031. rdar://problem/37220129

Location:
branches/safari-605-branch
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-605-branch/JSTests/ChangeLog

    r228068 r228073  
     12018-02-04  Jason Marcell  <jmarcell@apple.com>
     2
     3        Cherry-pick r228031. rdar://problem/37220129
     4
     5    2018-02-02  Saam Barati  <sbarati@apple.com>
     6
     7            When BytecodeParser inserts Unreachable after ForceOSRExit it needs to update ArgumentPositions for Flushes it inserts
     8            https://bugs.webkit.org/show_bug.cgi?id=182368
     9            <rdar://problem/36932466>
     10
     11            Reviewed by Mark Lam.
     12
     13            * stress/flush-after-force-exit-in-bytecodeparser-needs-to-update-argument-positions.js: Added.
     14            (runNearStackLimit.t):
     15            (runNearStackLimit):
     16            (try.runNearStackLimit):
     17            (catch):
     18
    1192018-02-04  Jason Marcell  <jmarcell@apple.com>
    220
  • branches/safari-605-branch/Source/JavaScriptCore/ChangeLog

    r228068 r228073  
     12018-02-04  Jason Marcell  <jmarcell@apple.com>
     2
     3        Cherry-pick r228031. rdar://problem/37220129
     4
     5    2018-02-02  Saam Barati  <sbarati@apple.com>
     6
     7            When BytecodeParser inserts Unreachable after ForceOSRExit it needs to update ArgumentPositions for Flushes it inserts
     8            https://bugs.webkit.org/show_bug.cgi?id=182368
     9            <rdar://problem/36932466>
     10
     11            Reviewed by Mark Lam.
     12
     13            When preserving liveness when inserting Unreachable nodes after ForceOSRExit,
     14            we must add the VariableAccessData to the given argument position. Otherwise,
     15            we may end up with a VariableAccessData that doesn't respect the shouldNeverUnbox bit.
     16            If we end up with such a situation, it can lead to invalid IR after the
     17            arguments elimination phase optimizes a GetByVal to a GetStack.
     18
     19            * dfg/DFGByteCodeParser.cpp:
     20            (JSC::DFG::ByteCodeParser::flushImpl):
     21            (JSC::DFG::ByteCodeParser::flushForTerminalImpl):
     22            (JSC::DFG::ByteCodeParser::flush):
     23            (JSC::DFG::ByteCodeParser::flushForTerminal):
     24            (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
     25            (JSC::DFG::ByteCodeParser::parse):
     26
    1272018-02-04  Jason Marcell  <jmarcell@apple.com>
    228
  • branches/safari-605-branch/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r227653 r228073  
    526526            numArguments = inlineCallFrame->argumentsWithFixup.size();
    527527            if (inlineCallFrame->isClosureCall)
    528                 addFlushDirect(remapOperand(inlineCallFrame, VirtualRegister(CallFrameSlot::callee)));
     528                addFlushDirect(inlineCallFrame, remapOperand(inlineCallFrame, VirtualRegister(CallFrameSlot::callee)));
    529529            if (inlineCallFrame->isVarargs())
    530                 addFlushDirect(remapOperand(inlineCallFrame, VirtualRegister(CallFrameSlot::argumentCount)));
     530                addFlushDirect(inlineCallFrame, remapOperand(inlineCallFrame, VirtualRegister(CallFrameSlot::argumentCount)));
    531531        } else
    532532            numArguments = m_graph.baselineCodeBlockFor(inlineCallFrame)->numParameters();
    533533
    534534        for (unsigned argument = numArguments; argument--;)
    535             addFlushDirect(remapOperand(inlineCallFrame, virtualRegisterForArgument(argument)));
     535            addFlushDirect(inlineCallFrame, remapOperand(inlineCallFrame, virtualRegisterForArgument(argument)));
    536536
    537537        if (m_graph.needsScopeRegister())
    538             addFlushDirect(m_graph.m_codeBlock->scopeRegister());
     538            addFlushDirect(nullptr, m_graph.m_codeBlock->scopeRegister());
    539539    }
    540540
     
    554554                for (unsigned local = codeBlock->m_numCalleeLocals; local--;) {
    555555                    if (livenessAtBytecode[local])
    556                         addPhantomLocalDirect(remapOperand(inlineCallFrame, virtualRegisterForLocal(local)));
     556                        addPhantomLocalDirect(inlineCallFrame, remapOperand(inlineCallFrame, virtualRegisterForLocal(local)));
    557557                }
    558558            });
     
    601601    void flush(InlineStackEntry* inlineStackEntry)
    602602    {
    603         auto addFlushDirect = [&] (VirtualRegister reg) { flushDirect(reg); };
     603        auto addFlushDirect = [&] (InlineCallFrame*, VirtualRegister reg) { flushDirect(reg); };
    604604        flushImpl(inlineStackEntry->m_inlineCallFrame, addFlushDirect);
    605605    }
     
    607607    void flushForTerminal()
    608608    {
    609         auto addFlushDirect = [&] (VirtualRegister reg) { flushDirect(reg); };
    610         auto addPhantomLocalDirect = [&] (VirtualRegister reg) { phantomLocalDirect(reg); };
     609        auto addFlushDirect = [&] (InlineCallFrame*, VirtualRegister reg) { flushDirect(reg); };
     610        auto addPhantomLocalDirect = [&] (InlineCallFrame*, VirtualRegister reg) { phantomLocalDirect(reg); };
    611611        flushForTerminalImpl(currentCodeOrigin(), addFlushDirect, addPhantomLocalDirect);
    612612    }
     
    10261026    FrozenValue* m_constantOne;
    10271027    Vector<Node*, 16> m_constants;
     1028
     1029    HashMap<InlineCallFrame*, Vector<ArgumentPosition*>, WTF::DefaultHash<InlineCallFrame*>::Hash, WTF::NullableHashTraits<InlineCallFrame*>> m_inlineCallFrameToArgumentPositions;
    10281030
    10291031    // The number of arguments passed to the function.
     
    63996401   
    64006402    int argumentCountIncludingThisWithFixup = std::max<int>(argumentCountIncludingThis, codeBlock->numParameters());
    6401     m_argumentPositions.resize(argumentCountIncludingThisWithFixup);
    6402     for (int i = 0; i < argumentCountIncludingThisWithFixup; ++i) {
    6403         byteCodeParser->m_graph.m_argumentPositions.append(ArgumentPosition());
    6404         ArgumentPosition* argumentPosition = &byteCodeParser->m_graph.m_argumentPositions.last();
    6405         m_argumentPositions[i] = argumentPosition;
    6406     }
    6407    
     6403
    64086404    if (m_caller) {
    64096405        // Inline case.
     
    64566452    }
    64576453   
     6454    m_argumentPositions.resize(argumentCountIncludingThisWithFixup);
     6455    for (int i = 0; i < argumentCountIncludingThisWithFixup; ++i) {
     6456        byteCodeParser->m_graph.m_argumentPositions.append(ArgumentPosition());
     6457        ArgumentPosition* argumentPosition = &byteCodeParser->m_graph.m_argumentPositions.last();
     6458        m_argumentPositions[i] = argumentPosition;
     6459    }
     6460    byteCodeParser->m_inlineCallFrameToArgumentPositions.add(m_inlineCallFrame, m_argumentPositions);
     6461   
    64586462    byteCodeParser->m_inlineStackTop = this;
    64596463}
     
    66066610                    insertionSet.insertNode(block->size(), SpecNone, ExitOK, endOrigin);
    66076611
    6608                     auto insertLivenessPreservingOp = [&] (NodeType op, VirtualRegister operand) {
     6612                    auto insertLivenessPreservingOp = [&] (InlineCallFrame* inlineCallFrame, NodeType op, VirtualRegister operand) {
    66096613                        VariableAccessData* variable = mapping.operand(operand);
    66106614                        if (!variable) {
     
    66126616                            mapping.operand(operand) = variable;
    66136617                        }
     6618
     6619                        VirtualRegister argument = operand - (inlineCallFrame ? inlineCallFrame->stackOffset : 0);
     6620                        if (argument.isArgument() && !argument.isHeader()) {
     6621                            const Vector<ArgumentPosition*>& arguments = m_inlineCallFrameToArgumentPositions.get(inlineCallFrame);
     6622                            arguments[argument.toArgument()]->addVariable(variable);
     6623                        }
     6624
    66146625                        insertionSet.insertNode(block->size(), SpecNone, op, endOrigin, OpInfo(variable));
    66156626                    };
    6616                     auto addFlushDirect = [&] (VirtualRegister operand) { insertLivenessPreservingOp(Flush, operand); };
    6617                     auto addPhantomLocalDirect = [&] (VirtualRegister operand) { insertLivenessPreservingOp(PhantomLocal, operand); };
    6618 
     6627                    auto addFlushDirect = [&] (InlineCallFrame* inlineCallFrame, VirtualRegister operand) {
     6628                        insertLivenessPreservingOp(inlineCallFrame, Flush, operand);
     6629                    };
     6630                    auto addPhantomLocalDirect = [&] (InlineCallFrame* inlineCallFrame, VirtualRegister operand) {
     6631                        insertLivenessPreservingOp(inlineCallFrame, PhantomLocal, operand);
     6632                    };
    66196633                    flushForTerminalImpl(endOrigin.semantic, addFlushDirect, addPhantomLocalDirect);
    66206634
Note: See TracChangeset for help on using the changeset viewer.