Ignore:
Timestamp:
Jan 25, 2013, 10:07:23 PM (13 years ago)
Author:
[email protected]
Message:

DFG variable event stream shouldn't use NodeIndex
https://bugs.webkit.org/show_bug.cgi?id=107996

Reviewed by Oliver Hunt.

Introduce the notion of a DFG::MinifiedID, which is just a unique ID of a DFG Node.
Internally it currently uses a NodeIndex, but we could change this without having
to recode all of the users of MinifiedID. This effectively decouples the OSR exit
compiler's way of identifying nodes from the speculative JIT's way of identifying
nodes, and should make it easier to make changes to the speculative JIT's internals
in the future.

Also changed variable event stream logging to exclude information about births and
deaths of constants, since the OSR exit compiler never cares about which register
holds a constant; if a value is constant then the OSR exit compiler can reify it.

Also changed the variable event stream's value recovery computation to use a
HashMap keyed by MinifiedID rather than a Vector indexed by NodeIndex.

This appears to be performance-neutral. It's primarily meant as a small step
towards https://bugs.webkit.org/show_bug.cgi?id=106868.

  • GNUmakefile.list.am:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • dfg/DFGGenerationInfo.h:

(JSC::DFG::GenerationInfo::GenerationInfo):
(JSC::DFG::GenerationInfo::initConstant):
(JSC::DFG::GenerationInfo::initInteger):
(JSC::DFG::GenerationInfo::initJSValue):
(JSC::DFG::GenerationInfo::initCell):
(JSC::DFG::GenerationInfo::initBoolean):
(JSC::DFG::GenerationInfo::initDouble):
(JSC::DFG::GenerationInfo::initStorage):
(JSC::DFG::GenerationInfo::noticeOSRBirth):
(JSC::DFG::GenerationInfo::use):
(JSC::DFG::GenerationInfo::appendFill):
(JSC::DFG::GenerationInfo::appendSpill):
(GenerationInfo):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::link):

  • dfg/DFGMinifiedGraph.h:

(JSC::DFG::MinifiedGraph::at):
(MinifiedGraph):

  • dfg/DFGMinifiedID.h: Added.

(DFG):
(MinifiedID):
(JSC::DFG::MinifiedID::MinifiedID):
(JSC::DFG::MinifiedID::operator!):
(JSC::DFG::MinifiedID::nodeIndex):
(JSC::DFG::MinifiedID::operator==):
(JSC::DFG::MinifiedID::operator!=):
(JSC::DFG::MinifiedID::operator<):
(JSC::DFG::MinifiedID::operator>):
(JSC::DFG::MinifiedID::operator<=):
(JSC::DFG::MinifiedID::operator>=):
(JSC::DFG::MinifiedID::hash):
(JSC::DFG::MinifiedID::dump):
(JSC::DFG::MinifiedID::isHashTableDeletedValue):
(JSC::DFG::MinifiedID::invalidID):
(JSC::DFG::MinifiedID::otherInvalidID):
(JSC::DFG::MinifiedID::fromBits):
(JSC::DFG::MinifiedIDHash::hash):
(JSC::DFG::MinifiedIDHash::equal):
(MinifiedIDHash):
(WTF):

  • dfg/DFGMinifiedNode.cpp:

(JSC::DFG::MinifiedNode::fromNode):

  • dfg/DFGMinifiedNode.h:

(JSC::DFG::MinifiedNode::id):
(JSC::DFG::MinifiedNode::child1):
(JSC::DFG::MinifiedNode::getID):
(JSC::DFG::MinifiedNode::compareByNodeIndex):
(MinifiedNode):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileMovHint):
(JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::setNodeIndexForOperand):

  • dfg/DFGValueSource.cpp:

(JSC::DFG::ValueSource::dump):

  • dfg/DFGValueSource.h:

(JSC::DFG::ValueSource::ValueSource):
(JSC::DFG::ValueSource::isSet):
(JSC::DFG::ValueSource::kind):
(JSC::DFG::ValueSource::id):
(ValueSource):
(JSC::DFG::ValueSource::idFromKind):
(JSC::DFG::ValueSource::kindFromID):

  • dfg/DFGVariableEvent.cpp:

(JSC::DFG::VariableEvent::dump):
(JSC::DFG::VariableEvent::dumpFillInfo):
(JSC::DFG::VariableEvent::dumpSpillInfo):

  • dfg/DFGVariableEvent.h:

(JSC::DFG::VariableEvent::fillGPR):
(JSC::DFG::VariableEvent::fillPair):
(JSC::DFG::VariableEvent::fillFPR):
(JSC::DFG::VariableEvent::spill):
(JSC::DFG::VariableEvent::death):
(JSC::DFG::VariableEvent::movHint):
(JSC::DFG::VariableEvent::id):
(VariableEvent):

  • dfg/DFGVariableEventStream.cpp:

(DFG):
(JSC::DFG::VariableEventStream::tryToSetConstantRecovery):
(JSC::DFG::VariableEventStream::reconstruct):

  • dfg/DFGVariableEventStream.h:

(VariableEventStream):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGVariableEvent.h

    r135640 r140904  
    3232
    3333#include "DFGCommon.h"
     34#include "DFGMinifiedID.h"
    3435#include "DataFormat.h"
    3536#include "MacroAssembler.h"
     
    9697    }
    9798   
    98     static VariableEvent fillGPR(VariableEventKind kind, NodeIndex nodeIndex, MacroAssembler::RegisterID gpr, DataFormat dataFormat)
     99    static VariableEvent fillGPR(VariableEventKind kind, MinifiedID id, MacroAssembler::RegisterID gpr, DataFormat dataFormat)
    99100    {
    100101        ASSERT(kind == BirthToFill || kind == Fill);
     
    104105#endif
    105106        VariableEvent event;
    106         event.m_index = nodeIndex;
     107        event.m_id = id;
    107108        event.u.gpr = gpr;
    108109        event.m_kind = kind;
     
    112113   
    113114#if USE(JSVALUE32_64)
    114     static VariableEvent fillPair(VariableEventKind kind, NodeIndex nodeIndex, MacroAssembler::RegisterID tagGPR, MacroAssembler::RegisterID payloadGPR)
     115    static VariableEvent fillPair(VariableEventKind kind, MinifiedID id, MacroAssembler::RegisterID tagGPR, MacroAssembler::RegisterID payloadGPR)
    115116    {
    116117        ASSERT(kind == BirthToFill || kind == Fill);
    117118        VariableEvent event;
    118         event.m_index = nodeIndex;
     119        event.m_id = id;
    119120        event.u.pair.tagGPR = tagGPR;
    120121        event.u.pair.payloadGPR = payloadGPR;
     
    125126#endif // USE(JSVALUE32_64)
    126127   
    127     static VariableEvent fillFPR(VariableEventKind kind, NodeIndex nodeIndex, MacroAssembler::FPRegisterID fpr)
     128    static VariableEvent fillFPR(VariableEventKind kind, MinifiedID id, MacroAssembler::FPRegisterID fpr)
    128129    {
    129130        ASSERT(kind == BirthToFill || kind == Fill);
    130131        VariableEvent event;
    131         event.m_index = nodeIndex;
     132        event.m_id = id;
    132133        event.u.fpr = fpr;
    133134        event.m_kind = kind;
     
    136137    }
    137138   
    138     static VariableEvent spill(VariableEventKind kind, NodeIndex nodeIndex, VirtualRegister virtualRegister, DataFormat format)
     139    static VariableEvent spill(VariableEventKind kind, MinifiedID id, VirtualRegister virtualRegister, DataFormat format)
    139140    {
    140141        ASSERT(kind == BirthToSpill || kind == Spill);
    141142        VariableEvent event;
    142         event.m_index = nodeIndex;
     143        event.m_id = id;
    143144        event.u.virtualReg = virtualRegister;
    144145        event.m_kind = kind;
     
    147148    }
    148149   
    149     static VariableEvent death(NodeIndex nodeIndex)
    150     {
    151         VariableEvent event;
    152         event.m_index = nodeIndex;
     150    static VariableEvent death(MinifiedID id)
     151    {
     152        VariableEvent event;
     153        event.m_id = id;
    153154        event.m_kind = Death;
    154155        return event;
     
    164165    }
    165166   
    166     static VariableEvent movHint(NodeIndex nodeIndex, int operand)
    167     {
    168         VariableEvent event;
    169         event.m_index = nodeIndex;
     167    static VariableEvent movHint(MinifiedID id, int operand)
     168    {
     169        VariableEvent event;
     170        event.m_id = id;
    170171        event.u.virtualReg = operand;
    171172        event.m_kind = MovHint;
     
    178179    }
    179180   
    180     NodeIndex nodeIndex() const
     181    MinifiedID id() const
    181182    {
    182183        ASSERT(m_kind == BirthToFill || m_kind == Fill
    183184               || m_kind == BirthToSpill || m_kind == Spill
    184185               || m_kind == Death || m_kind == MovHint);
    185         return m_index;
     186        return m_id;
    186187    }
    187188   
     
    247248    void dumpSpillInfo(const char* name, PrintStream&) const;
    248249   
    249     NodeIndex m_index;
     250    MinifiedID m_id;
    250251   
    251252    // For BirthToFill, Fill:
Note: See TracChangeset for help on using the changeset viewer.