Ignore:
Timestamp:
Oct 8, 2009, 4:24:55 PM (16 years ago)
Author:
[email protected]
Message:

Migrated some code that didn't belong out of Structure.

Patch by Geoffrey Garen <[email protected]> on 2009-10-08
Reviewed by Sam Weinig.

SunSpider says maybe 1.03x faster.

  • runtime/JSCell.h: Nixed Structure::markAggregate, and made marking of

a Structure's prototype the direct responsility of the object using it.
(Giving Structure a mark function was misleading because it implied that
all live structures get marked during GC, when they don't.)

  • runtime/JSGlobalObject.cpp:

(JSC::markIfNeeded):
(JSC::JSGlobalObject::markChildren): Added code to mark prototypes stored
on the global object. Maybe this wasn't necessary, but now we don't have
to wonder.

  • runtime/JSObject.cpp:

(JSC::JSObject::getPropertyNames):
(JSC::JSObject::getOwnPropertyNames):
(JSC::JSObject::getEnumerableNamesFromClassInfoTable):

  • runtime/JSObject.h:

(JSC::JSObject::markChildrenDirect):

  • runtime/PropertyNameArray.h:
  • runtime/Structure.cpp:
  • runtime/Structure.h:

(JSC::Structure::setEnumerationCache):
(JSC::Structure::enumerationCache): Moved property name gathering code
from Structure to JSObject because having a Structure iterate its JSObject
was a layering violation. A JSObject is implemented using a Structure; not
the other way around.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/Structure.h

    r49328 r49331  
    3131#include "JSValue.h"
    3232#include "PropertyMapHashTable.h"
     33#include "PropertyNameArray.h"
    3334#include "StructureChain.h"
    3435#include "StructureTransitionTable.h"
     
    7778        ~Structure();
    7879
    79         void markAggregate(MarkStack&);
    80 
    8180        // These should be used with caution. 
    8281        size_t addPropertyWithoutTransition(const Identifier& propertyName, unsigned attributes, JSCell* specificValue);
     
    117116        }
    118117
    119         void getEnumerablePropertyNames(ExecState*, PropertyNameArray&, JSObject*);
    120         void getOwnEnumerablePropertyNames(ExecState*, PropertyNameArray&, JSObject*);
    121 
    122118        bool hasGetterSetterProperties() const { return m_hasGetterSetterProperties; }
    123119        void setHasGetterSetterProperties(bool hasGetterSetterProperties) { m_hasGetterSetterProperties = hasGetterSetterProperties; }
     
    127123        JSCell* specificValue() { return m_specificValueInPrevious; }
    128124        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&);
    129130
    130131    private:
     
    141142        size_t remove(const Identifier& propertyName);
    142143        void addAnonymousSlots(unsigned slotCount);
    143         void getEnumerableNamesFromPropertyTable(PropertyNameArray&);
    144         void getEnumerableNamesFromClassInfoTable(ExecState*, const ClassInfo*, PropertyNameArray&);
    145144
    146145        void expandPropertyMapHashTable();
     
    162161            materializePropertyMap();
    163162        }
    164 
    165         void clearEnumerationCache();
    166163
    167164        signed char transitionCount() const
Note: See TracChangeset for help on using the changeset viewer.