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/JSString.h

    r154038 r154113  
    474474    {
    475475        if (propertyName == exec->propertyNames().length) {
    476             slot.setValue(jsNumber(m_length));
     476            slot.setValue(this, jsNumber(m_length));
    477477            return true;
    478478        }
     
    481481        if (i < m_length) {
    482482            ASSERT(i != PropertyName::NotAnIndex); // No need for an explicit check, the above test would always fail!
    483             slot.setValue(getIndex(exec, i));
     483            slot.setValue(this, getIndex(exec, i));
    484484            return true;
    485485        }
     
    491491    {
    492492        if (propertyName < m_length) {
    493             slot.setValue(getIndex(exec, propertyName));
     493            slot.setValue(this, getIndex(exec, propertyName));
    494494            return true;
    495495        }
Note: See TracChangeset for help on using the changeset viewer.