Commit 79c8e6e4 authored by mhahnenberg@apple.com's avatar mhahnenberg@apple.com

Add static version of JSCell::getConstructData

https://bugs.webkit.org/show_bug.cgi?id=69673

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Added static version of getConstructData to all classes that
override it and changed the virtual versions to call the static
versions.  This is the first step in de-virtualizing JSCell::getConstructData.

* API/JSCallbackConstructor.cpp:
(JSC::JSCallbackConstructor::getConstructData):
* API/JSCallbackConstructor.h:
* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h:
(JSC::::getConstructData):
* runtime/ArrayConstructor.cpp:
(JSC::ArrayConstructor::getConstructData):
* runtime/ArrayConstructor.h:
* runtime/BooleanConstructor.cpp:
(JSC::BooleanConstructor::getConstructData):
* runtime/BooleanConstructor.h:
* runtime/DateConstructor.cpp:
(JSC::DateConstructor::getConstructData):
* runtime/DateConstructor.h:
* runtime/ErrorConstructor.cpp:
(JSC::ErrorConstructor::getConstructData):
* runtime/ErrorConstructor.h:
* runtime/FunctionConstructor.cpp:
(JSC::FunctionConstructor::getConstructData):
* runtime/FunctionConstructor.h:
* runtime/JSCell.cpp:
(JSC::JSCell::getConstructData):
* runtime/JSCell.h:
* runtime/JSFunction.cpp:
(JSC::JSFunction::getConstructData):
* runtime/JSFunction.h:
* runtime/NativeErrorConstructor.cpp:
(JSC::NativeErrorConstructor::getConstructData):
* runtime/NativeErrorConstructor.h:
* runtime/NumberConstructor.cpp:
(JSC::NumberConstructor::getConstructData):
* runtime/NumberConstructor.h:
* runtime/ObjectConstructor.cpp:
(JSC::ObjectConstructor::getConstructData):
* runtime/ObjectConstructor.h:
* runtime/RegExpConstructor.cpp:
(JSC::RegExpConstructor::getConstructData):
* runtime/RegExpConstructor.h:
* runtime/StringConstructor.cpp:
(JSC::StringConstructor::getConstructData):
* runtime/StringConstructor.h:

Source/WebCore:

No new tests.

Added static version of getConstructData to all classes that
override it and changed the virtual versions to call the static
versions.  This is the first step in de-virtualizing JSCell::getConstructData.

* bindings/js/JSAudioConstructor.cpp:
(WebCore::JSAudioConstructor::getConstructData):
* bindings/js/JSAudioConstructor.h:
* bindings/js/JSImageConstructor.cpp:
(WebCore::JSImageConstructor::getConstructData):
* bindings/js/JSImageConstructor.h:
* bindings/js/JSOptionConstructor.cpp:
(WebCore::JSOptionConstructor::getConstructData):
* bindings/js/JSOptionConstructor.h:
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateConstructorDeclaration):
(GenerateConstructorDefinition):
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::JSTestInterfaceConstructor::getConstructData):
* bridge/runtime_object.cpp:
(JSC::Bindings::RuntimeObject::getConstructData):
* bridge/runtime_object.h:

Source/WebKit2:

Added static version of getConstructData to all classes that
override it and changed the virtual versions to call the static
versions.  This is the first step in de-virtualizing JSCell::getConstructData.

* WebProcess/Plugins/Netscape/JSNPObject.cpp:
(WebKit::JSNPObject::getConstructData):
* WebProcess/Plugins/Netscape/JSNPObject.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@97016 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1986964e
......@@ -87,6 +87,11 @@ static EncodedJSValue JSC_HOST_CALL constructJSCallback(ExecState* exec)
}
ConstructType JSCallbackConstructor::getConstructData(ConstructData& constructData)
{
return getConstructData(this, constructData);
}
ConstructType JSCallbackConstructor::getConstructData(JSCell*, ConstructData& constructData)
{
constructData.native.function = constructJSCallback;
return ConstructTypeHost;
......
......@@ -59,6 +59,7 @@ protected:
private:
virtual ConstructType getConstructData(ConstructData&);
static ConstructType getConstructData(JSCell*, ConstructData&);
JSClassRef m_class;
JSObjectCallAsConstructorCallback m_callback;
......
......@@ -197,6 +197,7 @@ private:
virtual UString toString(ExecState*) const;
virtual ConstructType getConstructData(ConstructData&);
static ConstructType getConstructData(JSCell*, ConstructData&);
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
......
......@@ -330,7 +330,14 @@ bool JSCallbackObject<Parent>::deleteProperty(JSCell* cell, ExecState* exec, uns
template <class Parent>
ConstructType JSCallbackObject<Parent>::getConstructData(ConstructData& constructData)
{
for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
return getConstructData(this, constructData);
}
template <class Parent>
ConstructType JSCallbackObject<Parent>::getConstructData(JSCell* cell, ConstructData& constructData)
{
JSCallbackObject* thisObject = static_cast<JSCallbackObject*>(cell);
for (JSClassRef jsClass = thisObject->classRef(); jsClass; jsClass = jsClass->parentClass) {
if (jsClass->callAsConstructor) {
constructData.native.function = construct;
return ConstructTypeHost;
......
2011-10-08 Mark Hahnenberg <mhahnenberg@apple.com>
Add static version of JSCell::getConstructData
https://bugs.webkit.org/show_bug.cgi?id=69673
Reviewed by Geoffrey Garen.
Added static version of getConstructData to all classes that
override it and changed the virtual versions to call the static
versions. This is the first step in de-virtualizing JSCell::getConstructData.
* API/JSCallbackConstructor.cpp:
(JSC::JSCallbackConstructor::getConstructData):
* API/JSCallbackConstructor.h:
* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h:
(JSC::::getConstructData):
* runtime/ArrayConstructor.cpp:
(JSC::ArrayConstructor::getConstructData):
* runtime/ArrayConstructor.h:
* runtime/BooleanConstructor.cpp:
(JSC::BooleanConstructor::getConstructData):
* runtime/BooleanConstructor.h:
* runtime/DateConstructor.cpp:
(JSC::DateConstructor::getConstructData):
* runtime/DateConstructor.h:
* runtime/ErrorConstructor.cpp:
(JSC::ErrorConstructor::getConstructData):
* runtime/ErrorConstructor.h:
* runtime/FunctionConstructor.cpp:
(JSC::FunctionConstructor::getConstructData):
* runtime/FunctionConstructor.h:
* runtime/JSCell.cpp:
(JSC::JSCell::getConstructData):
* runtime/JSCell.h:
* runtime/JSFunction.cpp:
(JSC::JSFunction::getConstructData):
* runtime/JSFunction.h:
* runtime/NativeErrorConstructor.cpp:
(JSC::NativeErrorConstructor::getConstructData):
* runtime/NativeErrorConstructor.h:
* runtime/NumberConstructor.cpp:
(JSC::NumberConstructor::getConstructData):
* runtime/NumberConstructor.h:
* runtime/ObjectConstructor.cpp:
(JSC::ObjectConstructor::getConstructData):
* runtime/ObjectConstructor.h:
* runtime/RegExpConstructor.cpp:
(JSC::RegExpConstructor::getConstructData):
* runtime/RegExpConstructor.h:
* runtime/StringConstructor.cpp:
(JSC::StringConstructor::getConstructData):
* runtime/StringConstructor.h:
2011-10-08 Mark Hahnenberg <mhahnenberg@apple.com>
Add static version of JSCell::getOwnPropertySlot
......@@ -98,6 +98,11 @@ static EncodedJSValue JSC_HOST_CALL constructWithArrayConstructor(ExecState* exe
}
ConstructType ArrayConstructor::getConstructData(ConstructData& constructData)
{
return getConstructData(this, constructData);
}
ConstructType ArrayConstructor::getConstructData(JSCell*, ConstructData& constructData)
{
constructData.native.function = constructWithArrayConstructor;
return ConstructTypeHost;
......
......@@ -57,6 +57,7 @@ namespace JSC {
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual ConstructType getConstructData(ConstructData&);
static ConstructType getConstructData(JSCell*, ConstructData&);
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
};
......
......@@ -59,6 +59,11 @@ static EncodedJSValue JSC_HOST_CALL constructWithBooleanConstructor(ExecState* e
}
ConstructType BooleanConstructor::getConstructData(ConstructData& constructData)
{
return getConstructData(this, constructData);
}
ConstructType BooleanConstructor::getConstructData(JSCell*, ConstructData& constructData)
{
constructData.native.function = constructWithBooleanConstructor;
return ConstructTypeHost;
......
......@@ -51,6 +51,7 @@ namespace JSC {
private:
BooleanConstructor(JSGlobalObject*, Structure*);
virtual ConstructType getConstructData(ConstructData&);
static ConstructType getConstructData(JSCell*, ConstructData&);
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
};
......
......@@ -162,6 +162,11 @@ static EncodedJSValue JSC_HOST_CALL constructWithDateConstructor(ExecState* exec
}
ConstructType DateConstructor::getConstructData(ConstructData& constructData)
{
return getConstructData(this, constructData);
}
ConstructType DateConstructor::getConstructData(JSCell*, ConstructData& constructData)
{
constructData.native.function = constructWithDateConstructor;
return ConstructTypeHost;
......
......@@ -52,6 +52,7 @@ namespace JSC {
private:
DateConstructor(JSGlobalObject*, Structure*);
virtual ConstructType getConstructData(ConstructData&);
static ConstructType getConstructData(JSCell*, ConstructData&);
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
......
......@@ -54,6 +54,11 @@ static EncodedJSValue JSC_HOST_CALL constructWithErrorConstructor(ExecState* exe
}
ConstructType ErrorConstructor::getConstructData(ConstructData& constructData)
{
return getConstructData(this, constructData);
}
ConstructType ErrorConstructor::getConstructData(JSCell*, ConstructData& constructData)
{
constructData.native.function = constructWithErrorConstructor;
return ConstructTypeHost;
......
......@@ -52,6 +52,7 @@ namespace JSC {
private:
ErrorConstructor(JSGlobalObject*, Structure*);
virtual ConstructType getConstructData(ConstructData&);
static ConstructType getConstructData(JSCell*, ConstructData&);
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
};
......
......@@ -60,6 +60,11 @@ static EncodedJSValue JSC_HOST_CALL constructWithFunctionConstructor(ExecState*
}
ConstructType FunctionConstructor::getConstructData(ConstructData& constructData)
{
return getConstructData(this, constructData);
}
ConstructType FunctionConstructor::getConstructData(JSCell*, ConstructData& constructData)
{
constructData.native.function = constructWithFunctionConstructor;
return ConstructTypeHost;
......
......@@ -49,6 +49,7 @@ namespace JSC {
FunctionConstructor(JSGlobalObject*, Structure*);
void finishCreation(ExecState*, FunctionPrototype*);
virtual ConstructType getConstructData(ConstructData&);
static ConstructType getConstructData(JSCell*, ConstructData&);
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
};
......
......@@ -69,6 +69,11 @@ ConstructType JSCell::getConstructData(ConstructData&)
return ConstructTypeNone;
}
ConstructType JSCell::getConstructData(JSCell*, ConstructData&)
{
return ConstructTypeNone;
}
bool JSCell::getOwnPropertySlot(ExecState* exec, const Identifier& identifier, PropertySlot& slot)
{
return getOwnPropertySlot(this, exec, identifier, slot);
......
......@@ -76,6 +76,7 @@ namespace JSC {
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
virtual ConstructType getConstructData(ConstructData&);
static ConstructType getConstructData(JSCell*, ConstructData&);
// Basic conversions.
JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;
......
......@@ -353,15 +353,21 @@ bool JSFunction::deleteProperty(JSCell* cell, ExecState* exec, const Identifier&
return Base::deleteProperty(thisObject, exec, propertyName);
}
// ECMA 13.2.2 [[Construct]]
ConstructType JSFunction::getConstructData(ConstructData& constructData)
{
if (isHostFunction()) {
constructData.native.function = nativeConstructor();
return getConstructData(this, constructData);
}
// ECMA 13.2.2 [[Construct]]
ConstructType JSFunction::getConstructData(JSCell* cell, ConstructData& constructData)
{
JSFunction* thisObject = static_cast<JSFunction*>(cell);
if (thisObject->isHostFunction()) {
constructData.native.function = thisObject->nativeConstructor();
return ConstructTypeHost;
}
constructData.js.functionExecutable = jsExecutable();
constructData.js.scopeChain = scope();
constructData.js.functionExecutable = thisObject->jsExecutable();
constructData.js.scopeChain = thisObject->scope();
return ConstructTypeJS;
}
......
......@@ -109,6 +109,7 @@ namespace JSC {
NativeFunction nativeConstructor();
virtual ConstructType getConstructData(ConstructData&);
static ConstructType getConstructData(JSCell*, ConstructData&);
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
......
......@@ -57,6 +57,11 @@ static EncodedJSValue JSC_HOST_CALL constructWithNativeErrorConstructor(ExecStat
}
ConstructType NativeErrorConstructor::getConstructData(ConstructData& constructData)
{
return getConstructData(this, constructData);
}
ConstructType NativeErrorConstructor::getConstructData(JSCell*, ConstructData& constructData)
{
constructData.native.function = constructWithNativeErrorConstructor;
return ConstructTypeHost;
......
......@@ -69,6 +69,7 @@ namespace JSC {
NativeErrorConstructor(JSGlobalObject*, Structure*);
static const unsigned StructureFlags = OverridesVisitChildren | InternalFunction::StructureFlags;
virtual ConstructType getConstructData(ConstructData&);
static ConstructType getConstructData(JSCell*, ConstructData&);
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
static void visitChildren(JSCell*, SlotVisitor&);
......
......@@ -121,6 +121,11 @@ static EncodedJSValue JSC_HOST_CALL constructWithNumberConstructor(ExecState* ex
}
ConstructType NumberConstructor::getConstructData(ConstructData& constructData)
{
return getConstructData(this, constructData);
}
ConstructType NumberConstructor::getConstructData(JSCell*, ConstructData& constructData)
{
constructData.native.function = constructWithNumberConstructor;
return ConstructTypeHost;
......
......@@ -59,6 +59,7 @@ namespace JSC {
private:
NumberConstructor(JSGlobalObject*, Structure*);
virtual ConstructType getConstructData(ConstructData&);
static ConstructType getConstructData(JSCell*, ConstructData&);
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
};
......
......@@ -120,6 +120,11 @@ static EncodedJSValue JSC_HOST_CALL constructWithObjectConstructor(ExecState* ex
}
ConstructType ObjectConstructor::getConstructData(ConstructData& constructData)
{
return getConstructData(this, constructData);
}
ConstructType ObjectConstructor::getConstructData(JSCell*, ConstructData& constructData)
{
constructData.native.function = constructWithObjectConstructor;
return ConstructTypeHost;
......
......@@ -56,6 +56,7 @@ namespace JSC {
private:
ObjectConstructor(JSGlobalObject*, Structure*);
virtual ConstructType getConstructData(ConstructData&);
static ConstructType getConstructData(JSCell*, ConstructData&);
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
};
......
......@@ -355,6 +355,11 @@ static EncodedJSValue JSC_HOST_CALL constructWithRegExpConstructor(ExecState* ex
}
ConstructType RegExpConstructor::getConstructData(ConstructData& constructData)
{
return getConstructData(this, constructData);
}
ConstructType RegExpConstructor::getConstructData(JSCell*, ConstructData& constructData)
{
constructData.native.function = constructWithRegExpConstructor;
return ConstructTypeHost;
......
......@@ -101,6 +101,7 @@ namespace JSC {
private:
RegExpConstructor(JSGlobalObject*, Structure*);
virtual ConstructType getConstructData(ConstructData&);
static ConstructType getConstructData(JSCell*, ConstructData&);
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
......
......@@ -102,6 +102,11 @@ static EncodedJSValue JSC_HOST_CALL constructWithStringConstructor(ExecState* ex
}
ConstructType StringConstructor::getConstructData(ConstructData& constructData)
{
return getConstructData(this, constructData);
}
ConstructType StringConstructor::getConstructData(JSCell*, ConstructData& constructData)
{
constructData.native.function = constructWithStringConstructor;
return ConstructTypeHost;
......
......@@ -52,6 +52,7 @@ namespace JSC {
StringConstructor(JSGlobalObject*, Structure*);
void finishCreation(ExecState*, StringPrototype*);
virtual ConstructType getConstructData(ConstructData&);
static ConstructType getConstructData(JSCell*, ConstructData&);
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
......
2011-10-08 Mark Hahnenberg <mhahnenberg@apple.com>
Add static version of JSCell::getConstructData
https://bugs.webkit.org/show_bug.cgi?id=69673
Reviewed by Geoffrey Garen.
No new tests.
Added static version of getConstructData to all classes that
override it and changed the virtual versions to call the static
versions. This is the first step in de-virtualizing JSCell::getConstructData.
* bindings/js/JSAudioConstructor.cpp:
(WebCore::JSAudioConstructor::getConstructData):
* bindings/js/JSAudioConstructor.h:
* bindings/js/JSImageConstructor.cpp:
(WebCore::JSImageConstructor::getConstructData):
* bindings/js/JSImageConstructor.h:
* bindings/js/JSOptionConstructor.cpp:
(WebCore::JSOptionConstructor::getConstructData):
* bindings/js/JSOptionConstructor.h:
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateConstructorDeclaration):
(GenerateConstructorDefinition):
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::JSTestInterfaceConstructor::getConstructData):
* bridge/runtime_object.cpp:
(JSC::Bindings::RuntimeObject::getConstructData):
* bridge/runtime_object.h:
2011-10-08 Mark Hahnenberg <mhahnenberg@apple.com>
Add static version of JSCell::getOwnPropertySlot
......@@ -76,6 +76,11 @@ static EncodedJSValue JSC_HOST_CALL constructAudio(ExecState* exec)
}
ConstructType JSAudioConstructor::getConstructData(ConstructData& constructData)
{
return getConstructData(this, constructData);
}
ConstructType JSAudioConstructor::getConstructData(JSCell*, ConstructData& constructData)
{
constructData.native.function = constructAudio;
return ConstructTypeHost;
......
......@@ -56,6 +56,7 @@ namespace WebCore {
JSAudioConstructor(JSC::Structure*, JSDOMGlobalObject*);
void finishCreation(JSC::ExecState*, JSDOMGlobalObject*);
virtual JSC::ConstructType getConstructData(JSC::ConstructData&);
static JSC::ConstructType getConstructData(JSC::JSCell*, JSC::ConstructData&);
};
} // namespace WebCore
......
......@@ -75,6 +75,11 @@ static EncodedJSValue JSC_HOST_CALL constructImage(ExecState* exec)
}
ConstructType JSImageConstructor::getConstructData(ConstructData& constructData)
{
return getConstructData(this, constructData);
}
ConstructType JSImageConstructor::getConstructData(JSCell*, ConstructData& constructData)
{
constructData.native.function = constructImage;
return ConstructTypeHost;
......
......@@ -47,6 +47,7 @@ namespace WebCore {
JSImageConstructor(JSC::Structure*, JSDOMGlobalObject*);
void finishCreation(JSC::ExecState*, JSDOMGlobalObject*);
virtual JSC::ConstructType getConstructData(JSC::ConstructData&);
static JSC::ConstructType getConstructData(JSC::JSCell*, JSC::ConstructData&);
};
} // namespace WebCore
......
......@@ -76,6 +76,11 @@ static EncodedJSValue JSC_HOST_CALL constructHTMLOptionElement(ExecState* exec)
}
ConstructType JSOptionConstructor::getConstructData(ConstructData& constructData)
{
return getConstructData(this, constructData);
}
ConstructType JSOptionConstructor::getConstructData(JSCell*, ConstructData& constructData)
{
constructData.native.function = constructHTMLOptionElement;
return ConstructTypeHost;
......
......@@ -48,6 +48,7 @@ namespace WebCore {
JSOptionConstructor(JSC::Structure*, JSDOMGlobalObject*);
void finishCreation(JSC::ExecState*, JSDOMGlobalObject*);
virtual JSC::ConstructType getConstructData(JSC::ConstructData&);
static JSC::ConstructType getConstructData(JSC::JSCell*, JSC::ConstructData&);
};
} // namespace WebCore
......
......@@ -3172,6 +3172,7 @@ sub GenerateConstructorDeclaration
if ($canConstruct) {
push(@$outputArray, " static JSC::EncodedJSValue JSC_HOST_CALL construct${className}(JSC::ExecState*);\n");
push(@$outputArray, " virtual JSC::ConstructType getConstructData(JSC::ConstructData&);\n");
push(@$outputArray, " static JSC::ConstructType getConstructData(JSC::JSCell*, JSC::ConstructData&);\n");
}
push(@$outputArray, "};\n\n");
}
......@@ -3238,6 +3239,11 @@ sub GenerateConstructorDefinition
push(@$outputArray, "ConstructType ${constructorClassName}::getConstructData(ConstructData& constructData)\n");
push(@$outputArray, "{\n");
push(@$outputArray, " return getConstructData(this, constructData);\n");
push(@$outputArray, "}\n\n");
push(@$outputArray, "ConstructType ${constructorClassName}::getConstructData(JSCell*, ConstructData& constructData)\n");
push(@$outputArray, "{\n");
push(@$outputArray, " constructData.native.function = construct${className};\n");
push(@$outputArray, " return ConstructTypeHost;\n");
push(@$outputArray, "}\n\n");
......
......@@ -97,6 +97,7 @@ protected:
static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
static JSC::EncodedJSValue JSC_HOST_CALL constructJSTestInterface(JSC::ExecState*);
virtual JSC::ConstructType getConstructData(JSC::ConstructData&);
static JSC::ConstructType getConstructData(JSC::JSCell*, JSC::ConstructData&);
};
const ClassInfo JSTestInterfaceConstructor::s_info = { "TestInterfaceConstructor", &DOMConstructorObject::s_info, &JSTestInterfaceConstructorTable, 0, CREATE_METHOD_TABLE(JSTestInterfaceConstructor) };
......@@ -132,6 +133,11 @@ EncodedJSValue JSC_HOST_CALL JSTestInterfaceConstructor::constructJSTestInterfac
}
ConstructType JSTestInterfaceConstructor::getConstructData(ConstructData& constructData)
{
return getConstructData(this, constructData);
}
ConstructType JSTestInterfaceConstructor::getConstructData(JSCell*, ConstructData& constructData)
{
constructData.native.function = constructJSTestInterface;
return ConstructTypeHost;
......
......@@ -311,10 +311,16 @@ static EncodedJSValue JSC_HOST_CALL callRuntimeConstructor(ExecState* exec)
ConstructType RuntimeObject::getConstructData(ConstructData& constructData)
{
if (!m_instance)
return getConstructData(this, constructData);
}
ConstructType RuntimeObject::getConstructData(JSCell* cell, ConstructData& constructData)
{
RuntimeObject* thisObject = static_cast<RuntimeObject*>(cell);
if (!thisObject->m_instance)
return ConstructTypeNone;
RefPtr<Instance> instance = m_instance;
RefPtr<Instance> instance = thisObject->m_instance;
if (!instance->supportsConstruct())
return ConstructTypeNone;
......
......@@ -56,6 +56,7 @@ public:
virtual CallType getCallDataVirtual(CallData&);
static CallType getCallData(JSCell*, CallData&);
virtual ConstructType getConstructData(ConstructData&);
static ConstructType getConstructData(JSCell*, ConstructData&);
virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
......
2011-10-08 Mark Hahnenberg <mhahnenberg@apple.com>
Add static version of JSCell::getConstructData
https://bugs.webkit.org/show_bug.cgi?id=69673
Reviewed by Geoffrey Garen.
Added static version of getConstructData to all classes that
override it and changed the virtual versions to call the static
versions. This is the first step in de-virtualizing JSCell::getConstructData.
* WebProcess/Plugins/Netscape/JSNPObject.cpp:
(WebKit::JSNPObject::getConstructData):
* WebProcess/Plugins/Netscape/JSNPObject.h:
2011-10-08 Mark Hahnenberg <mhahnenberg@apple.com>
Add static version of JSCell::getOwnPropertySlot
......
......@@ -243,8 +243,14 @@ static EncodedJSValue JSC_HOST_CALL constructWithConstructor(ExecState* exec)
ConstructType JSNPObject::getConstructData(ConstructData& constructData)
{
ASSERT_GC_OBJECT_INHERITS(this, &s_info);
if (!m_npObject || !m_npObject->_class->construct)
return getConstructData(this, constructData);
}
ConstructType JSNPObject::getConstructData(JSCell* cell, ConstructData& constructData)
{
JSNPObject* thisObject = static_cast<JSNPObject*>(cell);
ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
if (!thisObject->m_npObject || !thisObject->m_npObject->_class->construct)
return ConstructTypeNone;
constructData.native.function = constructWithConstructor;
......
......@@ -82,6 +82,7 @@ private:
virtual JSC::CallType getCallDataVirtual(JSC::CallData&);
static JSC::CallType getCallData(JSC::JSCell*, JSC::CallData&);
virtual JSC::ConstructType getConstructData(JSC::ConstructData&);
static JSC::ConstructType getConstructData(JSC::JSCell*, JSC::ConstructData&);
virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
static bool getOwnPropertySlot(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
......
Markdown is supported
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