Changeset 48582 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Sep 21, 2009, 8:45:13 AM (16 years ago)
Author:
[email protected]
Message:

Re-land SNES fix, with correct assertion

RS=Maciej Stachowiak

Location:
trunk/JavaScriptCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r48581 r48582  
     12009-09-21  Oliver Hunt  <[email protected]>
     2
     3        RS=Maciej Stachowiak.
     4
     5        Re-land SNES fix with corrected assertion.
     6
     7        * interpreter/Interpreter.cpp:
     8        (JSC::Interpreter::resolveGlobal):
     9        (JSC::Interpreter::tryCachePutByID):
     10        (JSC::Interpreter::tryCacheGetByID):
     11        * jit/JITStubs.cpp:
     12        (JSC::JITThunks::tryCachePutByID):
     13        (JSC::JITThunks::tryCacheGetByID):
     14        (JSC::DEFINE_STUB_FUNCTION):
     15        * runtime/BatchedTransitionOptimizer.h:
     16        (JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer):
     17        * runtime/JSObject.cpp:
     18        (JSC::JSObject::removeDirect):
     19        * runtime/Structure.cpp:
     20        (JSC::Structure::Structure):
     21        (JSC::Structure::getEnumerablePropertyNames):
     22        (JSC::Structure::despecifyDictionaryFunction):
     23        (JSC::Structure::addPropertyTransitionToExistingStructure):
     24        (JSC::Structure::addPropertyTransition):
     25        (JSC::Structure::removePropertyTransition):
     26        (JSC::Structure::toDictionaryTransition):
     27        (JSC::Structure::toCacheableDictionaryTransition):
     28        (JSC::Structure::toUncacheableDictionaryTransition):
     29        (JSC::Structure::fromDictionaryTransition):
     30        (JSC::Structure::removePropertyWithoutTransition):
     31        * runtime/Structure.h:
     32        (JSC::Structure::isDictionary):
     33        (JSC::Structure::isUncacheableDictionary):
     34        (JSC::Structure::):
     35        * runtime/StructureChain.cpp:
     36        (JSC::StructureChain::isCacheable):
     37
    1382009-09-21  Adam Roben  <[email protected]>
    239
  • trunk/JavaScriptCore/interpreter/Interpreter.cpp

    r48580 r48582  
    170170    if (globalObject->getPropertySlot(callFrame, ident, slot)) {
    171171        JSValue result = slot.getValue(callFrame, ident);
    172         if (slot.isCacheable() && !globalObject->structure()->isDictionary() && slot.slotBase() == globalObject) {
     172        if (slot.isCacheable() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) {
    173173            if (vPC[4].u.structure)
    174174                vPC[4].u.structure->deref();
     
    954954    Structure* structure = baseCell->structure();
    955955
    956     if (structure->isDictionary()) {
     956    if (structure->isUncacheableDictionary()) {
    957957        vPC[0] = getOpcode(op_put_by_id_generic);
    958958        return;
     
    10411041    Structure* structure = asCell(baseValue)->structure();
    10421042
    1043     if (structure->isDictionary()) {
     1043    if (structure->isUncacheableDictionary()) {
    10441044        vPC[0] = getOpcode(op_get_by_id_generic);
    10451045        return;
  • trunk/JavaScriptCore/jit/JITStubs.cpp

    r48580 r48582  
    680680    Structure* structure = baseCell->structure();
    681681
    682     if (structure->isDictionary()) {
     682    if (structure->isUncacheableDictionary()) {
    683683        ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(cti_op_put_by_id_generic));
    684684        return;
     
    744744    Structure* structure = baseCell->structure();
    745745
    746     if (structure->isDictionary()) {
     746    if (structure->isUncacheableDictionary()) {
    747747        ctiPatchCallByReturnAddress(codeBlock, returnAddress, FunctionPtr(cti_op_get_by_id_generic));
    748748        return;
     
    11551155    if (baseValue.isCell()
    11561156        && slot.isCacheable()
    1157         && !(structure = asCell(baseValue)->structure())->isDictionary()
     1157        && !(structure = asCell(baseValue)->structure())->isUncacheableDictionary()
    11581158        && (slotBaseObject = asObject(slot.slotBase()))->getPropertySpecificValue(callFrame, ident, specific)
    11591159        && specific
     
    12291229    if (baseValue.isCell()
    12301230        && slot.isCacheable()
    1231         && !asCell(baseValue)->structure()->isDictionary()
     1231        && !asCell(baseValue)->structure()->isUncacheableDictionary()
    12321232        && slot.slotBase() == baseValue) {
    12331233
     
    13001300    CHECK_FOR_EXCEPTION();
    13011301
    1302     if (!baseValue.isCell() || !slot.isCacheable() || asCell(baseValue)->structure()->isDictionary()) {
     1302    if (!baseValue.isCell() || !slot.isCacheable() || asCell(baseValue)->structure()->isUncacheableDictionary()) {
    13031303        ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_fail));
    13041304        return JSValue::encode(result);
     
    21892189    if (globalObject->getPropertySlot(callFrame, ident, slot)) {
    21902190        JSValue result = slot.getValue(callFrame, ident);
    2191         if (slot.isCacheable() && !globalObject->structure()->isDictionary() && slot.slotBase() == globalObject) {
     2191        if (slot.isCacheable() && !globalObject->structure()->isUncacheableDictionary() && slot.slotBase() == globalObject) {
    21922192            GlobalResolveInfo& globalResolveInfo = callFrame->codeBlock()->globalResolveInfo(globalResolveInfoIndex);
    21932193            if (globalResolveInfo.structure)
  • trunk/JavaScriptCore/runtime/BatchedTransitionOptimizer.h

    r48580 r48582  
    3939        {
    4040            if (!m_object->structure()->isDictionary())
    41                 m_object->setStructure(Structure::toDictionaryTransition(m_object->structure()));
     41                m_object->setStructure(Structure::toCacheableDictionaryTransition(m_object->structure()));
    4242        }
    4343
  • trunk/JavaScriptCore/runtime/JSObject.cpp

    r48580 r48582  
    472472{
    473473    size_t offset;
    474     if (m_structure->isDictionary()) {
     474    if (m_structure->isUncacheableDictionary()) {
    475475        offset = m_structure->removePropertyWithoutTransition(propertyName);
    476476        if (offset != WTF::notFound)
  • trunk/JavaScriptCore/runtime/Structure.cpp

    r48580 r48582  
    128128    , m_propertyStorageCapacity(JSObject::inlineStorageCapacity)
    129129    , m_offset(noOffset)
    130     , m_isDictionary(false)
     130    , m_dictionaryKind(NoneDictionaryKind)
    131131    , m_isPinnedPropertyTable(false)
    132132    , m_hasGetterSetterProperties(false)
     
    291291void Structure::getEnumerablePropertyNames(ExecState* exec, PropertyNameArray& propertyNames, JSObject* baseObject)
    292292{
    293     bool shouldCache = propertyNames.shouldCache() && !(propertyNames.size() || m_isDictionary);
     293    bool shouldCache = propertyNames.shouldCache() && !(propertyNames.size() || isDictionary());
    294294
    295295    if (shouldCache && m_cachedPropertyNameArrayData) {
     
    350350    materializePropertyMapIfNecessary();
    351351
    352     ASSERT(m_isDictionary);
     352    ASSERT(isDictionary());
    353353    ASSERT(m_propertyTable);
    354354
     
    392392PassRefPtr<Structure> Structure::addPropertyTransitionToExistingStructure(Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset)
    393393{
    394     ASSERT(!structure->m_isDictionary);
     394    ASSERT(!structure->isDictionary());
    395395    ASSERT(structure->typeInfo().type() == ObjectType);
    396396
     
    406406PassRefPtr<Structure> Structure::addPropertyTransition(Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset)
    407407{
    408     ASSERT(!structure->m_isDictionary);
     408    ASSERT(!structure->isDictionary());
    409409    ASSERT(structure->typeInfo().type() == ObjectType);
    410410    ASSERT(!Structure::addPropertyTransitionToExistingStructure(structure, propertyName, attributes, specificValue, offset));
    411411
    412412    if (structure->transitionCount() > s_maxTransitionLength) {
    413         RefPtr<Structure> transition = toDictionaryTransition(structure);
     413        RefPtr<Structure> transition = toCacheableDictionaryTransition(structure);
    414414        ASSERT(structure != transition);
    415415        offset = transition->put(propertyName, attributes, specificValue);
     
    455455PassRefPtr<Structure> Structure::removePropertyTransition(Structure* structure, const Identifier& propertyName, size_t& offset)
    456456{
    457     ASSERT(!structure->m_isDictionary);
    458 
    459     RefPtr<Structure> transition = toDictionaryTransition(structure);
     457    ASSERT(!structure->isUncacheableDictionary());
     458
     459    RefPtr<Structure> transition = toUncacheableDictionaryTransition(structure);
    460460
    461461    offset = transition->remove(propertyName);
     
    555555}
    556556
    557 PassRefPtr<Structure> Structure::toDictionaryTransition(Structure* structure)
    558 {
    559     ASSERT(!structure->m_isDictionary);
    560 
     557PassRefPtr<Structure> Structure::toDictionaryTransition(Structure* structure, DictionaryKind kind)
     558{
     559    ASSERT(!structure->isUncacheableDictionary());
     560   
    561561    RefPtr<Structure> transition = create(structure->m_prototype, structure->typeInfo());
    562     transition->m_isDictionary = true;
     562    transition->m_dictionaryKind = kind;
    563563    transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity;
    564564    transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties;
    565 
     565   
    566566    structure->materializePropertyMapIfNecessary();
    567567    transition->m_propertyTable = structure->copyPropertyTable();
    568568    transition->m_isPinnedPropertyTable = true;
    569 
     569   
    570570    return transition.release();
    571571}
    572572
     573PassRefPtr<Structure> Structure::toCacheableDictionaryTransition(Structure* structure)
     574{
     575    return toDictionaryTransition(structure, CachedDictionaryKind);
     576}
     577
     578PassRefPtr<Structure> Structure::toUncacheableDictionaryTransition(Structure* structure)
     579{
     580    return toDictionaryTransition(structure, UncachedDictionaryKind);
     581}
     582
    573583PassRefPtr<Structure> Structure::fromDictionaryTransition(Structure* structure)
    574584{
    575     ASSERT(structure->m_isDictionary);
     585    ASSERT(structure->isDictionary());
    576586
    577587    // Since dictionary Structures are not shared, and no opcodes specialize
     
    582592    // deleted offsets vector) before transitioning from dictionary.
    583593    if (!structure->m_propertyTable || !structure->m_propertyTable->deletedOffsets || structure->m_propertyTable->deletedOffsets->isEmpty())
    584         structure->m_isDictionary = false;
     594        structure->m_dictionaryKind = NoneDictionaryKind;
    585595
    586596    return structure;
     
    601611size_t Structure::removePropertyWithoutTransition(const Identifier& propertyName)
    602612{
    603     ASSERT(m_isDictionary);
     613    ASSERT(isUncacheableDictionary());
    604614
    605615    materializePropertyMapIfNecessary();
  • trunk/JavaScriptCore/runtime/Structure.h

    r48580 r48582  
    7171        static PassRefPtr<Structure> addAnonymousSlotsTransition(Structure*, unsigned count);
    7272        static PassRefPtr<Structure> getterSetterTransition(Structure*);
    73         static PassRefPtr<Structure> toDictionaryTransition(Structure*);
     73        static PassRefPtr<Structure> toCacheableDictionaryTransition(Structure*);
     74        static PassRefPtr<Structure> toUncacheableDictionaryTransition(Structure*);
    7475        static PassRefPtr<Structure> fromDictionaryTransition(Structure*);
    7576
     
    8283        size_t removePropertyWithoutTransition(const Identifier& propertyName);
    8384        void setPrototypeWithoutTransition(JSValue prototype) { m_prototype = prototype; }
    84 
    85         bool isDictionary() const { return m_isDictionary; }
     85       
     86        bool isDictionary() const { return m_dictionaryKind != NoneDictionaryKind; }
     87        bool isUncacheableDictionary() const { return m_dictionaryKind == UncachedDictionaryKind; }
    8688
    8789        const TypeInfo& typeInfo() const { return m_typeInfo; }
     
    128130    private:
    129131        Structure(JSValue prototype, const TypeInfo&);
     132       
     133        typedef enum {
     134            NoneDictionaryKind = 0,
     135            CachedDictionaryKind = 1,
     136            UncachedDictionaryKind = 2
     137        } DictionaryKind;
     138        static PassRefPtr<Structure> toDictionaryTransition(Structure*, DictionaryKind);
    130139
    131140        size_t put(const Identifier& propertyName, unsigned attributes, JSCell* specificValue);
     
    188197        signed char m_offset;
    189198
    190         bool m_isDictionary : 1;
     199        unsigned m_dictionaryKind : 2;
    191200        bool m_isPinnedPropertyTable : 1;
    192201        bool m_hasGetterSetterProperties : 1;
  • trunk/JavaScriptCore/runtime/StructureChain.cpp

    r48580 r48582  
    5252   
    5353    while (m_vector[i]) {
     54        // Both classes of dictionary structure may change arbitrarily so we can't cache them
    5455        if (m_vector[i]->isDictionary())
    5556            return false;
Note: See TracChangeset for help on using the changeset viewer.