Ignore:
Timestamp:
Aug 15, 2013, 11:49:05 AM (12 years ago)
Author:
[email protected]
Message:

https://bugs.webkit.org/show_bug.cgi?id=119843
PropertySlot::setValue is ambiguous

Reviewed by Geoff Garen.

There are three different versions of PropertySlot::setValue, one for cacheable properties, and two that are used interchangeably and inconsistently.
The problematic variants are the ones that just take a value, and one that takes a value and also the object containing the property.
Unify on always providing the object, and remove the version that just takes a value.
This always works except for JSString, where we optimize out the object (logically we should be instantiating a temporary StringObject on every property access).
Provide a version of setValue that takes a JSString as the owner of the property.
We won't store this, but it makes it clear that this interface should only be used from JSString.

  • API/JSCallbackObjectFunctions.h:

(JSC::::getOwnPropertySlot):

  • JSCTypedArrayStubs.h:
  • runtime/Arguments.cpp:

(JSC::Arguments::getOwnPropertySlotByIndex):
(JSC::Arguments::getOwnPropertySlot):

  • runtime/JSActivation.cpp:

(JSC::JSActivation::symbolTableGet):
(JSC::JSActivation::getOwnPropertySlot):

  • runtime/JSArray.cpp:

(JSC::JSArray::getOwnPropertySlot):

  • runtime/JSObject.cpp:

(JSC::JSObject::getOwnPropertySlotByIndex):

  • runtime/JSString.h:

(JSC::JSString::getStringPropertySlot):

  • runtime/JSSymbolTableObject.h:

(JSC::symbolTableGet):

  • runtime/SparseArrayValueMap.cpp:

(JSC::SparseArrayEntry::get):

  • Pass object containing property to PropertySlot::setValue
  • runtime/PropertySlot.h:

(JSC::PropertySlot::setValue):

  • Logically, the base of a string property access is a temporary StringObject, but we optimize that away.

(JSC::PropertySlot::setUndefined):

  • removed setValue(JSValue), added setValue(JSString*, JSValue)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/Arguments.cpp

    r154038 r154113  
    9595    Arguments* thisObject = jsCast<Arguments*>(object);
    9696    if (JSValue value = thisObject->tryGetArgument(i)) {
    97         slot.setValue(value);
     97        slot.setValue(thisObject, value);
    9898        return true;
    9999    }
     
    130130    if (JSValue value = thisObject->tryGetArgument(i)) {
    131131        RELEASE_ASSERT(i < PropertyName::NotAnIndex);
    132         slot.setValue(value);
     132        slot.setValue(thisObject, value);
    133133        return true;
    134134    }
    135135
    136136    if (propertyName == exec->propertyNames().length && LIKELY(!thisObject->m_overrodeLength)) {
    137         slot.setValue(jsNumber(thisObject->m_numArguments));
     137        slot.setValue(thisObject, jsNumber(thisObject->m_numArguments));
    138138        return true;
    139139    }
     
    141141    if (propertyName == exec->propertyNames().callee && LIKELY(!thisObject->m_overrodeCallee)) {
    142142        if (!thisObject->m_isStrictMode) {
    143             slot.setValue(thisObject->m_callee.get());
     143            slot.setValue(thisObject, thisObject->m_callee.get());
    144144            return true;
    145145        }
Note: See TracChangeset for help on using the changeset viewer.