Changeset 202033 in webkit


Ignore:
Timestamp:
Jun 13, 2016, 11:57:15 PM (9 years ago)
Author:
barraclough@apple.com
Message:

setUpStaticFunctionSlot does not handle Builtin|Accessor properties
https://bugs.webkit.org/show_bug.cgi?id=158637

Reviewed by Geoff Garen.

setUpStaticFunctionSlot contains a duplicate copy of the body of the function reifyStaticProperty

  • however it is missing handling for Accessor type under Builtin functions.

Fix the bug by de-duplicating - setUpStaticFunctionSlot should just call reifyStaticProperty.

  • runtime/Lookup.cpp:

(JSC::setUpStaticFunctionSlot):

  • should just call reifyStaticProperty.
  • runtime/Lookup.h:

(JSC::lookupPut):
(JSC::reifyStaticProperty):

  • changed reifyStaticProperty to take PropertyName.
Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r202027 r202033  
     12016-06-13  Gavin & Ellie Barraclough  <barraclough@apple.com>
     2
     3        setUpStaticFunctionSlot does not handle Builtin|Accessor properties
     4        https://bugs.webkit.org/show_bug.cgi?id=158637
     5
     6        Reviewed by Geoff Garen.
     7
     8        setUpStaticFunctionSlot contains a duplicate copy of the body of the function reifyStaticProperty
     9        - however it is missing handling for Accessor type under Builtin functions.
     10        Fix the bug by de-duplicating - setUpStaticFunctionSlot should just call reifyStaticProperty.
     11
     12        * runtime/Lookup.cpp:
     13        (JSC::setUpStaticFunctionSlot):
     14            - should just call reifyStaticProperty.
     15        * runtime/Lookup.h:
     16        (JSC::lookupPut):
     17        (JSC::reifyStaticProperty):
     18            - changed reifyStaticProperty to take PropertyName.
     19
    1202016-06-13  Gavin & Ellie Barraclough  <barraclough@apple.com>
    221
  • trunk/Source/JavaScriptCore/runtime/Lookup.cpp

    r201853 r202033  
    5757            return false;
    5858
    59         if (entry->attributes() & Builtin)
    60             thisObject->putDirectBuiltinFunction(vm, thisObject->globalObject(), propertyName, entry->builtinGenerator()(vm), attributesForStructure(entry->attributes()));
    61         else if (entry->attributes() & Function) {
    62             thisObject->putDirectNativeFunction(
    63                 vm, thisObject->globalObject(), propertyName, entry->functionLength(),
    64                 entry->function(), entry->intrinsic(), attributesForStructure(entry->attributes()));
    65         } else if (isAccessor)
    66             reifyStaticAccessor(vm, *entry, *thisObject, propertyName);
    67         else if (entry->attributes() & CellProperty) {
    68             LazyCellProperty* property = bitwise_cast<LazyCellProperty*>(
    69                 bitwise_cast<char*>(thisObject) + entry->lazyCellPropertyOffset());
    70             JSCell* result = property->get(thisObject);
    71             thisObject->putDirect(vm, propertyName, result, attributesForStructure(entry->attributes()));
    72         } else if (entry->attributes() & ClassStructure) {
    73             LazyClassStructure* structure = bitwise_cast<LazyClassStructure*>(
    74                 bitwise_cast<char*>(thisObject) + entry->lazyClassStructureOffset());
    75             structure->get(jsCast<JSGlobalObject*>(thisObject));
    76         } else if (entry->attributes() & PropertyCallback) {
    77             JSValue result = entry->lazyPropertyCallback()(vm, thisObject);
    78             thisObject->putDirect(vm, propertyName, result, attributesForStructure(entry->attributes()));
    79         } else {
    80             dataLog("Static hashtable entry for ", propertyName, " has weird attributes: ", entry->attributes(), "\n");
    81             RELEASE_ASSERT_NOT_REACHED();
    82         }
     59        reifyStaticProperty(vm, propertyName, *entry, *thisObject);
    8360
    8461        offset = thisObject->getDirectOffset(vm, propertyName, attributes);
  • trunk/Source/JavaScriptCore/runtime/Lookup.h

    r201853 r202033  
    290290}
    291291
    292 inline void reifyStaticProperty(VM& vm, const Identifier& propertyName, const HashTableValue& value, JSObject& thisObj)
     292inline void reifyStaticProperty(VM& vm, const PropertyName& propertyName, const HashTableValue& value, JSObject& thisObj)
    293293{
    294294    if (value.attributes() & Builtin) {
Note: See TracChangeset for help on using the changeset viewer.