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

Changeset 271034 in webkit


Ignore:
Timestamp:
Dec 21, 2020, 11:54:14 AM (6 years ago)
Author:
keith_miller@apple.com
Message:

DFG should make sure replacement watchpoint is fired before folding to PutByOffset
https://bugs.webkit.org/show_bug.cgi?id=220031
<rdar://72045350>

Reviewed by Saam Barati.

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::presenceConditionIfConsistent):
(JSC::DFG::ByteCodeParser::checkPresence):
(JSC::DFG::ByteCodeParser::checkPresenceForReplace):
(JSC::DFG::ByteCodeParser::load):
(JSC::DFG::ByteCodeParser::store):
(JSC::DFG::ByteCodeParser::presenceLike): Deleted.
(JSC::DFG::ByteCodeParser::checkPresenceLike): Deleted.

  • dfg/DFGConstantFoldingPhase.cpp:

(JSC::DFG::ConstantFoldingPhase::tryFoldAsPutByOffset):

  • runtime/Structure.cpp:

(JSC::Structure::dump const):

Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r270993 r271034  
     12020-12-21  Keith Miller  <keith_miller@apple.com>
     2
     3        DFG should make sure replacement watchpoint is fired before folding to PutByOffset
     4        https://bugs.webkit.org/show_bug.cgi?id=220031
     5        <rdar://72045350>
     6
     7        Reviewed by Saam Barati.
     8
     9        * dfg/DFGByteCodeParser.cpp:
     10        (JSC::DFG::ByteCodeParser::presenceConditionIfConsistent):
     11        (JSC::DFG::ByteCodeParser::checkPresence):
     12        (JSC::DFG::ByteCodeParser::checkPresenceForReplace):
     13        (JSC::DFG::ByteCodeParser::load):
     14        (JSC::DFG::ByteCodeParser::store):
     15        (JSC::DFG::ByteCodeParser::presenceLike): Deleted.
     16        (JSC::DFG::ByteCodeParser::checkPresenceLike): Deleted.
     17        * dfg/DFGConstantFoldingPhase.cpp:
     18        (JSC::DFG::ConstantFoldingPhase::tryFoldAsPutByOffset):
     19        * runtime/Structure.cpp:
     20        (JSC::Structure::dump const):
     21
    1222020-12-18  Mark Lam  <mark.lam@apple.com>
    223
  • trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r270874 r271034  
    228228    // Create a presence ObjectPropertyCondition based on some known offset and structure set. Does not
    229229    // check the validity of the condition, but it may return a null one if it encounters a contradiction.
    230     ObjectPropertyCondition presenceLike(
     230    ObjectPropertyCondition presenceConditionIfConsistent(
    231231        JSObject* knownBase, UniquedStringImpl*, PropertyOffset, const StructureSet&);
    232232   
     
    234234    // way as in all of the structures in the set. It may emit code instead of just setting a watchpoint.
    235235    // Returns true if this all works out.
    236     bool checkPresenceLike(JSObject* knownBase, UniquedStringImpl*, PropertyOffset, const StructureSet&);
    237     void checkPresenceLike(Node* base, UniquedStringImpl*, PropertyOffset, const StructureSet&);
     236    bool checkPresence(JSObject* knownBase, UniquedStringImpl*, PropertyOffset, const StructureSet&);
     237    void checkPresenceForReplace(Node* base, UniquedStringImpl*, PropertyOffset, const StructureSet&);
    238238   
    239239    // Works with both GetByIdVariant and the setter form of PutByIdVariant.
     
    43874387}
    43884388
    4389 ObjectPropertyCondition ByteCodeParser::presenceLike(
     4389ObjectPropertyCondition ByteCodeParser::presenceConditionIfConsistent(
    43904390    JSObject* knownBase, UniquedStringImpl* uid, PropertyOffset offset, const StructureSet& set)
    43914391{
     
    44054405}
    44064406
    4407 bool ByteCodeParser::checkPresenceLike(
     4407bool ByteCodeParser::checkPresence(
    44084408    JSObject* knownBase, UniquedStringImpl* uid, PropertyOffset offset, const StructureSet& set)
    44094409{
    4410     return check(presenceLike(knownBase, uid, offset, set));
     4410    return check(presenceConditionIfConsistent(knownBase, uid, offset, set));
    44114411}
    44124412
    4413 void ByteCodeParser::checkPresenceLike(
     4413void ByteCodeParser::checkPresenceForReplace(
    44144414    Node* base, UniquedStringImpl* uid, PropertyOffset offset, const StructureSet& set)
    44154415{
    44164416    if (JSObject* knownBase = base->dynamicCastConstant<JSObject*>(*m_vm)) {
    4417         if (checkPresenceLike(knownBase, uid, offset, set))
     4417        auto condition = presenceConditionIfConsistent(knownBase, uid, offset, set);
     4418        if (check(condition)) {
     4419            auto* watchpointSet = knownBase->structure(*m_vm)->propertyReplacementWatchpointSet(condition.offset());
     4420            // This means that we probably have a stale cache and we should gather more information.
     4421            if (!watchpointSet || watchpointSet->isStillValid())
     4422                addToGraph(ForceOSRExit);
    44184423            return;
     4424        }
    44194425    }
    44204426
     
    44694475
    44704476                ObjectPropertyCondition presenceCondition =
    4471                     presenceLike(knownBase, uid, variant.offset(), variant.structureSet());
     4477                    presenceConditionIfConsistent(knownBase, uid, variant.offset(), variant.structureSet());
    44724478                if (presenceCondition) {
    44734479                    ObjectPropertyCondition equivalenceCondition =
     
    45264532    RELEASE_ASSERT(variant.kind() == PutByIdVariant::Replace);
    45274533
    4528     checkPresenceLike(base, m_graph.identifiers()[identifier], variant.offset(), variant.structure());
     4534    checkPresenceForReplace(base, m_graph.identifiers()[identifier], variant.offset(), variant.structure());
    45294535    return handlePutByOffset(base, identifier, variant.offset(), value);
    45304536}
  • trunk/Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp

    r268794 r271034  
    14281428                    return;
    14291429
     1430                if (variant.kind() == PutByIdVariant::Replace) {
     1431                    auto* watchpoints = structure->propertyReplacementWatchpointSet(condition.offset());
     1432                    if (!watchpoints || watchpoints->isStillValid())
     1433                        return;
     1434                }
     1435
    14301436                m_insertionSet.insertNode(
    14311437                    indexInBlock, SpecNone, CheckStructure, node->origin,
  • trunk/Source/JavaScriptCore/runtime/Structure.cpp

    r267040 r271034  
    14091409        out.print(", Shady leaf");
    14101410   
     1411    if (transitionWatchpointSet().isBeingWatched())
     1412        out.print(" (Watched)");
     1413
    14111414    out.print("]");
    14121415}
Note: See TracChangeset for help on using the changeset viewer.