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

Changeset 100221 in webkit


Ignore:
Timestamp:
Nov 14, 2011, 5:22:52 PM (15 years ago)
Author:
fpizlo@apple.com
Message:

DFG's inline references to objects should be tracked
https://bugs.webkit.org/show_bug.cgi?id=72313

Reviewed by Gavin Barraclough.

Added a pinCell() method in the parser that currently creates a
dummy constant in CodeBlock. Added calls to pinCell() wherever the
DFG would inline a constant reference that the original code would
not have referred to.

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::getCellConstantIndex):
(JSC::DFG::ByteCodeParser::pinCell):
(JSC::DFG::ByteCodeParser::cellConstant):
(JSC::DFG::ByteCodeParser::handleCall):
(JSC::DFG::ByteCodeParser::handleInlining):
(JSC::DFG::ByteCodeParser::parseBlock):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r100219 r100221  
     12011-11-14  Filip Pizlo  <fpizlo@apple.com>
     2
     3        DFG's inline references to objects should be tracked
     4        https://bugs.webkit.org/show_bug.cgi?id=72313
     5
     6        Reviewed by Gavin Barraclough.
     7       
     8        Added a pinCell() method in the parser that currently creates a
     9        dummy constant in CodeBlock. Added calls to pinCell() wherever the
     10        DFG would inline a constant reference that the original code would
     11        not have referred to.
     12       
     13        * dfg/DFGByteCodeParser.cpp:
     14        (JSC::DFG::ByteCodeParser::getCellConstantIndex):
     15        (JSC::DFG::ByteCodeParser::pinCell):
     16        (JSC::DFG::ByteCodeParser::cellConstant):
     17        (JSC::DFG::ByteCodeParser::handleCall):
     18        (JSC::DFG::ByteCodeParser::handleInlining):
     19        (JSC::DFG::ByteCodeParser::parseBlock):
     20
    1212011-11-14  Filip Pizlo  <fpizlo@apple.com>
    222
  • trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r100219 r100221  
    508508    }
    509509   
    510     NodeIndex cellConstant(JSCell* cell)
     510    unsigned getCellConstantIndex(JSCell* cell)
    511511    {
    512512        HashMap<JSCell*, unsigned>::iterator iter = m_cellConstants.find(cell);
    513513        if (iter != m_cellConstants.end())
    514             return getJSConstant(iter->second);
     514            return iter->second;
    515515       
    516516        m_codeBlock->addConstant(cell);
     
    520520        m_cellConstants.add(cell, m_codeBlock->numberOfConstantRegisters() - 1);
    521521       
    522         return getJSConstant(m_codeBlock->numberOfConstantRegisters() - 1);
     522        return m_codeBlock->numberOfConstantRegisters() - 1;
     523    }
     524   
     525    void pinCell(JSCell* cell)
     526    {
     527        if (!cell)
     528            return;
     529        getCellConstantIndex(cell);
     530    }
     531   
     532    NodeIndex cellConstant(JSCell* cell)
     533    {
     534        return getJSConstant(getCellConstantIndex(cell));
    523535    }
    524536   
     
    922934               
    923935        if (intrinsic != NoIntrinsic) {
    924             if (!certainAboutExpectedFunction)
     936            if (!certainAboutExpectedFunction) {
     937                pinCell(expectedFunction);
    925938                addToGraph(CheckFunction, OpInfo(expectedFunction), callTarget);
     939            }
    926940           
    927941            if (handleIntrinsic(usesResult, resultOperand, intrinsic, firstArg, lastArg, prediction)) {
     
    9901004    // by checking the callee (if necessary) and making sure that arguments and the callee
    9911005    // are flushed.
    992     if (!certainAboutExpectedFunction)
     1006    if (!certainAboutExpectedFunction) {
     1007        pinCell(expectedFunction);
    9931008        addToGraph(CheckFunction, OpInfo(expectedFunction), callTargetNodeIndex);
     1009    }
    9941010   
    9951011    // FIXME: Don't flush constants!
     
    16521668                // It's monomorphic as far as we can tell, since the method_check was linked
    16531669                // but the slow path (i.e. the normal get_by_id) never fired.
     1670
     1671                pinCell(methodCall.cachedStructure.get());
     1672                pinCell(methodCall.cachedPrototypeStructure.get());
     1673                pinCell(methodCall.cachedFunction.get());
     1674                pinCell(methodCall.cachedPrototype.get());
    16541675           
    16551676                NodeIndex checkMethod = addToGraph(CheckMethod, OpInfo(identifier), OpInfo(m_graph.m_methodCheckData.size()), base);
     
    17621783                    addToGraph(ForceOSRExit);
    17631784               
     1785                for (unsigned i = 0; i < structureSet.size(); ++i)
     1786                    pinCell(structureSet[i]);
     1787               
    17641788                addToGraph(CheckStructure, OpInfo(m_graph.addStructureSet(structureSet)), base);
    17651789                set(currentInstruction[1].u.operand, addToGraph(GetByOffset, OpInfo(m_graph.m_storageAccessData.size()), OpInfo(prediction), addToGraph(GetPropertyStorage, base)));
     
    17951819                   
    17961820                    if (offset != notFound) {
     1821                        pinCell(structure);
    17971822                        addToGraph(CheckStructure, OpInfo(m_graph.addStructureSet(structure)), base);
    17981823                        addToGraph(PutByOffset, OpInfo(m_graph.m_storageAccessData.size()), base, addToGraph(GetPropertyStorage, base), value);
     
    18211846                   
    18221847                    if (offset != notFound && structureChainIsStillValid(direct, previousStructure, structureChain)) {
     1848                        pinCell(previousStructure);
     1849                        pinCell(newStructure);
    18231850                        addToGraph(CheckStructure, OpInfo(m_graph.addStructureSet(previousStructure)), base);
    18241851                        if (!direct) {
    1825                             if (!previousStructure->storedPrototype().isNull())
     1852                            if (!previousStructure->storedPrototype().isNull()) {
     1853                                pinCell(previousStructure->storedPrototype().asCell()->structure());
     1854                                pinCell(previousStructure->storedPrototype().asCell());
    18261855                                addToGraph(CheckStructure, OpInfo(m_graph.addStructureSet(previousStructure->storedPrototype().asCell()->structure())), cellConstant(previousStructure->storedPrototype().asCell()));
     1856                            }
    18271857                           
    18281858                            for (WriteBarrier<Structure>* it = structureChain->head(); *it; ++it) {
     
    18311861                                    continue;
    18321862                                ASSERT(prototype.isCell());
     1863                                pinCell(prototype.asCell());
     1864                                pinCell(prototype.asCell()->structure());
    18331865                                addToGraph(CheckStructure, OpInfo(m_graph.addStructureSet(prototype.asCell()->structure())), cellConstant(prototype.asCell()));
    18341866                            }
Note: See TracChangeset for help on using the changeset viewer.