Commit 174570f9 authored by barraclough@apple.com's avatar barraclough@apple.com
Browse files

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



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154373 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6114a00c
......@@ -178,7 +178,6 @@ private:
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
static bool getOwnPropertySlotByIndex(JSObject*, ExecState*, unsigned propertyName, PropertySlot&);
static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&);
static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
static void putByIndex(JSCell*, ExecState*, unsigned, JSValue, bool shouldThrow);
......
......@@ -212,9 +212,6 @@ JSValue JSCallbackObject<Parent>::defaultValue(const JSObject* object, ExecState
return Parent::defaultValue(object, exec, hint);
}
template <class Parent>
GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSCallbackObject<Parent>)
template <class Parent>
void JSCallbackObject<Parent>::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
{
......
2013-08-20 Gavin Barraclough <barraclough@apple.com>
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.
* 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
2013-08-20 Mark Hahnenberg <mhahnenberg@apple.com>
 
<https://webkit.org/b/120079> Flattening a dictionary can cause CopiedSpace corruption
......
......@@ -95,8 +95,6 @@ void DebuggerActivation::getOwnPropertyNames(JSObject* object, ExecState* exec,
thisObject->m_activation->methodTable()->getPropertyNames(thisObject->m_activation.get(), exec, propertyNames, mode);
}
GET_OWN_PROPERTY_DESCRIPTOR_IMPL(DebuggerActivation)
bool DebuggerActivation::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor, bool shouldThrow)
{
DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(object);
......
......@@ -48,7 +48,6 @@ namespace JSC {
static void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes);
static bool deleteProperty(JSCell*, ExecState*, PropertyName);
static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&);
static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool shouldThrow);
DECLARE_EXPORT_INFO;
......
......@@ -152,8 +152,6 @@ bool Arguments::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyNa
return JSObject::getOwnPropertySlot(thisObject, exec, propertyName, slot);
}
GET_OWN_PROPERTY_DESCRIPTOR_IMPL(Arguments)
void Arguments::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
Arguments* thisObject = jsCast<Arguments*>(object);
......
......@@ -99,7 +99,6 @@ private:
static void destroy(JSCell*);
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
static bool getOwnPropertySlotByIndex(JSObject*, ExecState*, unsigned propertyName, PropertySlot&);
static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&);
static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow);
......
......@@ -71,8 +71,6 @@ bool ArrayConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, Pro
return getStaticFunctionSlot<InternalFunction>(exec, ExecState::arrayConstructorTable(exec), jsCast<ArrayConstructor*>(object), propertyName, slot);
}
GET_OWN_PROPERTY_DESCRIPTOR_IMPL(ArrayConstructor)
// ------------------------------ Functions ---------------------------
JSObject* constructArrayWithSizeQuirk(ExecState* exec, ArrayAllocationProfile* profile, JSGlobalObject* globalObject, JSValue length)
......
......@@ -55,8 +55,6 @@ private:
ArrayConstructor(JSGlobalObject*, Structure*);
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&);
static ConstructType getConstructData(JSCell*, ConstructData&);
static CallType getCallData(JSCell*, CallData&);
};
......
......@@ -141,8 +141,6 @@ bool ArrayPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, Prope
return getStaticFunctionSlot<JSArray>(exec, ExecState::arrayPrototypeTable(exec), jsCast<ArrayPrototype*>(object), propertyName, slot);
}
GET_OWN_PROPERTY_DESCRIPTOR_IMPL(ArrayPrototype)
// ------------------------------ Array Functions ----------------------------
// Helper function
......
......@@ -36,7 +36,6 @@ public:
static ArrayPrototype* create(ExecState*, JSGlobalObject*, Structure*);
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&);
DECLARE_INFO;
......
......@@ -68,8 +68,6 @@ bool BooleanPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, Pro
return getStaticFunctionSlot<BooleanObject>(exec, ExecState::booleanPrototypeTable(exec), jsCast<BooleanPrototype*>(object), propertyName, slot);
}
GET_OWN_PROPERTY_DESCRIPTOR_IMPL(BooleanPrototype)
// ------------------------------ Functions ---------------------------
EncodedJSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState* exec)
......
......@@ -50,8 +50,6 @@ protected:
private:
BooleanPrototype(ExecState*, Structure*);
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&);
};
} // namespace JSC
......
......@@ -95,9 +95,6 @@ struct MethodTable {
typedef bool (*DefineOwnPropertyFunctionPtr)(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool);
DefineOwnPropertyFunctionPtr defineOwnProperty;
typedef bool (*GetOwnPropertyDescriptorFunctionPtr)(JSObject*, ExecState*, PropertyName, PropertyDescriptor&);
GetOwnPropertyDescriptorFunctionPtr getOwnPropertyDescriptor;
typedef void (*SlowDownAndWasteMemory)(JSArrayBufferView*);
SlowDownAndWasteMemory slowDownAndWasteMemory;
......@@ -145,7 +142,6 @@ struct MethodTable {
&ClassName::customHasInstance, \
&ClassName::putDirectVirtual, \
&ClassName::defineOwnProperty, \
&ClassName::getOwnPropertyDescriptor, \
&ClassName::slowDownAndWasteMemory, \
&ClassName::getTypedArrayImpl \
}, \
......
......@@ -91,8 +91,6 @@ bool DateConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, Prop
return getStaticFunctionSlot<InternalFunction>(exec, ExecState::dateConstructorTable(exec), jsCast<DateConstructor*>(object), propertyName, slot);
}
GET_OWN_PROPERTY_DESCRIPTOR_IMPL(DateConstructor)
// ECMA 15.9.3
JSObject* constructDate(ExecState* exec, JSGlobalObject* globalObject, const ArgList& args)
{
......
......@@ -55,8 +55,6 @@ namespace JSC {
static CallType getCallData(JSCell*, CallData&);
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&);
};
JSObject* constructDate(ExecState*, JSGlobalObject*, const ArgList&);
......
......@@ -519,8 +519,6 @@ bool DatePrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, Proper
return getStaticFunctionSlot<JSObject>(exec, ExecState::dateTable(exec), jsCast<DatePrototype*>(object), propertyName, slot);
}
GET_OWN_PROPERTY_DESCRIPTOR_IMPL(DatePrototype)
// Functions
EncodedJSValue JSC_HOST_CALL dateProtoFuncToString(ExecState* exec)
......
......@@ -42,8 +42,6 @@ namespace JSC {
}
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&);
DECLARE_INFO;
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
......
......@@ -66,8 +66,6 @@ bool ErrorPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, Prope
return getStaticFunctionSlot<ErrorInstance>(exec, ExecState::errorPrototypeTable(exec), jsCast<ErrorPrototype*>(object), propertyName, slot);
}
GET_OWN_PROPERTY_DESCRIPTOR_IMPL(ErrorPrototype)
// ------------------------------ Functions ---------------------------
// ECMA-262 5.1, 15.11.4.4
......
......@@ -53,7 +53,6 @@ namespace JSC {
private:
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&);
};
} // namespace JSC
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment