Changeset 96630 in webkit


Ignore:
Timestamp:
Oct 4, 2011 12:22:00 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.

  • 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:
Location:
trunk/Source
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r96629 r96630  
     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
     16        * runtime/BooleanConstructor.cpp:
     17        * runtime/BooleanConstructor.h:
     18
     19        getCallData was not marked as static is StrictModeTypeErrorFunction. 
     20        * runtime/Error.cpp:
     21        (JSC::StrictModeTypeErrorFunction::getCallDataVirtual):
     22        (JSC::StrictModeTypeErrorFunction::getCallData):
     23        * runtime/ErrorConstructor.cpp:
     24        * runtime/ErrorConstructor.h:
     25        * runtime/FunctionConstructor.cpp:
     26        * runtime/FunctionConstructor.h:
     27        * runtime/FunctionPrototype.cpp:
     28        * runtime/FunctionPrototype.h:
     29
    1302011-10-04  Ryosuke Niwa  <rniwa@webkit.org>
    231
  • trunk/Source/JavaScriptCore/runtime/BooleanConstructor.cpp

    r96164 r96630  
    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

    r96164 r96630  
    3939        }
    4040
     41        static const ClassInfo s_info;
     42
    4143    protected:
    4244        void finishCreation(ExecState*, BooleanPrototype*);
  • trunk/Source/JavaScriptCore/runtime/Error.cpp

    r96164 r96630  
    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;
    213213    }
     214
     215    static const ClassInfo s_info;
    214216
    215217private:
     
    219221ASSERT_CLASS_FITS_IN_CELL(StrictModeTypeErrorFunction);
    220222
     223const ClassInfo StrictModeTypeErrorFunction::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(StrictModeTypeErrorFunction) };
     224
    221225JSValue createTypeErrorFunction(ExecState* exec, const UString& message)
    222226{
  • trunk/Source/JavaScriptCore/runtime/ErrorConstructor.cpp

    r96164 r96630  
    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

    r96164 r96630  
    4040        }
    4141
     42        static const ClassInfo s_info;
     43
    4244    protected:
    4345        void finishCreation(ExecState*, ErrorPrototype*);
  • trunk/Source/JavaScriptCore/runtime/FunctionConstructor.cpp

    r96164 r96630  
    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

    r96164 r96630  
    3939        }
    4040
     41        static const ClassInfo s_info;
     42
    4143    private:
    4244        FunctionConstructor(JSGlobalObject*, Structure*);
  • trunk/Source/JavaScriptCore/runtime/FunctionPrototype.cpp

    r96164 r96630  
    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

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

    r96628 r96630  
     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
     18        * bridge/qt/qt_runtime.cpp:
     19        * bridge/qt/qt_runtime.h:
     20
    1212011-10-04  Ryosuke Niwa  <rniwa@webkit.org>
    222
  • trunk/Source/WebCore/bridge/qt/qt_runtime.cpp

    r96346 r96630  
    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

    r96346 r96630  
    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.