Changeset 96674 in webkit


Ignore:
Timestamp:
Oct 4, 2011 7:47:42 PM (13 years ago)
Author:
mhahnenberg@apple.com
Message:

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.
Also added new createStructure methods to those classes that didn't have
them so that the new ClassInfo structs would be used when creating the Structures
in these classes.

  • runtime/BooleanConstructor.cpp:
  • runtime/BooleanConstructor.h:

(JSC::BooleanConstructor::createStructure):

getCallData was not marked as static in StrictModeTypeErrorFunction.

  • runtime/Error.cpp:

(JSC::StrictModeTypeErrorFunction::getCallDataVirtual):
(JSC::StrictModeTypeErrorFunction::getCallData):
(JSC::StrictModeTypeErrorFunction::createStructure):

  • runtime/ErrorConstructor.cpp:
  • runtime/ErrorConstructor.h:

(JSC::ErrorConstructor::createStructure):

  • runtime/FunctionConstructor.cpp:
  • runtime/FunctionConstructor.h:

(JSC::FunctionConstructor::createStructure):

  • 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.
Also added new createStructure methods to those classes that didn't have
them so that the new ClassInfo structs would be used when creating the Structures
in these classes.

  • bridge/qt/qt_runtime.cpp:
  • bridge/qt/qt_runtime.h:
Location:
trunk/Source
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r96673 r96674  
     12011-10-04  Mark Hahnenberg  <mhahnenberg@apple.com>
     2
     3        Add static ClassInfo structs to classes that override JSCell::getCallData
     4        https://bugs.webkit.org/show_bug.cgi?id=69311
     5
     6        Reviewed by Darin Adler.
     7
     8        Added ClassInfo structs to each class that defined its own getCallData
     9        function but did not already have its own ClassInfo struct.  This is a
     10        necessary addition for when we switch over to looking up getCallData from
     11        the MethodTable in ClassInfo rather than doing the virtual call (which we
     12        are removing).  These new ClassInfo structs are public because we often
     13        use these structs in other areas of the code to uniquely identify JSC classes and
     14        to enforce runtime invariants based on those class identities using ASSERTs.
     15        Also added new createStructure methods to those classes that didn't have
     16        them so that the new ClassInfo structs would be used when creating the Structures
     17        in these classes.
     18
     19        * runtime/BooleanConstructor.cpp:
     20        * runtime/BooleanConstructor.h:
     21        (JSC::BooleanConstructor::createStructure):
     22
     23        getCallData was not marked as static in StrictModeTypeErrorFunction. 
     24        * runtime/Error.cpp:
     25        (JSC::StrictModeTypeErrorFunction::getCallDataVirtual):
     26        (JSC::StrictModeTypeErrorFunction::getCallData):
     27        (JSC::StrictModeTypeErrorFunction::createStructure):
     28        * runtime/ErrorConstructor.cpp:
     29        * runtime/ErrorConstructor.h:
     30        (JSC::ErrorConstructor::createStructure):
     31        * runtime/FunctionConstructor.cpp:
     32        * runtime/FunctionConstructor.h:
     33        (JSC::FunctionConstructor::createStructure):
     34        * runtime/FunctionPrototype.cpp:
     35        * runtime/FunctionPrototype.h:
     36
    1372011-10-03  Geoffrey Garen  <ggaren@apple.com>
    238
  • trunk/Source/JavaScriptCore/runtime/BooleanConstructor.cpp

    r96637 r96674  
    2828
    2929ASSERT_CLASS_FITS_IN_CELL(BooleanConstructor);
     30
     31const ClassInfo BooleanConstructor::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(BooleanConstructor) };
    3032
    3133BooleanConstructor::BooleanConstructor(JSGlobalObject* globalObject, Structure* structure)
  • trunk/Source/JavaScriptCore/runtime/BooleanConstructor.h

    r96637 r96674  
    3939        }
    4040
     41        static const ClassInfo s_info;
     42
     43        static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype)
     44        {
     45            return Structure::create(globalData, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info);
     46        }
     47
    4148    protected:
    4249        void finishCreation(ExecState*, BooleanPrototype*);
  • trunk/Source/JavaScriptCore/runtime/Error.cpp

    r96637 r96674  
    202202    }
    203203
    204     CallType getCallDataVirtual(CallData& callData)
     204    virtual CallType getCallDataVirtual(CallData& callData)
    205205    {
    206206        return getCallData(this, callData);
    207207    }
    208208
    209     CallType getCallData(JSCell*, CallData& callData)
     209    static CallType getCallData(JSCell*, CallData& callData)
    210210    {
    211211        callData.native.function = callThrowTypeError;
    212212        return CallTypeHost;
     213    }
     214
     215    static const ClassInfo s_info;
     216
     217    static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype)
     218    {
     219        return Structure::create(globalData, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info);
    213220    }
    214221
     
    219226ASSERT_CLASS_FITS_IN_CELL(StrictModeTypeErrorFunction);
    220227
     228const ClassInfo StrictModeTypeErrorFunction::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(StrictModeTypeErrorFunction) };
     229
    221230JSValue createTypeErrorFunction(ExecState* exec, const UString& message)
    222231{
  • trunk/Source/JavaScriptCore/runtime/ErrorConstructor.cpp

    r96637 r96674  
    2929
    3030ASSERT_CLASS_FITS_IN_CELL(ErrorConstructor);
     31
     32const ClassInfo ErrorConstructor::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(ErrorConstructor) };
    3133
    3234ErrorConstructor::ErrorConstructor(JSGlobalObject* globalObject, Structure* structure)
  • trunk/Source/JavaScriptCore/runtime/ErrorConstructor.h

    r96637 r96674  
    4040        }
    4141
     42        static const ClassInfo s_info;
     43
     44        static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype)
     45        {
     46            return Structure::create(globalData, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info);
     47        }
     48
    4249    protected:
    4350        void finishCreation(ExecState*, ErrorPrototype*);
  • trunk/Source/JavaScriptCore/runtime/FunctionConstructor.cpp

    r96637 r96674  
    3737
    3838ASSERT_CLASS_FITS_IN_CELL(FunctionConstructor);
     39
     40const ClassInfo FunctionConstructor::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(FunctionConstructor) };
    3941
    4042FunctionConstructor::FunctionConstructor(JSGlobalObject* globalObject, Structure* structure)
  • trunk/Source/JavaScriptCore/runtime/FunctionConstructor.h

    r96637 r96674  
    3939        }
    4040
     41        static const ClassInfo s_info;
     42
     43        static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype)
     44        {
     45            return Structure::create(globalData, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info);
     46        }
     47
    4148    private:
    4249        FunctionConstructor(JSGlobalObject*, Structure*);
  • trunk/Source/JavaScriptCore/runtime/FunctionPrototype.cpp

    r96673 r96674  
    3939static EncodedJSValue JSC_HOST_CALL functionProtoFuncCall(ExecState*);
    4040static EncodedJSValue JSC_HOST_CALL functionProtoFuncBind(ExecState*);
     41
     42const ClassInfo FunctionPrototype::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(FunctionPrototype) };
    4143
    4244FunctionPrototype::FunctionPrototype(JSGlobalObject* globalObject, Structure* structure)
  • trunk/Source/JavaScriptCore/runtime/FunctionPrototype.h

    r96637 r96674  
    4444        }
    4545
     46        static const ClassInfo s_info;
     47
    4648    protected:
    4749        void finishCreation(ExecState*, const Identifier& name);
  • trunk/Source/WebCore/ChangeLog

    r96673 r96674  
     12011-10-04  Mark Hahnenberg  <mhahnenberg@apple.com>
     2
     3        Add static ClassInfo structs to classes that override JSCell::getCallData
     4        https://bugs.webkit.org/show_bug.cgi?id=69311
     5
     6        Reviewed by Darin Adler.
     7
     8        No new tests.
     9
     10        Added ClassInfo structs to each class that defined its own getCallData
     11        function but did not already have its own ClassInfo struct.  This is a
     12        necessary addition for when we switch over to looking up getCallData from
     13        the MethodTable in ClassInfo rather than doing the virtual call (which we
     14        are removing).  These new ClassInfo structs are public because we often
     15        use these structs in other areas of the code to uniquely identify JSC classes and
     16        to enforce runtime invariants based on those class identities using ASSERTs.
     17        Also added new createStructure methods to those classes that didn't have
     18        them so that the new ClassInfo structs would be used when creating the Structures
     19        in these classes.
     20
     21        * bridge/qt/qt_runtime.cpp:
     22        * bridge/qt/qt_runtime.h:
     23
    1242011-10-03  Geoffrey Garen  <ggaren@apple.com>
    225
  • trunk/Source/WebCore/bridge/qt/qt_runtime.cpp

    r96637 r96674  
    14261426}
    14271427
     1428const ClassInfo QtRuntimeMetaMethod::s_info = { "QtRuntimeMethod", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(QtRuntimeMetaMethod) };
     1429
    14281430QtRuntimeMetaMethod::QtRuntimeMetaMethod(ExecState* exec, Structure* structure, const Identifier& identifier)
    14291431    : QtRuntimeMethod (new QtRuntimeMetaMethodData(), exec, structure, identifier)
     
    15801582
    15811583QMultiMap<QObject*, QtConnectionObject*> QtRuntimeConnectionMethod::connections;
     1584
     1585const ClassInfo QtRuntimeConnectionMethod::s_info = { "QtRuntimeMethod", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(QtRuntimeConnectionMethod) };
    15821586
    15831587QtRuntimeConnectionMethod::QtRuntimeConnectionMethod(ExecState* exec, Structure* structure, const Identifier& identifier)
  • trunk/Source/WebCore/bridge/qt/qt_runtime.h

    r96637 r96674  
    171171    static void visitChildren(JSCell*, SlotVisitor&);
    172172
     173    static const ClassInfo s_info;
     174
    173175protected:
    174176    QtRuntimeMetaMethodData* d_func() const {return reinterpret_cast<QtRuntimeMetaMethodData*>(d_ptr);}
     
    202204    virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
    203205    virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
     206 
     207    static const ClassInfo s_info;
    204208
    205209protected:
Note: See TracChangeset for help on using the changeset viewer.