Ignore:
Timestamp:
Jun 17, 2012, 6:59:18 PM (13 years ago)
Author:
[email protected]
Message:

DFG should attempt to use structure watchpoints for all inlined get_by_id's and put_by_id's
https://bugs.webkit.org/show_bug.cgi?id=89316

Reviewed by Oliver Hunt.

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::addStructureTransitionCheck):
(ByteCodeParser):
(JSC::DFG::ByteCodeParser::handleGetById):
(JSC::DFG::ByteCodeParser::parseBlock):

File:
1 edited

Legend:

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

    r120499 r120556  
    751751    }
    752752   
    753     void addStructureTransitionCheck(JSCell* object, Structure* structure)
     753    NodeIndex addStructureTransitionCheck(JSCell* object, Structure* structure)
    754754    {
    755755        // Add a weak JS constant for the object regardless, since the code should
     
    759759        if (object->structure() == structure && structure->transitionWatchpointSetIsStillValid()) {
    760760            addToGraph(StructureTransitionWatchpoint, OpInfo(structure), objectIndex);
    761             return;
     761            return objectIndex;
    762762        }
    763763       
    764764        addToGraph(CheckStructure, OpInfo(m_graph.addStructureSet(structure)), objectIndex);
     765       
     766        return objectIndex;
     767    }
     768   
     769    NodeIndex addStructureTransitionCheck(JSCell* object)
     770    {
     771        return addStructureTransitionCheck(object, object->structure());
    765772    }
    766773   
     
    15921599            currentObject = asObject(currentStructure->prototypeForLookup(m_inlineStackTop->m_codeBlock));
    15931600            currentStructure = getByIdStatus.chain()[i];
    1594             base = addToGraph(WeakJSConstant, OpInfo(currentObject));
    1595             addToGraph(CheckStructure, OpInfo(m_graph.addStructureSet(currentStructure)), base);
     1601            base = addStructureTransitionCheck(currentObject, currentStructure);
    15961602        }
    15971603        useInlineStorage = currentStructure->isUsingInlineStorage();
     
    16111617        ASSERT(getByIdStatus.specificValue().isCell());
    16121618       
    1613         set(destinationOperand,
    1614             addToGraph(WeakJSConstant, OpInfo(getByIdStatus.specificValue().asCell())));
     1619        set(destinationOperand, cellConstant(getByIdStatus.specificValue().asCell()));
    16151620        return;
    16161621    }
     
    22112216                addToGraph(CheckStructure, OpInfo(m_graph.addStructureSet(putByIdStatus.oldStructure())), base);
    22122217                if (!direct) {
    2213                     if (!putByIdStatus.oldStructure()->storedPrototype().isNull())
    2214                         addToGraph(
    2215                             CheckStructure,
    2216                             OpInfo(m_graph.addStructureSet(putByIdStatus.oldStructure()->storedPrototype().asCell()->structure())),
    2217                             cellConstant(putByIdStatus.oldStructure()->storedPrototype().asCell()));
     2218                    if (!putByIdStatus.oldStructure()->storedPrototype().isNull()) {
     2219                        addStructureTransitionCheck(
     2220                            putByIdStatus.oldStructure()->storedPrototype().asCell());
     2221                    }
    22182222                   
    22192223                    for (WriteBarrier<Structure>* it = putByIdStatus.structureChain()->head(); *it; ++it) {
     
    22222226                            continue;
    22232227                        ASSERT(prototype.isCell());
    2224                         addToGraph(
    2225                             CheckStructure,
    2226                             OpInfo(m_graph.addStructureSet(prototype.asCell()->structure())),
    2227                             cellConstant(prototype.asCell()));
     2228                        addStructureTransitionCheck(prototype.asCell());
    22282229                    }
    22292230                }
     
    23222323            JSValue specificValue = globalObject->registerAt(entry.getIndex()).get();
    23232324            ASSERT(specificValue.isCell());
    2324             set(currentInstruction[1].u.operand,
    2325                 addToGraph(WeakJSConstant, OpInfo(specificValue.asCell())));
     2325            set(currentInstruction[1].u.operand, cellConstant(specificValue.asCell()));
    23262326           
    23272327            NEXT_OPCODE(op_get_global_var_watchable);
Note: See TracChangeset for help on using the changeset viewer.