Ignore:
Timestamp:
Aug 31, 2018, 12:45:02 AM (7 years ago)
Author:
[email protected]
Message:

convertToRegExpMatchFastGlobal must use KnownString as the child use kind
https://bugs.webkit.org/show_bug.cgi?id=189173
<rdar://problem/43501645>

Reviewed by Michael Saboff.

JSTests:

  • stress/may-exit-should-be-false-regexp-constant-folding.js: Added.

(foo):
(bar):

Source/JavaScriptCore:

We were crashing during validation because mayExit returned true
at a point in the program when we weren't allowed to exit.

The issue was is in StrengthReduction: we end up emitting code that
had a StringUse on an edge after a node that did side effects and before
an ExitOK/bytecode number transition. However, StrenghReduction did the
right thing here and also emitted the type checks before the node with
side effects. It just did bad bookkeeping. The node we convert to needs
to use KnownStringUse instead of StringUse for the child edge.

  • dfg/DFGNode.cpp:

(JSC::DFG::Node::convertToRegExpExecNonGlobalOrStickyWithoutChecks):
(JSC::DFG::Node::convertToRegExpMatchFastGlobalWithoutChecks):
(JSC::DFG::Node::convertToRegExpExecNonGlobalOrSticky): Deleted.
(JSC::DFG::Node::convertToRegExpMatchFastGlobal): Deleted.

  • dfg/DFGNode.h:
  • dfg/DFGStrengthReductionPhase.cpp:

(JSC::DFG::StrengthReductionPhase::handleNode):

File:
1 edited

Legend:

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

    r232000 r235538  
    269269}
    270270
    271 void Node::convertToRegExpExecNonGlobalOrSticky(FrozenValue* regExp)
     271void Node::convertToRegExpExecNonGlobalOrStickyWithoutChecks(FrozenValue* regExp)
    272272{
    273273    ASSERT(op() == RegExpExec);
    274274    setOpAndDefaultFlags(RegExpExecNonGlobalOrSticky);
    275275    children.child1() = Edge(children.child1().node(), KnownCellUse);
    276     children.child2() = Edge(children.child3().node(), StringUse);
     276    children.child2() = Edge(children.child3().node(), KnownStringUse);
    277277    children.child3() = Edge();
    278278    m_opInfo = regExp;
    279279}
    280280
    281 void Node::convertToRegExpMatchFastGlobal(FrozenValue* regExp)
     281void Node::convertToRegExpMatchFastGlobalWithoutChecks(FrozenValue* regExp)
    282282{
    283283    ASSERT(op() == RegExpMatchFast);
    284284    setOpAndDefaultFlags(RegExpMatchFastGlobal);
    285285    children.child1() = Edge(children.child1().node(), KnownCellUse);
    286     children.child2() = Edge(children.child3().node(), StringUse);
     286    children.child2() = Edge(children.child3().node(), KnownStringUse);
    287287    children.child3() = Edge();
    288288    m_opInfo = regExp;
Note: See TracChangeset for help on using the changeset viewer.