Changeset 49328 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Oct 8, 2009, 3:25:14 PM (16 years ago)
Author:
[email protected]
Message:

Rolled out r49322 and friends because they killed the build

Location:
trunk/JavaScriptCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r49325 r49328  
    1 2009-10-08  Geoffrey Garen  <[email protected]>
    2 
    3         Windows build fix: Added missing #include.
    4        
    5         * runtime/JSGlobalData.h:
    6 
    7 2009-10-01  Geoffrey Garen  <[email protected]>
    8 
    9         Reviewed by Sam Weinig.
    10 
    11         Take one branch instead of two to test for JSValue().
    12        
    13         1.1% SunSpider speedup.
    14 
    15         * jit/JITCall.cpp:
    16         (JSC::JIT::compileOpCall):
    17         * jit/JITOpcodes.cpp:
    18         (JSC::JIT::emit_op_to_jsnumber):
    19         (JSC::JIT::emit_op_create_arguments):
    20         * jit/JITPropertyAccess.cpp:
    21         (JSC::JIT::emitSlow_op_get_by_val):
    22         (JSC::JIT::emit_op_put_by_val): Test for the empty value tag, instead
    23         of testing for the cell tag with a 0 payload.
    24 
    25         * runtime/JSValue.cpp:
    26         (JSC::JSValue::description): Added support for dumping the new empty value,
    27         and deleted values, in debug builds.
    28 
    29         * runtime/JSValue.h:
    30         (JSC::JSValue::JSValue()): Construct JSValue() with the empty value tag.
    31 
    32         (JSC::JSValue::JSValue(JSCell*)): Convert null pointer to the empty value
    33         tag, to avoid having two different c++ versions of null / empty.
    34 
    35         (JSC::JSValue::operator bool): Test for the empty value tag, instead
    36         of testing for the cell tag with a 0 payload.
    37 
    38 2009-10-08  Geoffrey Garen  <[email protected]>
    39 
    40         Reviewed by Sam Weinig.
    41 
    42         Migrated some code that didn't belong out of Structure.
    43        
    44         SunSpider says maybe 1.03x faster.
    45 
    46         * runtime/JSCell.h: Nixed Structure::markAggregate, and made marking of
    47         a Structure's prototype the direct responsility of the object using it.
    48         (Giving Structure a mark function was misleading because it implied that
    49         all live structures get marked during GC, when they don't.)
    50        
    51         * runtime/JSGlobalObject.cpp:
    52         (JSC::markIfNeeded):
    53         (JSC::JSGlobalObject::markChildren): Added code to mark prototypes stored
    54         on the global object. Maybe this wasn't necessary, but now we don't have
    55         to wonder.
    56 
    57         * runtime/JSObject.cpp:
    58         (JSC::JSObject::getPropertyNames):
    59         (JSC::JSObject::getOwnPropertyNames):
    60         (JSC::JSObject::getEnumerableNamesFromClassInfoTable):
    61         * runtime/JSObject.h:
    62         (JSC::JSObject::markChildrenDirect):
    63         * runtime/PropertyNameArray.h:
    64         * runtime/Structure.cpp:
    65         * runtime/Structure.h:
    66         (JSC::Structure::setEnumerationCache):
    67         (JSC::Structure::enumerationCache): Moved property name gathering code
    68         from Structure to JSObject because having a Structure iterate its JSObject
    69         was a layering violation. A JSObject is implemented using a Structure; not
    70         the other way around.
    71 
    7212009-10-08  Zoltan Herczeg  <[email protected]>
    732
  • trunk/JavaScriptCore/runtime/JSCell.h

    r49323 r49328  
    343343    }
    344344
     345    inline void Structure::markAggregate(MarkStack& markStack)
     346    {
     347        markStack.append(m_prototype);
     348    }
     349
    345350    inline Heap* Heap::heap(JSValue v)
    346351    {
  • trunk/JavaScriptCore/runtime/JSGlobalData.h

    r49324 r49328  
    3737#include "NumericStrings.h"
    3838#include "SmallStrings.h"
    39 #include "Structure.h"
    4039#include "TimeoutChecker.h"
    4140#include <wtf/Forward.h>
  • trunk/JavaScriptCore/runtime/JSGlobalObject.cpp

    r49323 r49328  
    9090{
    9191    if (s)
    92         markIfNeeded(markStack, s->storedPrototype());
     92        s->markAggregate(markStack);
    9393}
    9494
     
    395395
    396396    markIfNeeded(markStack, d()->errorStructure);
    397     markIfNeeded(markStack, d()->argumentsStructure);
    398     markIfNeeded(markStack, d()->arrayStructure);
    399     markIfNeeded(markStack, d()->booleanObjectStructure);
    400     markIfNeeded(markStack, d()->callbackConstructorStructure);
    401     markIfNeeded(markStack, d()->callbackFunctionStructure);
    402     markIfNeeded(markStack, d()->callbackObjectStructure);
    403     markIfNeeded(markStack, d()->dateStructure);
    404     markIfNeeded(markStack, d()->emptyObjectStructure);
    405     markIfNeeded(markStack, d()->errorStructure);
    406     markIfNeeded(markStack, d()->functionStructure);
    407     markIfNeeded(markStack, d()->numberObjectStructure);
    408     markIfNeeded(markStack, d()->prototypeFunctionStructure);
    409     markIfNeeded(markStack, d()->regExpMatchesArrayStructure);
    410     markIfNeeded(markStack, d()->regExpStructure);
    411     markIfNeeded(markStack, d()->stringObjectStructure);
    412397
    413398    // No need to mark the other structures, because their prototypes are all
  • trunk/JavaScriptCore/runtime/JSObject.cpp

    r49323 r49328  
    4343ASSERT_CLASS_FITS_IN_CELL(JSObject);
    4444
    45 static inline void getEnumerablePropertyNames(ExecState* exec, const ClassInfo* classInfo, PropertyNameArray& propertyNames)
    46 {
    47     // Add properties from the static hashtables of properties
    48     for (; classInfo; classInfo = classInfo->parentClass) {
    49         const HashTable* table = classInfo->propHashTable(exec);
    50         if (!table)
    51             continue;
    52         table->initializeIfNeeded(exec);
    53         ASSERT(table->table);
    54 
    55         int hashSizeMask = table->compactSize - 1;
    56         const HashEntry* entry = table->table;
    57         for (int i = 0; i <= hashSizeMask; ++i, ++entry) {
    58             if (entry->key() && !(entry->attributes() & DontEnum))
    59                 propertyNames.add(entry->key());
    60         }
    61     }
    62 }
    63 
    6445void JSObject::markChildren(MarkStack& markStack)
    6546{
     
    444425void JSObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
    445426{
    446     bool shouldCache = propertyNames.shouldCache() && !(propertyNames.size() || m_structure->isDictionary());
    447 
    448     if (shouldCache) {
    449         if (PropertyNameArrayData* data = m_structure->enumerationCache()) {
    450             if (data->cachedPrototypeChain() == m_structure->prototypeChain(exec)) {
    451                 propertyNames.setData(data);
    452                 return;
    453             }
    454 
    455             m_structure->clearEnumerationCache();
    456         }
    457     }
    458 
    459     getOwnPropertyNames(exec, propertyNames);
    460 
    461     if (prototype().isObject()) {
    462         propertyNames.setShouldCache(false); // No need for our prototypes to waste memory on caching, since they're not being enumerated directly.
    463         JSObject* prototype = asObject(this->prototype());
    464         while(1) {
    465             if (!prototype->structure()->typeInfo().hasDefaultGetPropertyNames()) {
    466                 prototype->getPropertyNames(exec, propertyNames);
    467                 break;
    468             }
    469             prototype->getOwnPropertyNames(exec, propertyNames);
    470             JSValue nextProto = prototype->prototype();
    471             if (!nextProto.isObject())
    472                 break;
    473             prototype = asObject(nextProto);
    474         }
    475     }
    476 
    477     if (shouldCache) {
    478         StructureChain* protoChain = m_structure->prototypeChain(exec);
    479         if (!protoChain->isCacheable())
    480             return;
    481         RefPtr<PropertyNameArrayData> data = propertyNames.data();
    482         data->setCachedPrototypeChain(protoChain);
    483         data->setCachedStructure(m_structure);
    484         m_structure->setEnumerationCache(data.release());
    485     }
     427    m_structure->getEnumerablePropertyNames(exec, propertyNames, this);
    486428}
    487429
    488430void JSObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
    489431{
    490     m_structure->getEnumerablePropertyNames(propertyNames);
    491     getEnumerablePropertyNames(exec, classInfo(), propertyNames);
     432    m_structure->getOwnEnumerablePropertyNames(exec, propertyNames, this);
    492433}
    493434
  • trunk/JavaScriptCore/runtime/JSObject.h

    r49323 r49328  
    683683    JSCell::markChildren(markStack);
    684684
    685     markStack.append(prototype());
     685    m_structure->markAggregate(markStack);
    686686   
    687687    PropertyStorage storage = propertyStorage();
  • trunk/JavaScriptCore/runtime/PropertyNameArray.h

    r49323 r49328  
    2424#include "CallFrame.h"
    2525#include "Identifier.h"
    26 #include "StructureChain.h"
     26#include "Structure.h"
    2727#include <wtf/HashSet.h>
    2828#include <wtf/Vector.h>
    2929
    3030namespace JSC {
    31    
    32     class Structure;
    3331
    3432    class PropertyNameArrayData : public RefCounted<PropertyNameArrayData> {
  • trunk/JavaScriptCore/runtime/Structure.cpp

    r49323 r49328  
    283283}
    284284
     285void Structure::getOwnEnumerablePropertyNames(ExecState* exec, PropertyNameArray& propertyNames, JSObject* baseObject)
     286{
     287    getEnumerableNamesFromPropertyTable(propertyNames);
     288    getEnumerableNamesFromClassInfoTable(exec, baseObject->classInfo(), propertyNames);
     289}
     290
     291void Structure::getEnumerablePropertyNames(ExecState* exec, PropertyNameArray& propertyNames, JSObject* baseObject)
     292{
     293    bool shouldCache = propertyNames.shouldCache() && !(propertyNames.size() || isDictionary());
     294
     295    if (shouldCache && m_cachedPropertyNameArrayData) {
     296        if (m_cachedPropertyNameArrayData->cachedPrototypeChain() == prototypeChain(exec)) {
     297            propertyNames.setData(m_cachedPropertyNameArrayData);
     298            return;
     299        }
     300        clearEnumerationCache();
     301    }
     302
     303    baseObject->getOwnPropertyNames(exec, propertyNames);
     304
     305    if (m_prototype.isObject()) {
     306        propertyNames.setShouldCache(false); // No need for our prototypes to waste memory on caching, since they're not being enumerated directly.
     307        JSObject* prototype = asObject(m_prototype);
     308        while(1) {
     309            if (!prototype->structure()->typeInfo().hasDefaultGetPropertyNames()) {
     310                prototype->getPropertyNames(exec, propertyNames);
     311                break;
     312            }
     313            prototype->getOwnPropertyNames(exec, propertyNames);
     314            JSValue nextProto = prototype->prototype();
     315            if (!nextProto.isObject())
     316                break;
     317            prototype = asObject(nextProto);
     318        }
     319    }
     320
     321    if (shouldCache) {
     322        StructureChain* protoChain = prototypeChain(exec);
     323        m_cachedPropertyNameArrayData = propertyNames.data();
     324        if (!protoChain->isCacheable())
     325            return;
     326        m_cachedPropertyNameArrayData->setCachedPrototypeChain(protoChain);
     327        m_cachedPropertyNameArrayData->setCachedStructure(this);
     328    }
     329}
     330
    285331void Structure::clearEnumerationCache()
    286332{
     
    10121058}
    10131059
    1014 void Structure::getEnumerablePropertyNames(PropertyNameArray& propertyNames)
     1060void Structure::getEnumerableNamesFromPropertyTable(PropertyNameArray& propertyNames)
    10151061{
    10161062    materializePropertyMapIfNecessary();
     
    10661112        for (size_t i = 0; i < sortedEnumerables.size(); ++i)
    10671113            propertyNames.add(sortedEnumerables[i]->key);
     1114    }
     1115}
     1116
     1117void Structure::getEnumerableNamesFromClassInfoTable(ExecState* exec, const ClassInfo* classInfo, PropertyNameArray& propertyNames)
     1118{
     1119    // Add properties from the static hashtables of properties
     1120    for (; classInfo; classInfo = classInfo->parentClass) {
     1121        const HashTable* table = classInfo->propHashTable(exec);
     1122        if (!table)
     1123            continue;
     1124        table->initializeIfNeeded(exec);
     1125        ASSERT(table->table);
     1126
     1127        int hashSizeMask = table->compactSize - 1;
     1128        const HashEntry* entry = table->table;
     1129        for (int i = 0; i <= hashSizeMask; ++i, ++entry) {
     1130            if (entry->key() && !(entry->attributes() & DontEnum))
     1131                propertyNames.add(entry->key());
     1132        }
    10681133    }
    10691134}
  • trunk/JavaScriptCore/runtime/Structure.h

    r49323 r49328  
    3131#include "JSValue.h"
    3232#include "PropertyMapHashTable.h"
    33 #include "PropertyNameArray.h"
    3433#include "StructureChain.h"
    3534#include "StructureTransitionTable.h"
     
    7877        ~Structure();
    7978
     79        void markAggregate(MarkStack&);
     80
    8081        // These should be used with caution. 
    8182        size_t addPropertyWithoutTransition(const Identifier& propertyName, unsigned attributes, JSCell* specificValue);
     
    116117        }
    117118
     119        void getEnumerablePropertyNames(ExecState*, PropertyNameArray&, JSObject*);
     120        void getOwnEnumerablePropertyNames(ExecState*, PropertyNameArray&, JSObject*);
     121
    118122        bool hasGetterSetterProperties() const { return m_hasGetterSetterProperties; }
    119123        void setHasGetterSetterProperties(bool hasGetterSetterProperties) { m_hasGetterSetterProperties = hasGetterSetterProperties; }
     
    123127        JSCell* specificValue() { return m_specificValueInPrevious; }
    124128        void despecifyDictionaryFunction(const Identifier& propertyName);
    125 
    126         void setEnumerationCache(PassRefPtr<PropertyNameArrayData> data) { m_cachedPropertyNameArrayData = data; }
    127         PropertyNameArrayData* enumerationCache() { return m_cachedPropertyNameArrayData.get(); }
    128         void clearEnumerationCache();
    129         void getEnumerablePropertyNames(PropertyNameArray&);
    130129
    131130    private:
     
    142141        size_t remove(const Identifier& propertyName);
    143142        void addAnonymousSlots(unsigned slotCount);
     143        void getEnumerableNamesFromPropertyTable(PropertyNameArray&);
     144        void getEnumerableNamesFromClassInfoTable(ExecState*, const ClassInfo*, PropertyNameArray&);
    144145
    145146        void expandPropertyMapHashTable();
     
    161162            materializePropertyMap();
    162163        }
     164
     165        void clearEnumerationCache();
    163166
    164167        signed char transitionCount() const
Note: See TracChangeset for help on using the changeset viewer.