Commit dd90ed20 authored by mhahnenberg@apple.com's avatar mhahnenberg@apple.com

Add static ClassInfo structs to classes that override JSCell::getCallData

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

Reviewed by Darin Adler.

Source/JavaScriptCore:

Added ClassInfo structs to each class that defined its own getCallData
function but did not already have its own ClassInfo struct.  This is a
necessary addition for when we switch over to looking up getCallData from
the MethodTable in ClassInfo rather than doing the virtual call (which we
are removing).  These new ClassInfo structs are public because we often
use these structs in other areas of the code to uniquely identify JSC classes and
to enforce runtime invariants based on those class identities using ASSERTs.

* runtime/BooleanConstructor.cpp:
* runtime/BooleanConstructor.h:

getCallData was not marked as static is StrictModeTypeErrorFunction.
* runtime/Error.cpp:
(JSC::StrictModeTypeErrorFunction::getCallDataVirtual):
(JSC::StrictModeTypeErrorFunction::getCallData):
* runtime/ErrorConstructor.cpp:
* runtime/ErrorConstructor.h:
* runtime/FunctionConstructor.cpp:
* runtime/FunctionConstructor.h:
* runtime/FunctionPrototype.cpp:
* runtime/FunctionPrototype.h:

Source/WebCore:

No new tests.

Added ClassInfo structs to each class that defined its own getCallData
function but did not already have its own ClassInfo struct.  This is a
necessary addition for when we switch over to looking up getCallData from
the MethodTable in ClassInfo rather than doing the virtual call (which we
are removing).  These new ClassInfo structs are public because we often
use these structs in other areas of the code to uniquely identify JSC classes and
to enforce runtime invariants based on those class identities using ASSERTs.

* bridge/qt/qt_runtime.cpp:
* bridge/qt/qt_runtime.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96630 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 54009a4c
2011-10-04 Mark Hahnenberg <mhahnenberg@apple.com>
Add static ClassInfo structs to classes that override JSCell::getCallData
https://bugs.webkit.org/show_bug.cgi?id=69311
Reviewed by Darin Adler.
Added ClassInfo structs to each class that defined its own getCallData
function but did not already have its own ClassInfo struct. This is a
necessary addition for when we switch over to looking up getCallData from
the MethodTable in ClassInfo rather than doing the virtual call (which we
are removing). These new ClassInfo structs are public because we often
use these structs in other areas of the code to uniquely identify JSC classes and
to enforce runtime invariants based on those class identities using ASSERTs.
* runtime/BooleanConstructor.cpp:
* runtime/BooleanConstructor.h:
getCallData was not marked as static is StrictModeTypeErrorFunction.
* runtime/Error.cpp:
(JSC::StrictModeTypeErrorFunction::getCallDataVirtual):
(JSC::StrictModeTypeErrorFunction::getCallData):
* runtime/ErrorConstructor.cpp:
* runtime/ErrorConstructor.h:
* runtime/FunctionConstructor.cpp:
* runtime/FunctionConstructor.h:
* runtime/FunctionPrototype.cpp:
* runtime/FunctionPrototype.h:
2011-10-04 Ryosuke Niwa <rniwa@webkit.org> 2011-10-04 Ryosuke Niwa <rniwa@webkit.org>
Leopard build fix after r96613. Leopard build fix after r96613.
...@@ -28,6 +28,8 @@ namespace JSC { ...@@ -28,6 +28,8 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(BooleanConstructor); ASSERT_CLASS_FITS_IN_CELL(BooleanConstructor);
const ClassInfo BooleanConstructor::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(BooleanConstructor) };
BooleanConstructor::BooleanConstructor(JSGlobalObject* globalObject, Structure* structure) BooleanConstructor::BooleanConstructor(JSGlobalObject* globalObject, Structure* structure)
: InternalFunction(globalObject, structure) : InternalFunction(globalObject, structure)
{ {
......
...@@ -38,6 +38,8 @@ namespace JSC { ...@@ -38,6 +38,8 @@ namespace JSC {
return constructor; return constructor;
} }
static const ClassInfo s_info;
protected: protected:
void finishCreation(ExecState*, BooleanPrototype*); void finishCreation(ExecState*, BooleanPrototype*);
......
...@@ -201,23 +201,27 @@ public: ...@@ -201,23 +201,27 @@ public:
return JSValue::encode(jsNull()); return JSValue::encode(jsNull());
} }
CallType getCallDataVirtual(CallData& callData) virtual CallType getCallDataVirtual(CallData& callData)
{ {
return getCallData(this, callData); return getCallData(this, callData);
} }
CallType getCallData(JSCell*, CallData& callData) static CallType getCallData(JSCell*, CallData& callData)
{ {
callData.native.function = callThrowTypeError; callData.native.function = callThrowTypeError;
return CallTypeHost; return CallTypeHost;
} }
static const ClassInfo s_info;
private: private:
UString m_message; UString m_message;
}; };
ASSERT_CLASS_FITS_IN_CELL(StrictModeTypeErrorFunction); ASSERT_CLASS_FITS_IN_CELL(StrictModeTypeErrorFunction);
const ClassInfo StrictModeTypeErrorFunction::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(StrictModeTypeErrorFunction) };
JSValue createTypeErrorFunction(ExecState* exec, const UString& message) JSValue createTypeErrorFunction(ExecState* exec, const UString& message)
{ {
return StrictModeTypeErrorFunction::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->internalFunctionStructure(), message); return StrictModeTypeErrorFunction::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->internalFunctionStructure(), message);
......
...@@ -29,6 +29,8 @@ namespace JSC { ...@@ -29,6 +29,8 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(ErrorConstructor); ASSERT_CLASS_FITS_IN_CELL(ErrorConstructor);
const ClassInfo ErrorConstructor::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(ErrorConstructor) };
ErrorConstructor::ErrorConstructor(JSGlobalObject* globalObject, Structure* structure) ErrorConstructor::ErrorConstructor(JSGlobalObject* globalObject, Structure* structure)
: InternalFunction(globalObject, structure) : InternalFunction(globalObject, structure)
{ {
......
...@@ -39,6 +39,8 @@ namespace JSC { ...@@ -39,6 +39,8 @@ namespace JSC {
return constructor; return constructor;
} }
static const ClassInfo s_info;
protected: protected:
void finishCreation(ExecState*, ErrorPrototype*); void finishCreation(ExecState*, ErrorPrototype*);
......
...@@ -37,6 +37,8 @@ namespace JSC { ...@@ -37,6 +37,8 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(FunctionConstructor); ASSERT_CLASS_FITS_IN_CELL(FunctionConstructor);
const ClassInfo FunctionConstructor::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(FunctionConstructor) };
FunctionConstructor::FunctionConstructor(JSGlobalObject* globalObject, Structure* structure) FunctionConstructor::FunctionConstructor(JSGlobalObject* globalObject, Structure* structure)
: InternalFunction(globalObject, structure) : InternalFunction(globalObject, structure)
{ {
......
...@@ -38,6 +38,8 @@ namespace JSC { ...@@ -38,6 +38,8 @@ namespace JSC {
return constructor; return constructor;
} }
static const ClassInfo s_info;
private: private:
FunctionConstructor(JSGlobalObject*, Structure*); FunctionConstructor(JSGlobalObject*, Structure*);
void finishCreation(ExecState*, FunctionPrototype*); void finishCreation(ExecState*, FunctionPrototype*);
......
...@@ -39,6 +39,8 @@ static EncodedJSValue JSC_HOST_CALL functionProtoFuncApply(ExecState*); ...@@ -39,6 +39,8 @@ static EncodedJSValue JSC_HOST_CALL functionProtoFuncApply(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionProtoFuncCall(ExecState*); static EncodedJSValue JSC_HOST_CALL functionProtoFuncCall(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionProtoFuncBind(ExecState*); static EncodedJSValue JSC_HOST_CALL functionProtoFuncBind(ExecState*);
const ClassInfo FunctionPrototype::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(FunctionPrototype) };
FunctionPrototype::FunctionPrototype(JSGlobalObject* globalObject, Structure* structure) FunctionPrototype::FunctionPrototype(JSGlobalObject* globalObject, Structure* structure)
: InternalFunction(globalObject, structure) : InternalFunction(globalObject, structure)
{ {
......
...@@ -43,6 +43,8 @@ namespace JSC { ...@@ -43,6 +43,8 @@ namespace JSC {
return Structure::create(globalData, globalObject, proto, TypeInfo(ObjectType, StructureFlags), &s_info); return Structure::create(globalData, globalObject, proto, TypeInfo(ObjectType, StructureFlags), &s_info);
} }
static const ClassInfo s_info;
protected: protected:
void finishCreation(ExecState*, const Identifier& name); void finishCreation(ExecState*, const Identifier& name);
......
2011-10-04 Mark Hahnenberg <mhahnenberg@apple.com>
Add static ClassInfo structs to classes that override JSCell::getCallData
https://bugs.webkit.org/show_bug.cgi?id=69311
Reviewed by Darin Adler.
No new tests.
Added ClassInfo structs to each class that defined its own getCallData
function but did not already have its own ClassInfo struct. This is a
necessary addition for when we switch over to looking up getCallData from
the MethodTable in ClassInfo rather than doing the virtual call (which we
are removing). These new ClassInfo structs are public because we often
use these structs in other areas of the code to uniquely identify JSC classes and
to enforce runtime invariants based on those class identities using ASSERTs.
* bridge/qt/qt_runtime.cpp:
* bridge/qt/qt_runtime.h:
2011-10-04 Ryosuke Niwa <rniwa@webkit.org> 2011-10-04 Ryosuke Niwa <rniwa@webkit.org>
REGRESSION(r94274): setting input.value erroneously triggers focus event REGRESSION(r94274): setting input.value erroneously triggers focus event
...@@ -1425,6 +1425,8 @@ static int findSignalIndex(const QMetaObject* meta, int initialIndex, QByteArray ...@@ -1425,6 +1425,8 @@ static int findSignalIndex(const QMetaObject* meta, int initialIndex, QByteArray
return index; return index;
} }
const ClassInfo QtRuntimeMetaMethod::s_info = { "QtRuntimeMethod", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(QtRuntimeMetaMethod) };
QtRuntimeMetaMethod::QtRuntimeMetaMethod(ExecState* exec, Structure* structure, const Identifier& identifier) QtRuntimeMetaMethod::QtRuntimeMetaMethod(ExecState* exec, Structure* structure, const Identifier& identifier)
: QtRuntimeMethod (new QtRuntimeMetaMethodData(), exec, structure, identifier) : QtRuntimeMethod (new QtRuntimeMetaMethodData(), exec, structure, identifier)
{ {
...@@ -1580,6 +1582,8 @@ JSValue QtRuntimeMetaMethod::disconnectGetter(ExecState* exec, JSValue slotBase, ...@@ -1580,6 +1582,8 @@ JSValue QtRuntimeMetaMethod::disconnectGetter(ExecState* exec, JSValue slotBase,
QMultiMap<QObject*, QtConnectionObject*> QtRuntimeConnectionMethod::connections; QMultiMap<QObject*, QtConnectionObject*> QtRuntimeConnectionMethod::connections;
const ClassInfo QtRuntimeConnectionMethod::s_info = { "QtRuntimeMethod", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(QtRuntimeConnectionMethod) };
QtRuntimeConnectionMethod::QtRuntimeConnectionMethod(ExecState* exec, Structure* structure, const Identifier& identifier) QtRuntimeConnectionMethod::QtRuntimeConnectionMethod(ExecState* exec, Structure* structure, const Identifier& identifier)
: QtRuntimeMethod (new QtRuntimeConnectionMethodData(), exec, structure, identifier) : QtRuntimeMethod (new QtRuntimeConnectionMethodData(), exec, structure, identifier)
{ {
......
...@@ -170,6 +170,8 @@ public: ...@@ -170,6 +170,8 @@ public:
static void visitChildren(JSCell*, SlotVisitor&); static void visitChildren(JSCell*, SlotVisitor&);
static const ClassInfo s_info;
protected: protected:
QtRuntimeMetaMethodData* d_func() const {return reinterpret_cast<QtRuntimeMetaMethodData*>(d_ptr);} QtRuntimeMetaMethodData* d_func() const {return reinterpret_cast<QtRuntimeMetaMethodData*>(d_ptr);}
...@@ -201,6 +203,8 @@ public: ...@@ -201,6 +203,8 @@ public:
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&); virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties); virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
static const ClassInfo s_info;
protected: protected:
QtRuntimeConnectionMethodData* d_func() const {return reinterpret_cast<QtRuntimeConnectionMethodData*>(d_ptr);} QtRuntimeConnectionMethodData* d_func() const {return reinterpret_cast<QtRuntimeConnectionMethodData*>(d_ptr);}
......
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