Ignore:
Timestamp:
Sep 14, 2017, 4:39:27 PM (8 years ago)
Author:
[email protected]
Message:

It should be valid to exit before each set when doing arity fixup when inlining
https://bugs.webkit.org/show_bug.cgi?id=176948

Reviewed by Keith Miller.

JSTests:

  • stress/arity-fixup-inlining-dont-generate-invalid-use.js: Added.

(baz):
(bar):
(foo):

Source/JavaScriptCore:

This patch makes it so that we can exit before each SetLocal when doing arity
fixup during inlining. This is OK because if we exit at any of these SetLocals,
we will simply exit to the beginning of the call instruction.

Not doing this led to a bug where FixupPhase would insert a ValueRep of
a node before the actual node. This is obviously invalid IR. I've added
a new validation rule to catch this malformed IR.

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::inliningCost):
(JSC::DFG::ByteCodeParser::inlineCall):

  • dfg/DFGValidate.cpp:
  • runtime/Options.h:
File:
1 edited

Legend:

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

    r222035 r222060  
    14571457    }
    14581458
    1459 
    14601459    if (!Options::useArityFixupInlining()) {
    14611460        if (codeBlock->numParameters() > argumentCountIncludingThis) {
     
    15831582        Node* undefined = addToGraph(JSConstant, OpInfo(m_constantUndefined));
    15841583        auto fill = [&] (VirtualRegister reg, Node* value) {
    1585             Node* result = set(reg, value, ImmediateNakedSet);
    1586             result->variableAccessData()->mergeShouldNeverUnbox(true); // We cannot exit after starting arity fixup.
     1584            // It's valid to exit here since we'll exit to the top of the
     1585            // call and re-setup the arguments.
     1586            m_exitOK = true;
     1587            addToGraph(ExitOK);
     1588
     1589            set(reg, value, ImmediateNakedSet);
    15871590        };
    15881591
Note: See TracChangeset for help on using the changeset viewer.