⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 201853 in webkit


Ignore:
Timestamp:
Jun 8, 2016, 10:43:46 PM (10 years ago)
Author:
barraclough@apple.com
Message:

JSObject::reifyAllStaticProperties cleanup
https://bugs.webkit.org/show_bug.cgi?id=158543

Reviewed by Mark Lam.

  • JSObject & Structure contain fields labeled 'staticFunctionsReified', however reification now affects all properties, not just functions. Rename to 'staticPropertiesReified'.
  • reifyAllStaticProperties relies on a 'hasStaticProperties' method on ClassInfo that walks the ClassInfo inheritance chain looking for static property tables. We can now more efficiently get this information from TypeInfo.
  • reifyAllStaticProperties triggers a 'toUncacheableDictionaryTransition'; this is overzealous, cacheable dictionary is sufficient - this is what we do in the case of DOM prototype property reification (see 'reifyStaticProperties' in Lookup.h). (Changing this with an eye on switching
DOM prototype property reification to use JSObject
reifyAllStaticProperties, rather than having its own special purpose code path.)
  • runtime/ClassInfo.h:

(JSC::ClassInfo::hasStaticProperties): Deleted.

  • deprecated by TypeInfo::hasStaticPropertyTable.
  • runtime/JSObject.cpp:

(JSC::JSObject::putInlineSlow):
(JSC::JSObject::deleteProperty):
(JSC::JSObject::getOwnNonIndexPropertyNames):

  • staticFunctionsReified -> staticPropertiesReified

(JSC::JSObject::reifyAllStaticProperties):

  • hasStaticProperties -> TypeInfo::hasStaticPropertyTable
  • toUncacheableDictionaryTransition -> toCacheableDictionaryTransition
  • staticFunctionsReified -> staticPropertiesReified
  • runtime/JSObject.h:

(JSC::JSObject::staticPropertiesReified):
(JSC::JSObject::staticFunctionsReified): Deleted.

  • runtime/Lookup.cpp:

(JSC::setUpStaticFunctionSlot):

  • runtime/Lookup.h:

(JSC::getStaticPropertySlotFromTable):
(JSC::replaceStaticPropertySlot):

  • runtime/Structure.cpp:

(JSC::Structure::Structure):

  • runtime/Structure.h:
    • staticFunctionsReified -> staticPropertiesReified
Location:
trunk/Source/JavaScriptCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r201848 r201853  
     12016-06-08  Gavin & Ellie Barraclough  <barraclough@apple.com>
     2
     3        JSObject::reifyAllStaticProperties cleanup
     4        https://bugs.webkit.org/show_bug.cgi?id=158543
     5
     6        Reviewed by Mark Lam.
     7
     8        - JSObject & Structure contain fields labeled 'staticFunctionsReified', however reification now
     9          affects all properties, not just functions. Rename to 'staticPropertiesReified'.
     10        - reifyAllStaticProperties relies on a 'hasStaticProperties' method on ClassInfo that walks the
     11          ClassInfo inheritance chain looking for static property tables. We can now more efficiently
     12          get this information from TypeInfo.
     13        - reifyAllStaticProperties triggers a 'toUncacheableDictionaryTransition'; this is overzealous,
     14          cacheable dictionary is sufficient - this is what we do in the case of DOM prototype property
     15          reification (see 'reifyStaticProperties' in Lookup.h). (Changing this with an eye on switching
     16          DOM prototype property reification to use JSObject:: reifyAllStaticProperties, rather than
     17          having its own special purpose code path.)
     18
     19        * runtime/ClassInfo.h:
     20        (JSC::ClassInfo::hasStaticProperties): Deleted.
     21            - deprecated by TypeInfo::hasStaticPropertyTable.
     22        * runtime/JSObject.cpp:
     23        (JSC::JSObject::putInlineSlow):
     24        (JSC::JSObject::deleteProperty):
     25        (JSC::JSObject::getOwnNonIndexPropertyNames):
     26            - staticFunctionsReified -> staticPropertiesReified
     27        (JSC::JSObject::reifyAllStaticProperties):
     28            - hasStaticProperties -> TypeInfo::hasStaticPropertyTable
     29            - toUncacheableDictionaryTransition -> toCacheableDictionaryTransition
     30            - staticFunctionsReified -> staticPropertiesReified
     31        * runtime/JSObject.h:
     32        (JSC::JSObject::staticPropertiesReified):
     33        (JSC::JSObject::staticFunctionsReified): Deleted.
     34        * runtime/Lookup.cpp:
     35        (JSC::setUpStaticFunctionSlot):
     36        * runtime/Lookup.h:
     37        (JSC::getStaticPropertySlotFromTable):
     38        (JSC::replaceStaticPropertySlot):
     39        * runtime/Structure.cpp:
     40        (JSC::Structure::Structure):
     41        * runtime/Structure.h:
     42            - staticFunctionsReified -> staticPropertiesReified
     43
    1442016-06-08  Benjamin Poulain  <bpoulain@apple.com>
    245
  • trunk/Source/JavaScriptCore/runtime/ClassInfo.h

    r198023 r201853  
    198198    }
    199199
    200     bool hasStaticProperties() const
    201     {
    202         for (const ClassInfo* ci = this; ci; ci = ci->parentClass) {
    203             if (ci->staticPropHashTable)
    204                 return true;
    205         }
    206         return false;
    207     }
    208 
    209200    JS_EXPORT_PRIVATE bool hasStaticSetterOrReadonlyProperties() const;
    210201
  • trunk/Source/JavaScriptCore/runtime/JSObject.cpp

    r201834 r201853  
    569569            break;
    570570        }
    571         if (!obj->staticFunctionsReified()) {
     571        if (!obj->staticPropertiesReified()) {
    572572            if (obj->classInfo()->hasStaticSetterOrReadonlyProperties()) {
    573573                if (auto* entry = obj->findPropertyHashEntry(propertyName))
     
    14991499    unsigned attributes;
    15001500
    1501     if (!thisObject->staticFunctionsReified()) {
     1501    if (!thisObject->staticPropertiesReified()) {
    15021502        if (auto* entry = thisObject->findPropertyHashEntry(propertyName)) {
    15031503            // If the static table contains a non-configurable (DontDelete) property then we can return early;
     
    18911891void JSObject::getOwnNonIndexPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
    18921892{
    1893     if (!object->staticFunctionsReified())
     1893    if (!object->staticPropertiesReified())
    18941894        getClassPropertyNames(exec, object->classInfo(), propertyNames, mode);
    18951895
     
    19661966void JSObject::reifyAllStaticProperties(ExecState* exec)
    19671967{
    1968     ASSERT(!staticFunctionsReified());
     1968    ASSERT(!staticPropertiesReified());
    19691969    VM& vm = exec->vm();
    19701970
    19711971    // If this object's ClassInfo has no static properties, then nothing to reify!
    19721972    // We can safely set the flag to avoid the expensive check again in the future.
    1973     if (!classInfo()->hasStaticProperties()) {
    1974         structure(vm)->setStaticFunctionsReified(true);
     1973    if (!TypeInfo::hasStaticPropertyTable(inlineTypeFlags())) {
     1974        structure(vm)->setStaticPropertiesReified(true);
    19751975        return;
    19761976    }
    19771977
    1978     if (!structure(vm)->isUncacheableDictionary())
    1979         setStructure(vm, Structure::toUncacheableDictionaryTransition(vm, structure(vm)));
     1978    if (!structure(vm)->isDictionary())
     1979        setStructure(vm, Structure::toCacheableDictionaryTransition(vm, structure(vm)));
    19801980
    19811981    for (const ClassInfo* info = classInfo(); info; info = info->parentClass) {
     
    19931993    }
    19941994
    1995     structure(vm)->setStaticFunctionsReified(true);
     1995    structure(vm)->setStaticPropertiesReified(true);
    19961996}
    19971997
  • trunk/Source/JavaScriptCore/runtime/JSObject.h

    r201834 r201853  
    679679    }
    680680
    681     bool staticFunctionsReified() { return structure()->staticFunctionsReified(); }
     681    bool staticPropertiesReified() { return structure()->staticPropertiesReified(); }
    682682    void reifyAllStaticProperties(ExecState*);
    683683
  • trunk/Source/JavaScriptCore/runtime/Lookup.cpp

    r201448 r201853  
    5454        // If a property is ever deleted from an object with a static table, then we reify
    5555        // all static functions at that time - after this we shouldn't be re-adding anything.
    56         if (thisObject->staticFunctionsReified())
     56        if (thisObject->staticPropertiesReified())
    5757            return false;
    5858
  • trunk/Source/JavaScriptCore/runtime/Lookup.h

    r201719 r201853  
    211211inline bool getStaticPropertySlotFromTable(VM& vm, const HashTable& table, JSObject* thisObject, PropertyName propertyName, PropertySlot& slot)
    212212{
    213     if (thisObject->staticFunctionsReified())
     213    if (thisObject->staticPropertiesReified())
    214214        return false;
    215215
     
    235235        return false;
    236236
    237     if (!thisObject->staticFunctionsReified())
     237    if (!thisObject->staticPropertiesReified())
    238238        thisObject->JSObject::setStructure(vm, Structure::attributeChangeTransition(vm, thisObject->structure(), propertyName, 0));
    239239
  • trunk/Source/JavaScriptCore/runtime/Structure.cpp

    r201590 r201853  
    206206    setDidPreventExtensions(false);
    207207    setDidTransition(false);
    208     setStaticFunctionsReified(false);
     208    setStaticPropertiesReified(false);
    209209    setTransitionWatchpointIsLikelyToBeFired(false);
    210210    setHasBeenDictionary(false);
     
    237237    setDidPreventExtensions(false);
    238238    setDidTransition(false);
    239     setStaticFunctionsReified(false);
     239    setStaticPropertiesReified(false);
    240240    setTransitionWatchpointIsLikelyToBeFired(false);
    241241    setHasBeenDictionary(false);
     
    267267    setDidPreventExtensions(previous->didPreventExtensions());
    268268    setDidTransition(true);
    269     setStaticFunctionsReified(previous->staticFunctionsReified());
     269    setStaticPropertiesReified(previous->staticPropertiesReified());
    270270    setHasBeenDictionary(previous->hasBeenDictionary());
    271271 
  • trunk/Source/JavaScriptCore/runtime/Structure.h

    r201590 r201853  
    610610    DEFINE_BITFIELD(bool, didPreventExtensions, DidPreventExtensions, 1, 20);
    611611    DEFINE_BITFIELD(bool, didTransition, DidTransition, 1, 21);
    612     DEFINE_BITFIELD(bool, staticFunctionsReified, StaticFunctionsReified, 1, 22);
     612    DEFINE_BITFIELD(bool, staticPropertiesReified, StaticPropertiesReified, 1, 22);
    613613    DEFINE_BITFIELD(bool, hasBeenFlattenedBefore, HasBeenFlattenedBefore, 1, 23);
    614614    DEFINE_BITFIELD(bool, hasCustomGetterSetterProperties, HasCustomGetterSetterProperties, 1, 24);
Note: See TracChangeset for help on using the changeset viewer.