Ignore:
Timestamp:
Aug 20, 2013, 4:46:45 PM (12 years ago)
Author:
[email protected]
Message:

https://bugs.webkit.org/show_bug.cgi?id=120093
Remove getOwnPropertyDescriptor trap

Reviewed by Geoff Garen.

All implementations of this method are now called via the method table, and equivalent in behaviour.
Remove all duplicate implementations (and the method table trap), and add a single member function implementation on JSObject.

Source/JavaScriptCore:

  • API/JSCallbackObject.h:
  • API/JSCallbackObjectFunctions.h:
  • debugger/DebuggerActivation.cpp:
  • debugger/DebuggerActivation.h:
  • runtime/Arguments.cpp:
  • runtime/Arguments.h:
  • runtime/ArrayConstructor.cpp:
  • runtime/ArrayConstructor.h:
  • runtime/ArrayPrototype.cpp:
  • runtime/ArrayPrototype.h:
  • runtime/BooleanPrototype.cpp:
  • runtime/BooleanPrototype.h:
    • remove getOwnPropertyDescriptor
  • runtime/ClassInfo.h:
    • remove getOwnPropertyDescriptor from MethodTable
  • runtime/DateConstructor.cpp:
  • runtime/DateConstructor.h:
  • runtime/DatePrototype.cpp:
  • runtime/DatePrototype.h:
  • runtime/ErrorPrototype.cpp:
  • runtime/ErrorPrototype.h:
  • runtime/JSActivation.cpp:
  • runtime/JSActivation.h:
  • runtime/JSArray.cpp:
  • runtime/JSArray.h:
  • runtime/JSArrayBuffer.cpp:
  • runtime/JSArrayBuffer.h:
  • runtime/JSArrayBufferView.cpp:
  • runtime/JSArrayBufferView.h:
  • runtime/JSCell.cpp:
  • runtime/JSCell.h:
  • runtime/JSDataView.cpp:
  • runtime/JSDataView.h:
  • runtime/JSDataViewPrototype.cpp:
  • runtime/JSDataViewPrototype.h:
  • runtime/JSFunction.cpp:
  • runtime/JSFunction.h:
  • runtime/JSGenericTypedArrayView.h:
  • runtime/JSGenericTypedArrayViewInlines.h:
  • runtime/JSGlobalObject.cpp:
  • runtime/JSGlobalObject.h:
  • runtime/JSNotAnObject.cpp:
  • runtime/JSNotAnObject.h:
  • runtime/JSONObject.cpp:
  • runtime/JSONObject.h:
    • remove getOwnPropertyDescriptor
  • runtime/JSObject.cpp:

(JSC::JSObject::propertyIsEnumerable):

  • switch to call new getOwnPropertyDescriptor member function

(JSC::JSObject::getOwnPropertyDescriptor):

  • new, based on imlementation from GET_OWN_PROPERTY_DESCRIPTOR_IMPL

(JSC::JSObject::defineOwnNonIndexProperty):

  • switch to call new getOwnPropertyDescriptor member function
  • runtime/JSObject.h:
  • runtime/JSProxy.cpp:
  • runtime/JSProxy.h:
  • runtime/NamePrototype.cpp:
  • runtime/NamePrototype.h:
  • runtime/NumberConstructor.cpp:
  • runtime/NumberConstructor.h:
  • runtime/NumberPrototype.cpp:
  • runtime/NumberPrototype.h:
    • remove getOwnPropertyDescriptor
  • runtime/ObjectConstructor.cpp:

(JSC::objectConstructorGetOwnPropertyDescriptor):
(JSC::objectConstructorSeal):
(JSC::objectConstructorFreeze):
(JSC::objectConstructorIsSealed):
(JSC::objectConstructorIsFrozen):

  • switch to call new getOwnPropertyDescriptor member function
  • runtime/ObjectConstructor.h:
    • remove getOwnPropertyDescriptor
  • runtime/PropertyDescriptor.h:
    • remove GET_OWN_PROPERTY_DESCRIPTOR_IMPL
  • runtime/RegExpConstructor.cpp:
  • runtime/RegExpConstructor.h:
  • runtime/RegExpMatchesArray.cpp:
  • runtime/RegExpMatchesArray.h:
  • runtime/RegExpObject.cpp:
  • runtime/RegExpObject.h:
  • runtime/RegExpPrototype.cpp:
  • runtime/RegExpPrototype.h:
  • runtime/StringConstructor.cpp:
  • runtime/StringConstructor.h:
  • runtime/StringObject.cpp:
  • runtime/StringObject.h:
    • remove getOwnPropertyDescriptor

Source/WebCore:

  • WebCore.exp.in:
  • bindings/js/JSDOMWindowCustom.cpp:
  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateHeader):
(GenerateImplementation):
(GenerateConstructorDeclaration):
(GenerateConstructorHelperMethods):

  • bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
  • bindings/scripts/test/JS/JSTestActiveDOMObject.h:
  • bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
  • bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
  • bindings/scripts/test/JS/JSTestEventConstructor.cpp:
  • bindings/scripts/test/JS/JSTestEventConstructor.h:
  • bindings/scripts/test/JS/JSTestEventTarget.cpp:
  • bindings/scripts/test/JS/JSTestEventTarget.h:
  • bindings/scripts/test/JS/JSTestException.cpp:
  • bindings/scripts/test/JS/JSTestException.h:
  • bindings/scripts/test/JS/JSTestInterface.cpp:
  • bindings/scripts/test/JS/JSTestInterface.h:
  • bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
  • bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
  • bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
  • bindings/scripts/test/JS/JSTestNamedConstructor.h:
  • bindings/scripts/test/JS/JSTestNode.cpp:
  • bindings/scripts/test/JS/JSTestNode.h:
  • bindings/scripts/test/JS/JSTestObj.cpp:
  • bindings/scripts/test/JS/JSTestObj.h:
  • bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
  • bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
  • bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
  • bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
  • bindings/scripts/test/JS/JSTestTypedefs.cpp:
  • bindings/scripts/test/JS/JSTestTypedefs.h:
  • bridge/jsc/BridgeJSC.h:

(JSC::Bindings::Instance::getOwnPropertySlot):

  • bridge/objc/objc_runtime.h:
  • bridge/objc/objc_runtime.mm:
  • bridge/runtime_array.cpp:
  • bridge/runtime_array.h:
  • bridge/runtime_method.cpp:
  • bridge/runtime_method.h:
  • bridge/runtime_object.cpp:
  • bridge/runtime_object.h:
    • remove getOwnPropertyDescriptor

Source/WebKit2:

  • WebProcess/Plugins/Netscape/JSNPObject.cpp:
  • WebProcess/Plugins/Netscape/JSNPObject.h:
    • remove getOwnPropertyDescriptor
File:
1 edited

Legend:

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

    r154366 r154373  
    14111411{
    14121412    PropertyDescriptor descriptor;
    1413     if (!const_cast<JSObject*>(this)->methodTable()->getOwnPropertyDescriptor(const_cast<JSObject*>(this), exec, propertyName, descriptor))
     1413    if (!const_cast<JSObject*>(this)->getOwnPropertyDescriptor(exec, propertyName, descriptor))
    14141414        return false;
    14151415    return descriptor.enumerable();
     
    23822382}
    23832383
    2384 GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSObject)
     2384bool JSObject::getOwnPropertyDescriptor(ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
     2385{
     2386    JSC::PropertySlot slot(this);
     2387    if (!methodTable()->getOwnPropertySlot(this, exec, propertyName, slot))
     2388        return false;
     2389    /* Workaround, JSDOMWindow::getOwnPropertySlot searches the prototype chain. :-( */
     2390    if (slot.slotBase() != this && slot.slotBase() && slot.slotBase()->methodTable()->toThis(slot.slotBase(), exec, NotStrictMode) != this)
     2391        return false;
     2392    if (slot.isAccessor())
     2393        descriptor.setAccessorDescriptor(slot.getterSetter(), slot.attributes());
     2394    else
     2395        descriptor.setDescriptor(slot.getValue(exec, propertyName), slot.attributes());
     2396    return true;
     2397}
    23852398
    23862399static bool putDescriptor(ExecState* exec, JSObject* target, PropertyName propertyName, PropertyDescriptor& descriptor, unsigned attributes, const PropertyDescriptor& oldDescriptor)
     
    24582471    // If we have a new property we can just put it on normally
    24592472    PropertyDescriptor current;
    2460     if (!methodTable()->getOwnPropertyDescriptor(this, exec, propertyName, current)) {
     2473    if (!getOwnPropertyDescriptor(exec, propertyName, current)) {
    24612474        // unless extensions are prevented!
    24622475        if (!isExtensible()) {
Note: See TracChangeset for help on using the changeset viewer.