Ignore:
Timestamp:
Oct 19, 2012, 11:53:04 PM (13 years ago)
Author:
[email protected]
Message:

DFG should have some facility for recognizing redundant CheckArrays and Arrayifies
https://bugs.webkit.org/show_bug.cgi?id=99287

Reviewed by Mark Hahnenberg.

Adds reasoning about indexing type sets (i.e. ArrayModes) to AbstractValue, which
then enables us to fold away CheckArray's and Arrayify's that are redundant.

  • bytecode/ArrayProfile.cpp:

(JSC::arrayModesToString):
(JSC):

  • bytecode/ArrayProfile.h:

(JSC):
(JSC::mergeArrayModes):
(JSC::arrayModesAlreadyChecked):

  • bytecode/StructureSet.h:

(JSC::StructureSet::arrayModesFromStructures):
(StructureSet):

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::execute):

  • dfg/DFGAbstractValue.h:

(JSC::DFG::AbstractValue::AbstractValue):
(JSC::DFG::AbstractValue::clear):
(JSC::DFG::AbstractValue::isClear):
(JSC::DFG::AbstractValue::makeTop):
(JSC::DFG::AbstractValue::clobberStructures):
(AbstractValue):
(JSC::DFG::AbstractValue::setMostSpecific):
(JSC::DFG::AbstractValue::set):
(JSC::DFG::AbstractValue::operator==):
(JSC::DFG::AbstractValue::merge):
(JSC::DFG::AbstractValue::filter):
(JSC::DFG::AbstractValue::filterArrayModes):
(JSC::DFG::AbstractValue::validate):
(JSC::DFG::AbstractValue::checkConsistency):
(JSC::DFG::AbstractValue::dump):
(JSC::DFG::AbstractValue::clobberArrayModes):
(JSC::DFG::AbstractValue::clobberArrayModesSlow):
(JSC::DFG::AbstractValue::setFuturePossibleStructure):
(JSC::DFG::AbstractValue::filterFuturePossibleStructure):

  • dfg/DFGArrayMode.cpp:

(JSC::DFG::modeAlreadyChecked):

  • dfg/DFGArrayMode.h:

(JSC::DFG::arrayModesFor):
(DFG):

  • dfg/DFGConstantFoldingPhase.cpp:

(JSC::DFG::ConstantFoldingPhase::foldConstants):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::arrayify):

File:
1 edited

Legend:

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

    r131289 r131982  
    168168    case Array::PossiblyArrayWithContiguousToTail:
    169169    case Array::PossiblyArrayWithContiguousOutOfBounds:
     170    case Array::ToContiguous:
     171        if (arrayModesAlreadyChecked(value.m_arrayModes, asArrayModes(NonArrayWithContiguous) | asArrayModes(ArrayWithContiguous)))
     172            return true;
    170173        return value.m_currentKnownStructure.hasSingleton()
    171174            && hasContiguous(value.m_currentKnownStructure.singleton()->indexingType());
     
    174177    case Array::ArrayWithContiguousToTail:
    175178    case Array::ArrayWithContiguousOutOfBounds:
     179        if (arrayModesAlreadyChecked(value.m_arrayModes, asArrayModes(ArrayWithContiguous)))
     180            return true;
    176181        return value.m_currentKnownStructure.hasSingleton()
    177182            && hasContiguous(value.m_currentKnownStructure.singleton()->indexingType())
     
    184189    case Array::PossiblyArrayWithArrayStorageToHole:
    185190    case Array::PossiblyArrayWithArrayStorageOutOfBounds:
     191    case Array::ToArrayStorage:
     192    case Array::PossiblyArrayToArrayStorage:
     193        if (arrayModesAlreadyChecked(value.m_arrayModes, asArrayModes(NonArrayWithArrayStorage) | asArrayModes(ArrayWithArrayStorage)))
     194            return true;
    186195        return value.m_currentKnownStructure.hasSingleton()
    187196            && hasFastArrayStorage(value.m_currentKnownStructure.singleton()->indexingType());
     
    189198    case Array::SlowPutArrayStorage:
    190199    case Array::PossiblyArrayWithSlowPutArrayStorage:
     200    case Array::ToSlowPutArrayStorage:
     201        if (arrayModesAlreadyChecked(value.m_arrayModes, asArrayModes(NonArrayWithArrayStorage) | asArrayModes(ArrayWithArrayStorage) | asArrayModes(NonArrayWithSlowPutArrayStorage) | asArrayModes(ArrayWithSlowPutArrayStorage)))
     202            return true;
    191203        return value.m_currentKnownStructure.hasSingleton()
    192204            && hasArrayStorage(value.m_currentKnownStructure.singleton()->indexingType());
     
    195207    case Array::ArrayWithArrayStorageToHole:
    196208    case Array::ArrayWithArrayStorageOutOfBounds:
     209    case Array::ArrayToArrayStorage:
     210        if (arrayModesAlreadyChecked(value.m_arrayModes, asArrayModes(ArrayWithArrayStorage)))
     211            return true;
    197212        return value.m_currentKnownStructure.hasSingleton()
    198213            && hasFastArrayStorage(value.m_currentKnownStructure.singleton()->indexingType())
     
    200215       
    201216    case Array::ArrayWithSlowPutArrayStorage:
     217        if (arrayModesAlreadyChecked(value.m_arrayModes, asArrayModes(ArrayWithArrayStorage) | asArrayModes(ArrayWithSlowPutArrayStorage)))
     218            return true;
    202219        return value.m_currentKnownStructure.hasSingleton()
    203220            && hasArrayStorage(value.m_currentKnownStructure.singleton()->indexingType())
    204221            && (value.m_currentKnownStructure.singleton()->indexingType() & IsArray);
    205        
    206     case ALL_EFFECTFUL_MODES:
    207         return false;
    208222       
    209223    case Array::Arguments:
Note: See TracChangeset for help on using the changeset viewer.