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


Ignore:
Timestamp:
Jul 28, 2014, 1:41:09 PM (11 years ago)
Author:
[email protected]
Message:

Make sure that we don't use non-speculative BooleanToNumber for a speculative Branch
https://bugs.webkit.org/show_bug.cgi?id=135350
<rdar://problem/17509889>

Reviewed by Mark Hahnenberg and Oliver Hunt.

If we have an exiting node that uses a conversion node, then that exiting node
needs to have a Phantom after it for the the original node. But we can't do that
for Branch because https://bugs.webkit.org/show_bug.cgi?id=126778.

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):
(JSC::DFG::FixupPhase::clearPhantomsAtEnd):

  • tests/stress/branch-check-int32-on-boolean-to-number-untyped.js: Added.

(foo):
(test):

  • tests/stress/branch-check-number-on-boolean-to-number-untyped.js: Added.

(foo):
(test):

File:
1 edited

Legend:

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

    r171660 r171689  
    709709            else if (node->child1()->shouldSpeculateObjectOrOther())
    710710                fixEdge<ObjectOrOtherUse>(node->child1());
    711             else if (node->child1()->shouldSpeculateInt32OrBoolean())
    712                 fixIntOrBooleanEdge(node->child1());
    713             else if (node->child1()->shouldSpeculateNumberOrBoolean())
    714                 fixDoubleOrBooleanEdge(node->child1());
     711            // FIXME: We should just be able to do shouldSpeculateInt32OrBoolean() and
     712            // shouldSpeculateNumberOrBoolean() here, but we can't because then the Branch
     713            // could speculate on the result of a non-speculative conversion node.
     714            // https://bugs.webkit.org/show_bug.cgi?id=126778
     715            else if (node->child1()->shouldSpeculateInt32())
     716                fixEdge<Int32Use>(node->child1());
     717            else if (node->child1()->shouldSpeculateNumber())
     718                fixEdge<DoubleRepUse>(node->child1());
    715719            break;
    716720        }
     
    19821986        // Terminal nodes don't need post-phantoms, and inserting them would violate
    19831987        // the current requirement that a terminal is the last thing in a block. We
    1984         // should eventually change that requirement but even if we did, this would
    1985         // still be a valid optimization. All terminals accept just one input, and
    1986         // if that input is a conversion node then no further speculations will be
    1987         // performed.
    1988        
     1988        // should eventually change that requirement. Currently we get around this by
     1989        // ensuring that all terminals accept just one input, and if that input is a
     1990        // conversion node then no further speculations will be performed. See
     1991        // references to the bug, below, for places where we have to have hacks to
     1992        // work around this.
    19891993        // FIXME: Get rid of this by allowing Phantoms after terminals.
    19901994        // https://bugs.webkit.org/show_bug.cgi?id=126778
Note: See TracChangeset for help on using the changeset viewer.