Skip to content
  • akling@apple.com's avatar
    Unused Structure property tables waste 14MB on Membuster. · 85b26820
    akling@apple.com authored
    <http://webkit.org/b/110854>
    <rdar://problem/13292104>
    
    Reviewed by Geoffrey Garen.
    
    Turn PropertyTable into a GC object and have Structure drop unpinned tables when marking.
    14 MB progression on Membuster3.
    
    This time it should stick; I've been through all the tests with COLLECT_ON_EVERY_ALLOCATION.
    The issue with the last version was that Structure::m_offset could be used uninitialized
    when re-materializing a previously GC'd property table, causing some sanity checks to fail.
    
    * CMakeLists.txt:
    * GNUmakefile.list.am:
    * JavaScriptCore.gypi:
    * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
    * JavaScriptCore.xcodeproj/project.pbxproj:
    * Target.pri:
    
        Added PropertyTable.cpp.
    
    * runtime/PropertyTable.cpp: Added.
    (JSC::PropertyTable::create):
    (JSC::PropertyTable::clone):
    (JSC::PropertyTable::PropertyTable):
    (JSC::PropertyTable::destroy):
    (JSC::PropertyTable::~PropertyTable):
    (JSC::PropertyTable::visitChildren):
    
        Moved marking of property table values here from Structure::visitChildren().
    
    * runtime/WriteBarrier.h:
    (JSC::WriteBarrierBase::get):
    
        Move m_cell to a local before using it multiple times. This avoids a multiple-access race when
        Structure::checkOffsetConsistency() is used in assertions on the main thread while a marking thread
        zaps the property table.
    
    * runtime/Structure.h:
    (JSC::Structure::materializePropertyMapIfNecessary):
    (JSC::Structure::materializePropertyMapIfNecessaryForPinning):
    * runtime/StructureInlines.h:
    (JSC::Structure::propertyTable):
    
        Added a getter for the Structure's PropertyTable that ASSERTs GC currently isn't active.
        Because GC can zap an unpinned property table at any time, it's not entirely safe to access it.
        Renamed the variable itself to m_propertyTableUnsafe to force call sites into explaining themselves.
    
    (JSC::Structure::putWillGrowOutOfLineStorage):
    (JSC::Structure::checkOffsetConsistency):
    
        Moved these out of Structure.h to break header dependency cycle between Structure/PropertyTable.
    
    * runtime/Structure.cpp:
    (JSC::Structure::visitChildren):
    
        Null out m_propertyTable if the table is unpinned. This'll cause the table to get GC'd.
    
    (JSC::Structure::takePropertyTableOrCloneIfPinned):
    
        Added for setting up the property table in a new transition, this code is now shared between
        addPropertyTransition() and nonPropertyTransition().
    
    * runtime/JSGlobalData.h:
    * runtime/JSGlobalData.cpp:
    (JSC::JSGlobalData::JSGlobalData):
    
        Add a global propertyTableStructure.
    
    * runtime/PropertyMapHashTable.h:
    (PropertyTable):
    (JSC::PropertyTable::createStructure):
    (JSC::PropertyTable::copy):
    
        Make PropertyTable a GC object.
    
    * runtime/Structure.cpp:
    (JSC::Structure::dumpStatistics):
    (JSC::Structure::materializePropertyMap):
    (JSC::Structure::despecifyDictionaryFunction):
    (JSC::Structure::addPropertyTransition):
    (JSC::Structure::changePrototypeTransition):
    (JSC::Structure::despecifyFunctionTransition):
    (JSC::Structure::attributeChangeTransition):
    (JSC::Structure::toDictionaryTransition):
    (JSC::Structure::sealTransition):
    (JSC::Structure::freezeTransition):
    (JSC::Structure::preventExtensionsTransition):
    (JSC::Structure::nonPropertyTransition):
    (JSC::Structure::isSealed):
    (JSC::Structure::isFrozen):
    (JSC::Structure::flattenDictionaryStructure):
    (JSC::Structure::pin):
    (JSC::Structure::copyPropertyTable):
    (JSC::Structure::copyPropertyTableForPinning):
    (JSC::Structure::get):
    (JSC::Structure::despecifyFunction):
    (JSC::Structure::despecifyAllFunctions):
    (JSC::Structure::putSpecificValue):
    (JSC::Structure::remove):
    (JSC::Structure::createPropertyMap):
    (JSC::Structure::getPropertyNamesFromStructure):
    (JSC::Structure::checkConsistency):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@144910 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    85b26820