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/DFGValueSource.h

    r140619 r140904  
    11/*
    2  * Copyright (C) 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2011, 2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3232
    3333#include "DFGCommon.h"
     34#include "DFGMinifiedID.h"
    3435#include "DataFormat.h"
    3536#include "SpeculatedType.h"
     
    109110public:
    110111    ValueSource()
    111         : m_nodeIndex(nodeIndexFromKind(SourceNotSet))
     112        : m_value(idFromKind(SourceNotSet))
    112113    {
    113114    }
    114115   
    115116    explicit ValueSource(ValueSourceKind valueSourceKind)
    116         : m_nodeIndex(nodeIndexFromKind(valueSourceKind))
     117        : m_value(idFromKind(valueSourceKind))
    117118    {
    118119        ASSERT(kind() != SourceNotSet);
     
    120121    }
    121122   
    122     explicit ValueSource(NodeIndex nodeIndex)
    123         : m_nodeIndex(nodeIndex)
    124     {
    125         RELEASE_ASSERT(nodeIndex != NoNode);
     123    explicit ValueSource(MinifiedID id)
     124        : m_value(id.m_id)
     125    {
     126        ASSERT(!!id);
    126127        ASSERT(kind() == HaveNode);
    127128    }
     
    145146    bool isSet() const
    146147    {
    147         return kindFromNodeIndex(m_nodeIndex) != SourceNotSet;
     148        return kindFromID(m_value) != SourceNotSet;
    148149    }
    149150   
    150151    ValueSourceKind kind() const
    151152    {
    152         return kindFromNodeIndex(m_nodeIndex);
     153        return kindFromID(m_value);
    153154    }
    154155   
     
    192193    }
    193194   
    194     NodeIndex nodeIndex() const
     195    MinifiedID id() const
    195196    {
    196197        ASSERT(kind() == HaveNode);
    197         return m_nodeIndex;
    198     }
    199    
    200     void dump(FILE* out) const;
     198        return m_value;
     199    }
     200   
     201    void dump(PrintStream&) const;
    201202   
    202203private:
    203     static NodeIndex nodeIndexFromKind(ValueSourceKind kind)
     204    static MinifiedID idFromKind(ValueSourceKind kind)
    204205    {
    205206        ASSERT(kind >= SourceNotSet && kind < HaveNode);
    206         return NoNode - kind;
    207     }
    208    
    209     static ValueSourceKind kindFromNodeIndex(NodeIndex nodeIndex)
    210     {
    211         unsigned kind = static_cast<unsigned>(NoNode - nodeIndex);
    212         if (kind >= static_cast<unsigned>(HaveNode))
     207        return MinifiedID::fromBits(MinifiedID::invalidID() - kind);
     208    }
     209   
     210    static ValueSourceKind kindFromID(MinifiedID id)
     211    {
     212        uintptr_t kind = static_cast<uintptr_t>(MinifiedID::invalidID() - id.m_id);
     213        if (kind >= static_cast<uintptr_t>(HaveNode))
    213214            return HaveNode;
    214215        return static_cast<ValueSourceKind>(kind);
    215216    }
    216217   
    217     NodeIndex m_nodeIndex;
     218    MinifiedID m_value;
    218219};
    219220
Note: See TracChangeset for help on using the changeset viewer.