• mhahnenberg@apple.com's avatar
    Add custom vtable struct to ClassInfo struct · 3e084662
    mhahnenberg@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=68567
    
    Reviewed by Oliver Hunt.
    
    Source/JavaScriptCore:
    
    Declared/defined the MethodTable struct and added it to the ClassInfo struct.
    Also defined the CREATE_METHOD_TABLE macro to generate these method tables
    succinctly where they need to be defined.
    
    Also added to it the first function to use this macro, visitChildren.
    
    This is part of the process of getting rid of all C++ virtual methods in JSCell.
    Eventually all virtual functions in JSCell that can't easily be converted to
    non-virtual functions will be put into this custom vtable structure.
    * runtime/ClassInfo.h:
    
    Added the CREATE_METHOD_TABLE macro call as the last argument to each of the
    ClassInfo structs declared in these classes.  This saves us from having to visit
    each s_info definition in the future when we add more methods to the MethodTable.
    * API/JSCallbackConstructor.cpp:
    * API/JSCallbackFunction.cpp:
    * API/JSCallbackObject.cpp:
    * JavaScriptCore.exp:
    * runtime/Arguments.cpp:
    * runtime/ArrayConstructor.cpp:
    * runtime/ArrayPrototype.cpp:
    * runtime/BooleanObject.cpp:
    * runtime/BooleanPrototype.cpp:
    * runtime/DateConstructor.cpp:
    * runtime/DateInstance.cpp:
    * runtime/DatePrototype.cpp:
    * runtime/ErrorInstance.cpp:
    * runtime/ErrorPrototype.cpp:
    * runtime/ExceptionHelpers.cpp:
    * runtime/Executable.cpp:
    * runtime/GetterSetter.cpp:
    * runtime/InternalFunction.cpp:
    * runtime/JSAPIValueWrapper.cpp:
    * runtime/JSActivation.cpp:
    * runtime/JSArray.cpp:
    * runtime/JSByteArray.cpp:
    * runtime/JSFunction.cpp:
    * runtime/JSGlobalObject.cpp:
    * runtime/JSONObject.cpp:
    * runtime/JSObject.cpp:
    * runtime/JSPropertyNameIterator.cpp:
    * runtime/JSString.cpp:
    * runtime/MathObject.cpp:
    * runtime/NativeErrorConstructor.cpp:
    * runtime/NumberConstructor.cpp:
    * runtime/NumberObject.cpp:
    * runtime/NumberPrototype.cpp:
    * runtime/ObjectConstructor.cpp:
    * runtime/ObjectPrototype.cpp:
    * runtime/RegExp.cpp:
    * runtime/RegExpConstructor.cpp:
    * runtime/RegExpObject.cpp:
    * runtime/RegExpPrototype.cpp:
    * runtime/ScopeChain.cpp:
    * runtime/StringConstructor.cpp:
    * runtime/StringObject.cpp:
    * runtime/StringPrototype.cpp:
    * runtime/Structure.cpp:
    * runtime/StructureChain.cpp:
    
    Had to make visitChildren and visitChildrenVirtual protected instead of private
    because some of the subclasses of JSWrapperObject need access to JSWrapperObject's
    visitChildren function pointer in their vtable since they don't provide their own
    implementation. Same for RegExpObject.
    * runtime/JSWrapperObject.h:
    * runtime/RegExpObject.h:
    
    Source/JavaScriptGlue:
    
    Added CREATE_METHOD_TABLE macro to generate the custom vtable for the
    specified class in its ClassInfo.  Also added to it the first function to use
    this macro, visitChildren.  This is part of the process of getting rid of all
    C++ virtual methods in JSCell.  Eventually all virtual functions in JSCell
    that can't easily be converted to non-virtual functions will be put into
    this custom vtable structure.
    
    * UserObjectImp.cpp:
    
    Source/WebCore:
    
    No new tests.
    
    Added CREATE_METHOD_TABLE macro to generate the custom vtable for the
    specified class in its ClassInfo.  Also added to it the first function to use
    this macro, visitChildren.  This is part of the process of getting rid of all
    C++ virtual methods in JSCell.  Eventually all virtual functions in JSCell
    that can't easily be converted to non-virtual functions will be put into
    this custom vtable structure.
    
    * bindings/js/JSAudioConstructor.cpp:
    * bindings/js/JSDOMGlobalObject.cpp:
    * bindings/js/JSDOMWindowBase.cpp:
    * bindings/js/JSDOMWindowShell.cpp:
    * bindings/js/JSImageConstructor.cpp:
    * bindings/js/JSImageDataCustom.cpp:
    (WebCore::toJS):
    * bindings/js/JSOptionConstructor.cpp:
    * bindings/js/JSWorkerContextBase.cpp:
    
    Changed the bindings generator to add the call to the CREATE_METHOD_TABLE macro where
    necessary.
    * bindings/scripts/CodeGeneratorJS.pm:
    (GenerateImplementation):
    (GenerateConstructorDefinition):
    * bindings/scripts/test/JS/JSTestInterface.cpp:
    * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
    * bindings/scripts/test/JS/JSTestObj.cpp:
    * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
    * bridge/c/CRuntimeObject.cpp:
    * bridge/c/c_instance.cpp:
    * bridge/jni/jsc/JavaInstanceJSC.cpp:
    * bridge/jni/jsc/JavaRuntimeObject.cpp:
    * bridge/objc/ObjCRuntimeObject.mm:
    * bridge/objc/objc_instance.mm:
    * bridge/objc/objc_runtime.mm:
    * bridge/qt/qt_instance.cpp:
    * bridge/qt/qt_pixmapruntime.cpp:
    * bridge/qt/qt_runtime.cpp:
    * bridge/runtime_array.cpp:
    * bridge/runtime_method.cpp:
    * bridge/runtime_object.cpp:
    
    Source/WebKit/mac:
    
    Added CREATE_METHOD_TABLE macro to generate the custom vtable for the
    specified class in its ClassInfo.  Also added to it the first function to use
    this macro, visitChildren.  This is part of the process of getting rid of all
    C++ virtual methods in JSCell.  Eventually all virtual functions in JSCell
    that can't easily be converted to non-virtual functions will be put into
    this custom vtable structure.
    
    * Plugins/Hosted/ProxyInstance.mm:
    * Plugins/Hosted/ProxyRuntimeObject.mm:
    
    Source/WebKit2:
    
    Added CREATE_METHOD_TABLE macro to generate the custom vtable for the
    specified class in its ClassInfo.  Also added to it the first function to use
    this macro, visitChildren.  This is part of the process of getting rid of all
    C++ virtual methods in JSCell.  Eventually all virtual functions in JSCell
    that can't easily be converted to non-virtual functions will be put into
    this custom vtable structure.
    
    * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
    * WebProcess/Plugins/Netscape/JSNPObject.cpp:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@95936 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    3e084662
JSArray.cpp 45.9 KB