Changeset 36310 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Sep 9, 2008, 7:36:47 PM (17 years ago)
Author:
[email protected]
Message:

2008-09-09 Sam Weinig <[email protected]>

Reviewed by Cameron Zwarich.

Don't waste the first item in the PropertyStorage.

  • Fix typo (makingCount -> markingCount)
  • Remove undefined method declaration.

No change on Sunspider.

  • kjs/JSObject.cpp: (JSC::JSObject::mark):
  • kjs/PropertyMap.cpp: (JSC::PropertyMap::put): (JSC::PropertyMap::remove): (JSC::PropertyMap::getOffset): (JSC::PropertyMap::insert): (JSC::PropertyMap::rehash): (JSC::PropertyMap::resizePropertyStorage): (JSC::PropertyMap::checkConsistency):
  • kjs/PropertyMap.h: (JSC::PropertyMap::markingCount): Fix typo.
Location:
trunk/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r36308 r36310  
     12008-09-09  Sam Weinig  <[email protected]>
     2
     3        Reviewed by Cameron Zwarich.
     4
     5        Don't waste the first item in the PropertyStorage.
     6
     7        - Fix typo (makingCount -> markingCount)
     8        - Remove undefined method declaration.
     9
     10        No change on Sunspider.
     11
     12        * kjs/JSObject.cpp:
     13        (JSC::JSObject::mark):
     14        * kjs/PropertyMap.cpp:
     15        (JSC::PropertyMap::put):
     16        (JSC::PropertyMap::remove):
     17        (JSC::PropertyMap::getOffset):
     18        (JSC::PropertyMap::insert):
     19        (JSC::PropertyMap::rehash):
     20        (JSC::PropertyMap::resizePropertyStorage):
     21        (JSC::PropertyMap::checkConsistency):
     22        * kjs/PropertyMap.h:
     23        (JSC::PropertyMap::markingCount): Fix typo.
     24
    1252008-09-09  Cameron Zwarich  <[email protected]>
    226
  • trunk/JavaScriptCore/kjs/JSObject.cpp

    r36304 r36310  
    7171    m_structureID->mark();
    7272
    73     unsigned storageSize = m_structureID->propertyMap().makingCount();
     73    unsigned storageSize = m_structureID->propertyMap().markingCount();
    7474    if (storageSize) {
    75         for (unsigned i = 1; i <= storageSize; ++i) {
     75        for (unsigned i = 0; i < storageSize; ++i) {
    7676            JSValue* v = m_propertyStorage[i];
    7777            if (!v->marked())
  • trunk/JavaScriptCore/kjs/PropertyMap.cpp

    r36304 r36310  
    150150                return;
    151151            // Put a new value in an existing hash table entry.
    152             propertyStorage[entryIndex - 1] = value;
     152            propertyStorage[entryIndex - 2] = value;
    153153            // Attributes are intentionally not updated.
    154             slot.setExistingProperty(slotBase, entryIndex - 1);
     154            slot.setExistingProperty(slotBase, entryIndex - 2);
    155155            return;
    156156        } else if (entryIndex == deletedSentinelIndex) {
     
    199199    ++m_table->keyCount;
    200200
    201     propertyStorage[entryIndex - 1] = value;
     201    propertyStorage[entryIndex - 2] = value;
    202202
    203203    if ((m_table->keyCount + m_table->deletedSentinelCount) * 2 >= m_table->size)
     
    205205
    206206    checkConsistency(propertyStorage);
    207     slot.setNewProperty(slotBase, entryIndex - 1);
     207    slot.setNewProperty(slotBase, entryIndex - 2);
    208208}
    209209
     
    259259    m_table->entries()[entryIndex - 1].attributes = 0;
    260260
    261     propertyStorage[entryIndex - 1] = jsUndefined();
     261    propertyStorage[entryIndex - 2] = jsUndefined();
    262262
    263263    ASSERT(m_table->keyCount >= 1);
     
    291291
    292292    if (rep == m_table->entries()[entryIndex - 1].key)
    293         return entryIndex - 1;
     293        return entryIndex - 2;
    294294
    295295#if DUMP_PROPERTYMAP_STATS
     
    311311
    312312        if (rep == m_table->entries()[entryIndex - 1].key)
    313             return entryIndex - 1;
     313            return entryIndex - 2;
    314314    }
    315315}
     
    336336    if (rep == m_table->entries()[entryIndex - 1].key) {
    337337        attributes = m_table->entries()[entryIndex - 1].attributes;
    338         return entryIndex - 1;
     338        return entryIndex - 2;
    339339    }
    340340
     
    358358        if (rep == m_table->entries()[entryIndex - 1].key) {
    359359            attributes = m_table->entries()[entryIndex - 1].attributes;
    360             return entryIndex - 1;
     360            return entryIndex - 2;
    361361        }
    362362    }
     
    384384    if (rep == m_table->entries()[entryIndex - 1].key) {
    385385        isWriteable = !(m_table->entries()[entryIndex - 1].attributes & ReadOnly);
    386         return entryIndex - 1;
     386        return entryIndex - 2;
    387387    }
    388388
     
    406406        if (rep == m_table->entries()[entryIndex - 1].key) {
    407407            isWriteable = !(m_table->entries()[entryIndex - 1].attributes & ReadOnly);
    408             return entryIndex - 1;
     408            return entryIndex - 2;
    409409        }
    410410    }
     
    445445    m_table->entries()[entryIndex - 1] = entry;
    446446
    447     propertyStorage[entryIndex - 1] = value;
     447    propertyStorage[entryIndex - 2] = value;
    448448
    449449    ++m_table->keyCount;
     
    502502        if (oldTable->entries()[i].key) {
    503503            lastIndexUsed = max(oldTable->entries()[i].index, lastIndexUsed);
    504             insert(oldTable->entries()[i], oldPropertStorage[i], propertyStorage);
     504            insert(oldTable->entries()[i], oldPropertStorage[i - 1], propertyStorage);
    505505        }
    506506    }
     
    522522
    523523        // FIXME: this can probalby use memcpy
    524         for (unsigned i = 1; i <= oldSize; ++i)
     524        for (unsigned i = 0; i < oldSize; ++i)
    525525            propertyStorage[i] = oldPropertStorage[i];
    526526
     
    634634        UString::Rep* rep = m_table->entries()[c].key;
    635635        if (!rep) {
    636             ASSERT(propertyStorage[c]->isUndefined());
     636            ASSERT(propertyStorage[c - 1]->isUndefined());
    637637            continue;
    638638        }
  • trunk/JavaScriptCore/kjs/PropertyMap.h

    r36306 r36310  
    102102
    103103        unsigned size() const { return m_table ? m_table->size : 0; }
    104         unsigned makingCount() const { return m_table ? m_table->keyCount + m_table->deletedSentinelCount : 0; }
     104        unsigned markingCount() const { return m_table ? m_table->keyCount + m_table->deletedSentinelCount : 0; }
    105105
    106106        void resizePropertyStorage(PropertyStorage&, unsigned oldSize);
     
    110110        typedef PropertyMapHashTable Table;
    111111
    112         static bool keysMatch(const UString::Rep*, const UString::Rep*);
    113112        void expand(PropertyStorage&);
    114113        void rehash(PropertyStorage&);
Note: See TracChangeset for help on using the changeset viewer.