Ignore:
Timestamp:
Aug 18, 2013, 12:29:15 PM (12 years ago)
Author:
[email protected]
Message:

https://bugs.webkit.org/show_bug.cgi?id=119972
Add attributes field to PropertySlot

Reviewed by Geoff Garen.

For all JSC types, this makes getOwnPropertyDescriptor redundant.
There will be a bit more hacking required in WebCore to remove GOPD whilst maintaining current behaviour.
(Current behaviour is in many ways broken, particularly in that GOPD & GOPS are inconsistent, but we should fix incrementally).

Source/JavaScriptCore:

No performance impact.

  • runtime/PropertySlot.h:

(JSC::PropertySlot::setValue):
(JSC::PropertySlot::setCustom):
(JSC::PropertySlot::setCacheableCustom):
(JSC::PropertySlot::setCustomIndex):
(JSC::PropertySlot::setGetterSlot):
(JSC::PropertySlot::setCacheableGetterSlot):

  • These mathods now all require 'attributes'.
  • runtime/JSObject.h:

(JSC::JSObject::getDirect):
(JSC::JSObject::getDirectOffset):
(JSC::JSObject::inlineGetOwnPropertySlot):

  • Added variants of getDirect, getDirectOffset that return the attributes.
  • API/JSCallbackObjectFunctions.h:

(JSC::::getOwnPropertySlot):

  • 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/JSArrayBuffer.cpp:

(JSC::JSArrayBuffer::getOwnPropertySlot):

  • runtime/JSArrayBufferView.cpp:

(JSC::JSArrayBufferView::getOwnPropertySlot):

  • runtime/JSDataView.cpp:

(JSC::JSDataView::getOwnPropertySlot):

  • runtime/JSFunction.cpp:

(JSC::JSFunction::getOwnPropertySlot):

  • runtime/JSGenericTypedArrayViewInlines.h:

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

  • runtime/JSObject.cpp:

(JSC::JSObject::getOwnPropertySlotByIndex):
(JSC::JSObject::fillGetterPropertySlot):

  • runtime/JSString.h:

(JSC::JSString::getStringPropertySlot):

  • runtime/JSSymbolTableObject.h:

(JSC::symbolTableGet):

  • runtime/Lookup.cpp:

(JSC::setUpStaticFunctionSlot):

  • runtime/Lookup.h:

(JSC::getStaticPropertySlot):
(JSC::getStaticPropertyDescriptor):
(JSC::getStaticValueSlot):
(JSC::getStaticValueDescriptor):

  • runtime/RegExpObject.cpp:

(JSC::RegExpObject::getOwnPropertySlot):

  • runtime/SparseArrayValueMap.cpp:

(JSC::SparseArrayEntry::get):

  • Pass attributes to PropertySlot::set* methods.

Source/WebCore:

  • bindings/js/JSCSSStyleDeclarationCustom.cpp:

(WebCore::JSCSSStyleDeclaration::getOwnPropertySlotDelegate):

  • bindings/js/JSDOMWindowCustom.cpp:

(WebCore::JSDOMWindow::getOwnPropertySlot):
(WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
(WebCore::JSDOMWindow::getOwnPropertyDescriptor):

  • bindings/js/JSHistoryCustom.cpp:

(WebCore::JSHistory::getOwnPropertySlotDelegate):
(WebCore::JSHistory::getOwnPropertyDescriptorDelegate):

  • bindings/js/JSLocationCustom.cpp:

(WebCore::JSLocation::getOwnPropertySlotDelegate):
(WebCore::JSLocation::getOwnPropertyDescriptorDelegate):

  • bindings/js/JSPluginElementFunctions.cpp:

(WebCore::runtimeObjectCustomGetOwnPropertySlot):
(WebCore::runtimeObjectCustomGetOwnPropertyDescriptor):

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateGetOwnPropertySlotBody):
(GenerateGetOwnPropertyDescriptorBody):
(GenerateImplementation):

  • bridge/runtime_array.cpp:

(JSC::RuntimeArray::getOwnPropertySlot):
(JSC::RuntimeArray::getOwnPropertyDescriptor):
(JSC::RuntimeArray::getOwnPropertySlotByIndex):

  • bridge/runtime_method.cpp:

(JSC::RuntimeMethod::getOwnPropertySlot):
(JSC::RuntimeMethod::getOwnPropertyDescriptor):

  • bridge/runtime_object.cpp:

(JSC::Bindings::RuntimeObject::getOwnPropertySlot):
(JSC::Bindings::RuntimeObject::getOwnPropertyDescriptor):

  • Pass attributes to PropertySlot::set* methods.

Source/WebKit2:

  • WebProcess/Plugins/Netscape/JSNPObject.cpp:

(WebKit::JSNPObject::getOwnPropertySlot):
(WebKit::JSNPObject::getOwnPropertyDescriptor):

  • Pass attributes to PropertySlot::set* methods.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/PropertySlot.h

    r154113 r154253  
    3333class ExecState;
    3434class GetterSetter;
     35
     36// ECMA 262-3 8.6.1
     37// Property attributes
     38enum Attribute {
     39    None         = 0,
     40    ReadOnly     = 1 << 1,  // property can be only read, not written
     41    DontEnum     = 1 << 2,  // property doesn't appear in (for .. in ..)
     42    DontDelete   = 1 << 3,  // property can't be deleted
     43    Function     = 1 << 4,  // property is a function - only used by static hashtables
     44    Accessor     = 1 << 5,  // property is a getter/setter
     45};
    3546
    3647class PropertySlot {
     
    8091    }
    8192
    82     void setValue(JSObject* slotBase, JSValue value)
     93    void setValue(JSObject* slotBase, unsigned attributes, JSValue value)
    8394    {
    8495        ASSERT(value);
    8596        m_data.value = JSValue::encode(value);
     97        m_attributes = attributes;
    8698
    8799        ASSERT(slotBase);
     
    91103    }
    92104   
    93     void setValue(JSObject* slotBase, JSValue value, PropertyOffset offset)
     105    void setValue(JSObject* slotBase, unsigned attributes, JSValue value, PropertyOffset offset)
    94106    {
    95107        ASSERT(value);
    96108        m_data.value = JSValue::encode(value);
     109        m_attributes = attributes;
    97110
    98111        ASSERT(slotBase);
     
    102115    }
    103116
    104     void setValue(JSString*, JSValue value)
     117    void setValue(JSString*, unsigned attributes, JSValue value)
    105118    {
    106119        ASSERT(value);
    107120        m_data.value = JSValue::encode(value);
     121        m_attributes = attributes;
    108122
    109123        m_slotBase = 0;
     
    112126    }
    113127
    114     void setCustom(JSObject* slotBase, GetValueFunc getValue)
     128    void setCustom(JSObject* slotBase, unsigned attributes, GetValueFunc getValue)
    115129    {
    116130        ASSERT(getValue);
    117131        m_data.custom.getValue = getValue;
     132        m_attributes = attributes;
    118133
    119134        ASSERT(slotBase);
     
    123138    }
    124139   
    125     void setCacheableCustom(JSObject* slotBase, GetValueFunc getValue)
     140    void setCacheableCustom(JSObject* slotBase, unsigned attributes, GetValueFunc getValue)
    126141    {
    127142        ASSERT(getValue);
    128143        m_data.custom.getValue = getValue;
     144        m_attributes = attributes;
    129145
    130146        ASSERT(slotBase);
     
    134150    }
    135151
    136     void setCustomIndex(JSObject* slotBase, unsigned index, GetIndexValueFunc getIndexValue)
     152    void setCustomIndex(JSObject* slotBase, unsigned attributes, unsigned index, GetIndexValueFunc getIndexValue)
    137153    {
    138154        ASSERT(getIndexValue);
    139155        m_data.customIndex.getIndexValue = getIndexValue;
    140156        m_data.customIndex.index = index;
     157        m_attributes = attributes;
    141158
    142159        ASSERT(slotBase);
     
    146163    }
    147164
    148     void setGetterSlot(JSObject* slotBase, GetterSetter* getterSetter)
     165    void setGetterSlot(JSObject* slotBase, unsigned attributes, GetterSetter* getterSetter)
    149166    {
    150167        ASSERT(getterSetter);
    151168        m_data.getter.getterSetter = getterSetter;
     169        m_attributes = attributes;
    152170
    153171        ASSERT(slotBase);
     
    157175    }
    158176
    159     void setCacheableGetterSlot(JSObject* slotBase, GetterSetter* getterSetter, PropertyOffset offset)
     177    void setCacheableGetterSlot(JSObject* slotBase, unsigned attributes, GetterSetter* getterSetter, PropertyOffset offset)
    160178    {
    161179        ASSERT(getterSetter);
    162180        m_data.getter.getterSetter = getterSetter;
     181        m_attributes = attributes;
    163182
    164183        ASSERT(slotBase);
     
    180199    JS_EXPORT_PRIVATE JSValue functionGetter(ExecState*) const;
    181200
     201    unsigned m_attributes;
    182202    union {
    183203        EncodedJSValue value;
Note: See TracChangeset for help on using the changeset viewer.