Changeset 144767 in webkit


Ignore:
Timestamp:
Mar 5, 2013 9:26:48 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, rolling out r144708.
http://trac.webkit.org/changeset/144708
https://bugs.webkit.org/show_bug.cgi?id=111447

random assertion crashes in inspector tests on qt+mac bots
(Requested by kling on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2013-03-05

(JSC::JSGlobalData::JSGlobalData):

  • runtime/JSGlobalData.h:

(JSGlobalData):

  • runtime/PropertyMapHashTable.h:

(PropertyTable):
(JSC::PropertyTable::PropertyTable):
(JSC):
(JSC::PropertyTable::~PropertyTable):
(JSC::PropertyTable::copy):

  • runtime/PropertyTable.cpp: Removed.
  • 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::visitChildren):
(JSC::Structure::checkConsistency):

  • runtime/Structure.h:

(JSC):
(JSC::Structure::putWillGrowOutOfLineStorage):
(JSC::Structure::materializePropertyMapIfNecessary):
(JSC::Structure::materializePropertyMapIfNecessaryForPinning):
(JSC::Structure::checkOffsetConsistency):
(Structure):

  • runtime/StructureInlines.h:

(JSC::Structure::get):

  • runtime/WriteBarrier.h:

(JSC::WriteBarrierBase::get):

Location:
trunk/Source/JavaScriptCore
Files:
1 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/CMakeLists.txt

    r144708 r144767  
    281281    runtime/PropertyNameArray.cpp
    282282    runtime/PropertySlot.cpp
    283     runtime/PropertyTable.cpp
    284283    runtime/PrototypeMap.cpp
    285284    runtime/RegExp.cpp
  • trunk/Source/JavaScriptCore/ChangeLog

    r144764 r144767  
     12013-03-05  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r144708.
     4        http://trac.webkit.org/changeset/144708
     5        https://bugs.webkit.org/show_bug.cgi?id=111447
     6
     7        random assertion crashes in inspector tests on qt+mac bots
     8        (Requested by kling on #webkit).
     9
     10        * CMakeLists.txt:
     11        * GNUmakefile.list.am:
     12        * JavaScriptCore.gypi:
     13        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
     14        * JavaScriptCore.xcodeproj/project.pbxproj:
     15        * Target.pri:
     16        * runtime/JSGlobalData.cpp:
     17        (JSC::JSGlobalData::JSGlobalData):
     18        * runtime/JSGlobalData.h:
     19        (JSGlobalData):
     20        * runtime/PropertyMapHashTable.h:
     21        (PropertyTable):
     22        (JSC::PropertyTable::PropertyTable):
     23        (JSC):
     24        (JSC::PropertyTable::~PropertyTable):
     25        (JSC::PropertyTable::copy):
     26        * runtime/PropertyTable.cpp: Removed.
     27        * runtime/Structure.cpp:
     28        (JSC::Structure::dumpStatistics):
     29        (JSC::Structure::materializePropertyMap):
     30        (JSC::Structure::despecifyDictionaryFunction):
     31        (JSC::Structure::addPropertyTransition):
     32        (JSC::Structure::changePrototypeTransition):
     33        (JSC::Structure::despecifyFunctionTransition):
     34        (JSC::Structure::attributeChangeTransition):
     35        (JSC::Structure::toDictionaryTransition):
     36        (JSC::Structure::sealTransition):
     37        (JSC::Structure::freezeTransition):
     38        (JSC::Structure::preventExtensionsTransition):
     39        (JSC::Structure::nonPropertyTransition):
     40        (JSC::Structure::isSealed):
     41        (JSC::Structure::isFrozen):
     42        (JSC::Structure::flattenDictionaryStructure):
     43        (JSC::Structure::pin):
     44        (JSC::Structure::copyPropertyTable):
     45        (JSC::Structure::copyPropertyTableForPinning):
     46        (JSC::Structure::get):
     47        (JSC::Structure::despecifyFunction):
     48        (JSC::Structure::despecifyAllFunctions):
     49        (JSC::Structure::putSpecificValue):
     50        (JSC::Structure::remove):
     51        (JSC::Structure::createPropertyMap):
     52        (JSC::Structure::getPropertyNamesFromStructure):
     53        (JSC::Structure::visitChildren):
     54        (JSC::Structure::checkConsistency):
     55        * runtime/Structure.h:
     56        (JSC):
     57        (JSC::Structure::putWillGrowOutOfLineStorage):
     58        (JSC::Structure::materializePropertyMapIfNecessary):
     59        (JSC::Structure::materializePropertyMapIfNecessaryForPinning):
     60        (JSC::Structure::checkOffsetConsistency):
     61        (Structure):
     62        * runtime/StructureInlines.h:
     63        (JSC::Structure::get):
     64        * runtime/WriteBarrier.h:
     65        (JSC::WriteBarrierBase::get):
     66
    1672013-03-05  David Kilzer  <ddkilzer@apple.com>
    268
  • trunk/Source/JavaScriptCore/GNUmakefile.list.am

    r144708 r144767  
    723723        Source/JavaScriptCore/runtime/PropertySlot.cpp \
    724724        Source/JavaScriptCore/runtime/PropertySlot.h \
    725         Source/JavaScriptCore/runtime/PropertyTable.cpp \
    726725        Source/JavaScriptCore/runtime/PrototypeMap.cpp \
    727726        Source/JavaScriptCore/runtime/PrototypeMap.h \
  • trunk/Source/JavaScriptCore/JavaScriptCore.gypi

    r144708 r144767  
    759759            'runtime/PropertySlot.cpp',
    760760            'runtime/PropertySlot.h',
    761             'runtime/PropertyTable.cpp',
    762761            'runtime/PropertyStorage.h',
    763762            'runtime/Protect.h',
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj

    r144708 r144767  
    306306    <ClCompile Include="..\runtime\PropertyNameArray.cpp" />
    307307    <ClCompile Include="..\runtime\PropertySlot.cpp" />
    308     <ClCompile Include="..\runtime\PropertyTable.cpp" />
    309308    <ClCompile Include="..\runtime\PrototypeMap.cpp" />
    310309    <ClCompile Include="..\runtime\RegExp.cpp" />
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r144708 r144767  
    704704                A7FB61001040C38B0017A286 /* PropertyDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = A7FB604B103F5EAB0017A286 /* PropertyDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
    705705                A8A4748E151A8306004123FF /* libWTF.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A8A4748D151A8306004123FF /* libWTF.a */; };
    706                 ADE39FFF16DD144B0003CD4A /* PropertyTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD1CF06816DCAB2D00B97123 /* PropertyTable.cpp */; };
    707706                BC02E90D0E1839DB000F9297 /* ErrorConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9050E1839DB000F9297 /* ErrorConstructor.h */; };
    708707                BC02E90F0E1839DB000F9297 /* ErrorPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9070E1839DB000F9297 /* ErrorPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    16201619                A8E894310CD0602400367179 /* JSCallbackObjectFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCallbackObjectFunctions.h; sourceTree = "<group>"; };
    16211620                A8E894330CD0603F00367179 /* JSGlobalObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObject.h; sourceTree = "<group>"; };
    1622                 AD1CF06816DCAB2D00B97123 /* PropertyTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PropertyTable.cpp; sourceTree = "<group>"; };
    16231621                BC021BF2136900C300FC5467 /* ToolExecutable.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ToolExecutable.xcconfig; sourceTree = "<group>"; };
    16241622                BC02E9040E1839DB000F9297 /* ErrorConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ErrorConstructor.cpp; sourceTree = "<group>"; };
     
    25092507                                65621E6C089E859700760F35 /* PropertySlot.h */,
    25102508                                0FB7F39015ED8E3800F167B2 /* PropertyStorage.h */,
    2511                                 AD1CF06816DCAB2D00B97123 /* PropertyTable.cpp */,
    25122509                                65C02FBB0637462A003E7EE6 /* Protect.h */,
    25132510                                14D844A216AA2C7000A65AF0 /* PrototypeMap.cpp */,
     
    40274024                                0FBE0F7616C1DB0F0082C5E8 /* DFGUnificationPhase.cpp in Sources */,
    40284025                                0F493AFA16D0CAD30084508B /* SourceProvider.cpp in Sources */,
    4029                                 ADE39FFF16DD144B0003CD4A /* PropertyTable.cpp in Sources */,
    40304026                        );
    40314027                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/JavaScriptCore/Target.pri

    r144708 r144767  
    299299    runtime/PropertyNameArray.cpp \
    300300    runtime/PropertySlot.cpp \
    301     runtime/PropertyTable.cpp \
    302301    runtime/PrototypeMap.cpp \
    303302    runtime/RegExpConstructor.cpp \
  • trunk/Source/JavaScriptCore/runtime/JSGlobalData.cpp

    r144708 r144767  
    233233    unlinkedEvalCodeBlockStructure.set(*this, UnlinkedEvalCodeBlock::createStructure(*this, 0, jsNull()));
    234234    unlinkedFunctionCodeBlockStructure.set(*this, UnlinkedFunctionCodeBlock::createStructure(*this, 0, jsNull()));
    235     propertyTableStructure.set(*this, PropertyTable::createStructure(*this, 0, jsNull()));
    236235    smallStrings.initializeCommonStrings(*this);
    237236
  • trunk/Source/JavaScriptCore/runtime/JSGlobalData.h

    r144708 r144767  
    257257        Strong<Structure> unlinkedEvalCodeBlockStructure;
    258258        Strong<Structure> unlinkedFunctionCodeBlockStructure;
    259         Strong<Structure> propertyTableStructure;
    260259
    261260        IdentifierTable* identifierTable;
  • trunk/Source/JavaScriptCore/runtime/PropertyMapHashTable.h

    r144708 r144767  
    2323
    2424#include "PropertyOffset.h"
    25 #include "Structure.h"
    2625#include "WriteBarrier.h"
    2726#include <wtf/HashTable.h>
     
    8786};
    8887
    89 class PropertyTable : public JSCell {
     88class PropertyTable {
     89    WTF_MAKE_FAST_ALLOCATED;
    9090
    9191    // This is the implementation for 'iterator' and 'const_iterator',
     
    130130
    131131public:
    132     static const bool needsDestruction = true;
    133     static const bool hasImmortalStructure = true;
    134     static void destroy(JSCell*);
    135 
    136     static JS_EXPORTDATA const ClassInfo s_info;
    137 
    138     static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype)
    139     {
    140         return Structure::create(globalData, globalObject, prototype, TypeInfo(CompoundType, OverridesVisitChildren), &s_info);
    141     }
    142 
    143     static void visitChildren(JSCell*, SlotVisitor&);
    144 
    145132    typedef StringImpl* KeyType;
    146133    typedef PropertyMapEntry ValueType;
     
    156143
    157144    // Constructor is passed an initial capacity, a PropertyTable to copy, or both.
    158     static PropertyTable* create(JSGlobalData&, unsigned initialCapacity);
    159     static PropertyTable* clone(JSGlobalData&, JSCell* owner, const PropertyTable&);
    160     static PropertyTable* clone(JSGlobalData&, JSCell* owner, unsigned initialCapacity, const PropertyTable&);
     145    explicit PropertyTable(unsigned initialCapacity);
     146    PropertyTable(JSGlobalData&, JSCell*, const PropertyTable&);
     147    PropertyTable(JSGlobalData&, JSCell*, unsigned initialCapacity, const PropertyTable&);
    161148    ~PropertyTable();
    162149
     
    195182
    196183    // Copy this PropertyTable, ensuring the copy has at least the capacity provided.
    197     PropertyTable* copy(JSGlobalData&, JSCell* owner, unsigned newCapacity);
     184    PassOwnPtr<PropertyTable> copy(JSGlobalData&, JSCell* owner, unsigned newCapacity);
    198185
    199186#ifndef NDEBUG
     
    203190
    204191private:
    205     PropertyTable(JSGlobalData&, unsigned initialCapacity);
    206     PropertyTable(JSGlobalData&, JSCell*, const PropertyTable&);
    207     PropertyTable(JSGlobalData&, JSCell*, unsigned initialCapacity, const PropertyTable&);
    208 
    209192    PropertyTable(const PropertyTable&);
    210193    // Used to insert a value known not to be in the table, and where we know capacity to be available.
     
    257240};
    258241
     242inline PropertyTable::PropertyTable(unsigned initialCapacity)
     243    : m_indexSize(sizeForCapacity(initialCapacity))
     244    , m_indexMask(m_indexSize - 1)
     245    , m_index(static_cast<unsigned*>(fastZeroedMalloc(dataSize())))
     246    , m_keyCount(0)
     247    , m_deletedCount(0)
     248{
     249    ASSERT(isPowerOf2(m_indexSize));
     250}
     251
     252inline PropertyTable::PropertyTable(JSGlobalData&, JSCell* owner, const PropertyTable& other)
     253    : m_indexSize(other.m_indexSize)
     254    , m_indexMask(other.m_indexMask)
     255    , m_index(static_cast<unsigned*>(fastMalloc(dataSize())))
     256    , m_keyCount(other.m_keyCount)
     257    , m_deletedCount(other.m_deletedCount)
     258{
     259    ASSERT(isPowerOf2(m_indexSize));
     260
     261    memcpy(m_index, other.m_index, dataSize());
     262
     263    iterator end = this->end();
     264    for (iterator iter = begin(); iter != end; ++iter) {
     265        iter->key->ref();
     266        Heap::writeBarrier(owner, iter->specificValue.get());
     267    }
     268
     269    // Copy the m_deletedOffsets vector.
     270    Vector<PropertyOffset>* otherDeletedOffsets = other.m_deletedOffsets.get();
     271    if (otherDeletedOffsets)
     272        m_deletedOffsets = adoptPtr(new Vector<PropertyOffset>(*otherDeletedOffsets));
     273}
     274
     275inline PropertyTable::PropertyTable(JSGlobalData&, JSCell* owner, unsigned initialCapacity, const PropertyTable& other)
     276    : m_indexSize(sizeForCapacity(initialCapacity))
     277    , m_indexMask(m_indexSize - 1)
     278    , m_index(static_cast<unsigned*>(fastZeroedMalloc(dataSize())))
     279    , m_keyCount(0)
     280    , m_deletedCount(0)
     281{
     282    ASSERT(isPowerOf2(m_indexSize));
     283    ASSERT(initialCapacity >= other.m_keyCount);
     284
     285    const_iterator end = other.end();
     286    for (const_iterator iter = other.begin(); iter != end; ++iter) {
     287        ASSERT(canInsert());
     288        reinsert(*iter);
     289        iter->key->ref();
     290        Heap::writeBarrier(owner, iter->specificValue.get());
     291    }
     292
     293    // Copy the m_deletedOffsets vector.
     294    Vector<PropertyOffset>* otherDeletedOffsets = other.m_deletedOffsets.get();
     295    if (otherDeletedOffsets)
     296        m_deletedOffsets = adoptPtr(new Vector<PropertyOffset>(*otherDeletedOffsets));
     297}
     298
     299inline PropertyTable::~PropertyTable()
     300{
     301    iterator end = this->end();
     302    for (iterator iter = begin(); iter != end; ++iter)
     303        iter->key->deref();
     304
     305    fastFree(m_index);
     306}
     307
    259308inline PropertyTable::iterator PropertyTable::begin()
    260309{
     
    454503}
    455504
    456 inline PropertyTable* PropertyTable::copy(JSGlobalData& globalData, JSCell* owner, unsigned newCapacity)
     505inline PassOwnPtr<PropertyTable> PropertyTable::copy(JSGlobalData& globalData, JSCell* owner, unsigned newCapacity)
    457506{
    458507    ASSERT(newCapacity >= m_keyCount);
     
    461510    // save rehashing all keys.
    462511    if (sizeForCapacity(newCapacity) == m_indexSize)
    463         return PropertyTable::clone(globalData, owner, *this);
    464     return PropertyTable::clone(globalData, owner, newCapacity, *this);
     512        return adoptPtr(new PropertyTable(globalData, owner, *this));
     513    return adoptPtr(new PropertyTable(globalData, owner, newCapacity, *this));
    465514}
    466515
  • trunk/Source/JavaScriptCore/runtime/Structure.cpp

    r144708 r144767  
    132132        }
    133133
    134         if (structure->propertyTable()) {
     134        if (structure->m_propertyTable) {
    135135            ++numberWithPropertyMaps;
    136             totalPropertyMapsSize += structure->propertyTable()->sizeInMemory();
     136            totalPropertyMapsSize += structure->m_propertyTable->sizeInMemory();
    137137        }
    138138    }
     
    235235{
    236236    ASSERT(structure()->classInfo() == &s_info);
    237     ASSERT(!propertyTable());
     237    ASSERT(!m_propertyTable);
    238238
    239239    Vector<Structure*, 8> structures;
     
    245245    while ((structure = structure->previousID())) {
    246246        if (structure->m_isPinnedPropertyTable) {
    247             ASSERT(structure->propertyTable());
     247            ASSERT(structure->m_propertyTable);
    248248            ASSERT(!structure->previousID());
    249249
    250             propertyTable().set(globalData, this, structure->propertyTable()->copy(globalData, 0, numberOfSlotsForLastOffset(m_offset, m_inlineCapacity)));
     250            m_propertyTable = structure->m_propertyTable->copy(globalData, 0, numberOfSlotsForLastOffset(m_offset, m_inlineCapacity));
    251251            break;
    252252        }
     
    255255    }
    256256
    257     if (!propertyTable())
    258         createPropertyMap(globalData, numberOfSlotsForLastOffset(m_offset, m_inlineCapacity));
     257    if (!m_propertyTable)
     258        createPropertyMap(numberOfSlotsForLastOffset(m_offset, m_inlineCapacity));
    259259
    260260    for (ptrdiff_t i = structures.size() - 1; i >= 0; --i) {
     
    263263            continue;
    264264        PropertyMapEntry entry(globalData, this, structure->m_nameInPrevious.get(), structure->m_offset, structure->m_attributesInPrevious, structure->m_specificValueInPrevious.get());
    265         propertyTable()->add(entry, m_offset, PropertyTable::PropertyOffsetMustNotChange);
     265        m_propertyTable->add(entry, m_offset, PropertyTable::PropertyOffsetMustNotChange);
    266266    }
    267267   
     
    288288
    289289    ASSERT(isDictionary());
    290     ASSERT(propertyTable());
    291 
    292     PropertyMapEntry* entry = propertyTable()->find(rep).first;
     290    ASSERT(m_propertyTable);
     291
     292    PropertyMapEntry* entry = m_propertyTable->find(rep).first;
    293293    ASSERT(entry);
    294294    entry->specificValue.clear();
     
    374374    transition->m_specificValueInPrevious.setMayBeNull(globalData, transition, specificValue);
    375375
    376     if (structure->propertyTable()) {
     376    if (structure->m_propertyTable) {
    377377        structure->checkOffsetConsistency();
    378378        if (structure->m_isPinnedPropertyTable)
    379             transition->propertyTable().set(globalData, transition, structure->propertyTable()->copy(globalData, transition, structure->propertyTable()->size() + 1));
    380         else {
    381             transition->propertyTable().set(globalData, transition, structure->propertyTable().get());
    382             structure->propertyTable().clear();
    383         }
     379            transition->m_propertyTable = structure->m_propertyTable->copy(globalData, transition, structure->m_propertyTable->size() + 1);
     380        else
     381            transition->m_propertyTable = structure->m_propertyTable.release();
    384382    } else {
    385383        if (structure->previousID())
    386384            transition->materializePropertyMap(globalData);
    387385        else
    388             transition->createPropertyMap(globalData);
     386            transition->createPropertyMap();
    389387    }
    390388    transition->m_offset = structure->m_offset;
     
    418416
    419417    structure->materializePropertyMapIfNecessary(globalData);
    420     transition->propertyTable().set(globalData, transition, structure->copyPropertyTableForPinning(globalData, transition));
     418    transition->m_propertyTable = structure->copyPropertyTableForPinning(globalData, transition);
    421419    transition->m_offset = structure->m_offset;
    422420    transition->pin();
     
    434432
    435433    structure->materializePropertyMapIfNecessary(globalData);
    436     transition->propertyTable().set(globalData, transition, structure->copyPropertyTableForPinning(globalData, transition));
     434    transition->m_propertyTable = structure->copyPropertyTableForPinning(globalData, transition);
    437435    transition->m_offset = structure->m_offset;
    438436    transition->pin();
     
    455453
    456454        structure->materializePropertyMapIfNecessary(globalData);
    457         transition->propertyTable().set(globalData, transition, structure->copyPropertyTableForPinning(globalData, transition));
     455        transition->m_propertyTable = structure->copyPropertyTableForPinning(globalData, transition);
    458456        transition->m_offset = structure->m_offset;
    459457        transition->pin();
     
    462460    }
    463461
    464     ASSERT(structure->propertyTable());
    465     PropertyMapEntry* entry = structure->propertyTable()->find(propertyName.uid()).first;
     462    ASSERT(structure->m_propertyTable);
     463    PropertyMapEntry* entry = structure->m_propertyTable->find(propertyName.uid()).first;
    466464    ASSERT(entry);
    467465    entry->attributes = attributes;
     
    478476
    479477    structure->materializePropertyMapIfNecessary(globalData);
    480     transition->propertyTable().set(globalData, transition, structure->copyPropertyTableForPinning(globalData, transition));
     478    transition->m_propertyTable = structure->copyPropertyTableForPinning(globalData, transition);
    481479    transition->m_offset = structure->m_offset;
    482480    transition->m_dictionaryKind = kind;
     
    502500    Structure* transition = preventExtensionsTransition(globalData, structure);
    503501
    504     if (transition->propertyTable()) {
    505         PropertyTable::iterator end = transition->propertyTable()->end();
    506         for (PropertyTable::iterator iter = transition->propertyTable()->begin(); iter != end; ++iter)
     502    if (transition->m_propertyTable) {
     503        PropertyTable::iterator end = transition->m_propertyTable->end();
     504        for (PropertyTable::iterator iter = transition->m_propertyTable->begin(); iter != end; ++iter)
    507505            iter->attributes |= DontDelete;
    508506    }
     
    517515    Structure* transition = preventExtensionsTransition(globalData, structure);
    518516
    519     if (transition->propertyTable()) {
    520         PropertyTable::iterator iter = transition->propertyTable()->begin();
    521         PropertyTable::iterator end = transition->propertyTable()->end();
     517    if (transition->m_propertyTable) {
     518        PropertyTable::iterator iter = transition->m_propertyTable->begin();
     519        PropertyTable::iterator end = transition->m_propertyTable->end();
    522520        if (iter != end)
    523521            transition->m_hasReadOnlyOrGetterSetterPropertiesExcludingProto = true;
     
    538536
    539537    structure->materializePropertyMapIfNecessary(globalData);
    540     transition->propertyTable().set(globalData, transition, structure->copyPropertyTableForPinning(globalData, transition));
     538    transition->m_propertyTable = structure->copyPropertyTableForPinning(globalData, transition);
    541539    transition->m_offset = structure->m_offset;
    542540    transition->m_preventExtensions = true;
     
    575573    checkOffset(transition->m_offset, transition->inlineCapacity());
    576574   
    577     if (structure->propertyTable()) {
     575    if (structure->m_propertyTable) {
    578576        structure->checkOffsetConsistency();
    579577        if (structure->m_isPinnedPropertyTable)
    580             transition->propertyTable().set(globalData, transition, structure->propertyTable()->copy(globalData, transition, structure->propertyTable()->size() + 1));
    581         else {
    582             transition->propertyTable().set(globalData, transition, structure->propertyTable().get());
    583             structure->propertyTable().clear();
    584         }
     578            transition->m_propertyTable = structure->m_propertyTable->copy(globalData, transition, structure->m_propertyTable->size() + 1);
     579        else
     580            transition->m_propertyTable = structure->m_propertyTable.release();
    585581    } else {
    586582        if (structure->previousID())
    587583            transition->materializePropertyMap(globalData);
    588584        else
    589             transition->createPropertyMap(globalData);
     585            transition->createPropertyMap();
    590586    }
    591587   
     
    602598
    603599    materializePropertyMapIfNecessary(globalData);
    604     if (!propertyTable())
     600    if (!m_propertyTable)
    605601        return true;
    606602
    607     PropertyTable::iterator end = propertyTable()->end();
    608     for (PropertyTable::iterator iter = propertyTable()->begin(); iter != end; ++iter) {
     603    PropertyTable::iterator end = m_propertyTable->end();
     604    for (PropertyTable::iterator iter = m_propertyTable->begin(); iter != end; ++iter) {
    609605        if ((iter->attributes & DontDelete) != DontDelete)
    610606            return false;
     
    620616
    621617    materializePropertyMapIfNecessary(globalData);
    622     if (!propertyTable())
     618    if (!m_propertyTable)
    623619        return true;
    624620
    625     PropertyTable::iterator end = propertyTable()->end();
    626     for (PropertyTable::iterator iter = propertyTable()->begin(); iter != end; ++iter) {
     621    PropertyTable::iterator end = m_propertyTable->end();
     622    for (PropertyTable::iterator iter = m_propertyTable->begin(); iter != end; ++iter) {
    627623        if (!(iter->attributes & DontDelete))
    628624            return false;
     
    638634    ASSERT(isDictionary());
    639635    if (isUncacheableDictionary()) {
    640         ASSERT(propertyTable());
    641 
    642         size_t propertyCount = propertyTable()->size();
     636        ASSERT(m_propertyTable);
     637
     638        size_t propertyCount = m_propertyTable->size();
    643639
    644640        // Holds our values compacted by insertion order.
     
    647643        // Copies out our values from their hashed locations, compacting property table offsets as we go.
    648644        unsigned i = 0;
    649         PropertyTable::iterator end = propertyTable()->end();
     645        PropertyTable::iterator end = m_propertyTable->end();
    650646        m_offset = invalidOffset;
    651         for (PropertyTable::iterator iter = propertyTable()->begin(); iter != end; ++iter, ++i) {
     647        for (PropertyTable::iterator iter = m_propertyTable->begin(); iter != end; ++iter, ++i) {
    652648            values[i] = object->getDirect(iter->offset);
    653649            m_offset = iter->offset = offsetForPropertyNumber(i, m_inlineCapacity);
     
    658654            object->putDirect(globalData, offsetForPropertyNumber(i, m_inlineCapacity), values[i]);
    659655
    660         propertyTable()->clearDeletedOffsets();
     656        m_propertyTable->clearDeletedOffsets();
    661657        checkOffsetConsistency();
    662658    }
     
    693689void Structure::pin()
    694690{
    695     ASSERT(propertyTable());
     691    ASSERT(m_propertyTable);
    696692    m_isPinnedPropertyTable = true;
    697693    clearPreviousID();
     
    742738#endif
    743739
    744 PropertyTable* Structure::copyPropertyTable(JSGlobalData& globalData, Structure* owner)
    745 {
    746     if (!propertyTable())
    747         return 0;
    748     return PropertyTable::clone(globalData, owner, *propertyTable().get());
    749 }
    750 
    751 PropertyTable* Structure::copyPropertyTableForPinning(JSGlobalData& globalData, Structure* owner)
    752 {
    753     if (propertyTable())
    754         return PropertyTable::clone(globalData, owner, *propertyTable().get());
    755     return PropertyTable::create(globalData, numberOfSlotsForLastOffset(m_offset, m_inlineCapacity));
     740PassOwnPtr<PropertyTable> Structure::copyPropertyTable(JSGlobalData& globalData, Structure* owner)
     741{
     742    return adoptPtr(m_propertyTable ? new PropertyTable(globalData, owner, *m_propertyTable) : 0);
     743}
     744
     745PassOwnPtr<PropertyTable> Structure::copyPropertyTableForPinning(JSGlobalData& globalData, Structure* owner)
     746{
     747    return adoptPtr(m_propertyTable ? new PropertyTable(globalData, owner, *m_propertyTable) : new PropertyTable(numberOfSlotsForLastOffset(m_offset, m_inlineCapacity)));
    756748}
    757749
     
    761753
    762754    materializePropertyMapIfNecessary(globalData);
    763     if (!propertyTable())
     755    if (!m_propertyTable)
    764756        return invalidOffset;
    765757
    766     PropertyMapEntry* entry = propertyTable()->find(propertyName.uid()).first;
     758    PropertyMapEntry* entry = m_propertyTable->find(propertyName.uid()).first;
    767759    if (!entry)
    768760        return invalidOffset;
     
    776768{
    777769    materializePropertyMapIfNecessary(globalData);
    778     if (!propertyTable())
     770    if (!m_propertyTable)
    779771        return false;
    780772
    781     PropertyMapEntry* entry = propertyTable()->find(propertyName.uid()).first;
     773    PropertyMapEntry* entry = m_propertyTable->find(propertyName.uid()).first;
    782774    if (!entry)
    783775        return false;
     
    791783{
    792784    materializePropertyMapIfNecessary(globalData);
    793     if (!propertyTable())
     785    if (!m_propertyTable)
    794786        return;
    795787
    796     PropertyTable::iterator end = propertyTable()->end();
    797     for (PropertyTable::iterator iter = propertyTable()->begin(); iter != end; ++iter)
     788    PropertyTable::iterator end = m_propertyTable->end();
     789    for (PropertyTable::iterator iter = m_propertyTable->begin(); iter != end; ++iter)
    798790        iter->specificValue.clear();
    799791}
     
    809801    StringImpl* rep = propertyName.uid();
    810802
    811     if (!propertyTable())
    812         createPropertyMap(globalData);
    813 
    814     PropertyOffset newOffset = propertyTable()->nextOffset(m_inlineCapacity);
    815 
    816     propertyTable()->add(PropertyMapEntry(globalData, this, rep, newOffset, attributes, specificValue), m_offset, PropertyTable::PropertyOffsetMayChange);
     803    if (!m_propertyTable)
     804        createPropertyMap();
     805
     806    PropertyOffset newOffset = m_propertyTable->nextOffset(m_inlineCapacity);
     807
     808    m_propertyTable->add(PropertyMapEntry(globalData, this, rep, newOffset, attributes, specificValue), m_offset, PropertyTable::PropertyOffsetMayChange);
    817809   
    818810    checkConsistency();
     
    826818    StringImpl* rep = propertyName.uid();
    827819
    828     if (!propertyTable())
     820    if (!m_propertyTable)
    829821        return invalidOffset;
    830822
    831     PropertyTable::find_iterator position = propertyTable()->find(rep);
     823    PropertyTable::find_iterator position = m_propertyTable->find(rep);
    832824    if (!position.first)
    833825        return invalidOffset;
     
    835827    PropertyOffset offset = position.first->offset;
    836828
    837     propertyTable()->remove(position);
    838     propertyTable()->addDeletedOffset(offset);
     829    m_propertyTable->remove(position);
     830    m_propertyTable->addDeletedOffset(offset);
    839831
    840832    checkConsistency();
     
    842834}
    843835
    844 void Structure::createPropertyMap(JSGlobalData& globalData, unsigned capacity)
    845 {
    846     ASSERT(!propertyTable());
     836void Structure::createPropertyMap(unsigned capacity)
     837{
     838    ASSERT(!m_propertyTable);
    847839
    848840    checkConsistency();
    849     propertyTable().set(globalData, this, PropertyTable::create(globalData, capacity));
     841    m_propertyTable = adoptPtr(new PropertyTable(capacity));
    850842}
    851843
     
    853845{
    854846    materializePropertyMapIfNecessary(globalData);
    855     if (!propertyTable())
     847    if (!m_propertyTable)
    856848        return;
    857849
    858850    bool knownUnique = !propertyNames.size();
    859851
    860     PropertyTable::iterator end = propertyTable()->end();
    861     for (PropertyTable::iterator iter = propertyTable()->begin(); iter != end; ++iter) {
     852    PropertyTable::iterator end = m_propertyTable->end();
     853    for (PropertyTable::iterator iter = m_propertyTable->begin(); iter != end; ++iter) {
    862854        ASSERT(m_hasNonEnumerableProperties || !(iter->attributes & DontEnum));
    863855        if (iter->key->isIdentifier() && (!(iter->attributes & DontEnum) || mode == IncludeDontEnumProperties)) {
     
    891883    visitor.append(&thisObject->m_previousOrRareData);
    892884    visitor.append(&thisObject->m_specificValueInPrevious);
    893 
    894     if (thisObject->m_isPinnedPropertyTable) {
    895         ASSERT(thisObject->m_propertyTableUnsafe);
    896         visitor.append(&thisObject->m_propertyTableUnsafe);
    897     } else if (thisObject->m_propertyTableUnsafe)
    898         thisObject->m_propertyTableUnsafe.clear();
     885    if (thisObject->m_propertyTable) {
     886        PropertyTable::iterator end = thisObject->m_propertyTable->end();
     887        for (PropertyTable::iterator ptr = thisObject->m_propertyTable->begin(); ptr != end; ++ptr)
     888            visitor.append(&ptr->specificValue);
     889    }
    899890}
    900891
     
    987978void Structure::checkConsistency()
    988979{
    989     if (!propertyTable())
     980    if (!m_propertyTable)
    990981        return;
    991982
    992983    if (!m_hasNonEnumerableProperties) {
    993         PropertyTable::iterator end = propertyTable()->end();
    994         for (PropertyTable::iterator iter = propertyTable()->begin(); iter != end; ++iter) {
     984        PropertyTable::iterator end = m_propertyTable->end();
     985        for (PropertyTable::iterator iter = m_propertyTable->begin(); iter != end; ++iter) {
    995986            ASSERT(!(iter->attributes & DontEnum));
    996987        }
    997988    }
    998989
    999     propertyTable()->checkConsistency();
     990    m_propertyTable->checkConsistency();
    1000991}
    1001992
  • trunk/Source/JavaScriptCore/runtime/Structure.h

    r144708 r144767  
    3232#include "JSCell.h"
    3333#include "JSType.h"
     34#include "PropertyMapHashTable.h"
    3435#include "PropertyName.h"
    3536#include "PropertyNameArray.h"
    36 #include "PropertyOffset.h"
    3737#include "Protect.h"
    3838#include "StructureRareData.h"
     
    4141#include "Watchpoint.h"
    4242#include "Weak.h"
     43#include <wtf/PassOwnPtr.h>
    4344#include <wtf/PassRefPtr.h>
    4445#include <wtf/RefCounted.h>
     
    5152class PropertyNameArray;
    5253class PropertyNameArrayData;
    53 class PropertyTable;
    5454class StructureChain;
    5555class SlotVisitor;
     
    109109    bool isExtensible() const { return !m_preventExtensions; }
    110110    bool didTransition() const { return m_didTransition; }
    111     bool putWillGrowOutOfLineStorage();
     111    bool putWillGrowOutOfLineStorage()
     112    {
     113        checkOffsetConsistency();
     114           
     115        ASSERT(outOfLineCapacity() >= outOfLineSize());
     116           
     117        if (!m_propertyTable) {
     118            unsigned currentSize = numberOfOutOfLineSlotsForLastOffset(m_offset);
     119            ASSERT(outOfLineCapacity() >= currentSize);
     120            return currentSize == outOfLineCapacity();
     121        }
     122           
     123        ASSERT(totalStorageCapacity() >= m_propertyTable->propertyStorageSize());
     124        if (m_propertyTable->hasDeletedOffset())
     125            return false;
     126           
     127        ASSERT(totalStorageCapacity() >= m_propertyTable->size());
     128        return m_propertyTable->size() == totalStorageCapacity();
     129    }
    112130    JS_EXPORT_PRIVATE size_t suggestedNewOutOfLineStorageCapacity();
    113131
     
    365383    PropertyOffset remove(PropertyName);
    366384
    367     void createPropertyMap(JSGlobalData&, unsigned keyCount = 0);
     385    void createPropertyMap(unsigned keyCount = 0);
    368386    void checkConsistency();
    369387
     
    371389    void despecifyAllFunctions(JSGlobalData&);
    372390
    373     WriteBarrier<PropertyTable>& propertyTable();
    374 
    375     PropertyTable* copyPropertyTable(JSGlobalData&, Structure* owner);
    376     PropertyTable* copyPropertyTableForPinning(JSGlobalData&, Structure* owner);
     391    PassOwnPtr<PropertyTable> copyPropertyTable(JSGlobalData&, Structure* owner);
     392    PassOwnPtr<PropertyTable> copyPropertyTableForPinning(JSGlobalData&, Structure* owner);
    377393    JS_EXPORT_PRIVATE void materializePropertyMap(JSGlobalData&);
    378394    void materializePropertyMapIfNecessary(JSGlobalData& globalData)
     
    380396        ASSERT(structure()->classInfo() == &s_info);
    381397        ASSERT(checkOffsetConsistency());
    382         if (!propertyTable() && previousID())
     398        if (!m_propertyTable && previousID())
    383399            materializePropertyMap(globalData);
    384400    }
     
    387403        ASSERT(structure()->classInfo() == &s_info);
    388404        checkOffsetConsistency();
    389         if (!propertyTable())
     405        if (!m_propertyTable)
    390406            materializePropertyMap(globalData);
    391407    }
     
    430446    }
    431447       
    432     bool checkOffsetConsistency() const;
     448    ALWAYS_INLINE bool checkOffsetConsistency() const
     449    {
     450        if (!m_propertyTable) {
     451            ASSERT(!m_isPinnedPropertyTable);
     452            return true;
     453        }
     454           
     455        RELEASE_ASSERT(numberOfSlotsForLastOffset(m_offset, m_inlineCapacity) == m_propertyTable->propertyStorageSize());
     456        unsigned totalSize = m_propertyTable->propertyStorageSize();
     457        RELEASE_ASSERT((totalSize < inlineCapacity() ? 0 : totalSize - inlineCapacity()) == numberOfOutOfLineSlotsForLastOffset(m_offset));
     458           
     459        return true;
     460    }
    433461
    434462    void allocateRareData(JSGlobalData&);
     
    455483    StructureTransitionTable m_transitionTable;
    456484
    457     // Should be accessed through propertyTable(). During GC, it may be set to 0 by another thread.
    458     WriteBarrier<PropertyTable> m_propertyTableUnsafe;
     485    OwnPtr<PropertyTable> m_propertyTable;
    459486
    460487    mutable InlineWatchpointSet m_transitionWatchpointSet;
  • trunk/Source/JavaScriptCore/runtime/StructureInlines.h

    r144708 r144767  
    2727#define StructureInlines_h
    2828
    29 #include "PropertyMapHashTable.h"
    3029#include "Structure.h"
    3130
     
    6362    ASSERT(structure()->classInfo() == &s_info);
    6463    materializePropertyMapIfNecessary(globalData);
    65     if (!propertyTable())
     64    if (!m_propertyTable)
    6665        return invalidOffset;
    6766
    68     PropertyMapEntry* entry = propertyTable()->find(propertyName.uid()).first;
     67    PropertyMapEntry* entry = m_propertyTable->find(propertyName.uid()).first;
    6968    return entry ? entry->offset : invalidOffset;
    7069}
     
    7473    ASSERT(structure()->classInfo() == &s_info);
    7574    materializePropertyMapIfNecessary(globalData);
    76     if (!propertyTable())
     75    if (!m_propertyTable)
    7776        return invalidOffset;
    7877
    79     PropertyMapEntry* entry = propertyTable()->findWithString(name.impl()).first;
     78    PropertyMapEntry* entry = m_propertyTable->findWithString(name.impl()).first;
    8079    return entry ? entry->offset : invalidOffset;
    8180}
     
    181180}
    182181
    183 inline bool Structure::putWillGrowOutOfLineStorage()
    184 {
    185     checkOffsetConsistency();
    186 
    187     ASSERT(outOfLineCapacity() >= outOfLineSize());
    188 
    189     if (!propertyTable()) {
    190         unsigned currentSize = numberOfOutOfLineSlotsForLastOffset(m_offset);
    191         ASSERT(outOfLineCapacity() >= currentSize);
    192         return currentSize == outOfLineCapacity();
    193     }
    194 
    195     ASSERT(totalStorageCapacity() >= propertyTable()->propertyStorageSize());
    196     if (propertyTable()->hasDeletedOffset())
    197         return false;
    198 
    199     ASSERT(totalStorageCapacity() >= propertyTable()->size());
    200     return propertyTable()->size() == totalStorageCapacity();
    201 }
    202 
    203 ALWAYS_INLINE WriteBarrier<PropertyTable>& Structure::propertyTable()
    204 {
    205     ASSERT(!globalObject() || !globalObject()->globalData().heap.isBusy());
    206     return m_propertyTableUnsafe;
    207 }
    208 
    209 ALWAYS_INLINE bool Structure::checkOffsetConsistency() const
    210 {
    211     PropertyTable* propertyTable = m_propertyTableUnsafe.get();
    212 
    213     if (!propertyTable) {
    214         ASSERT(!m_isPinnedPropertyTable);
    215         return true;
    216     }
    217 
    218     RELEASE_ASSERT(numberOfSlotsForLastOffset(m_offset, m_inlineCapacity) == propertyTable->propertyStorageSize());
    219     unsigned totalSize = propertyTable->propertyStorageSize();
    220     RELEASE_ASSERT((totalSize < inlineCapacity() ? 0 : totalSize - inlineCapacity()) == numberOfOutOfLineSlotsForLastOffset(m_offset));
    221 
    222     return true;
    223 }
    224 
    225182} // namespace JSC
    226183
  • trunk/Source/JavaScriptCore/runtime/WriteBarrier.h

    r144708 r144767  
    100100    T* get() const
    101101    {
    102         // Copy m_cell to a local to avoid multiple-read issues. (See <http://webkit.org/b/110854>)
    103         JSCell* cell = m_cell;
    104         if (cell)
    105             validateCell(cell);
    106         return reinterpret_cast<T*>(static_cast<void*>(cell));
     102        if (m_cell)
     103            validateCell(m_cell);
     104        return reinterpret_cast<T*>(static_cast<void*>(m_cell));
    107105    }
    108106
Note: See TracChangeset for help on using the changeset viewer.