De-virtualize JSCell::visitChildrenVirtual and remove all other visitChildrenVirtual...
authormhahnenberg@apple.com <mhahnenberg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Sep 2011 19:37:09 +0000 (19:37 +0000)
committermhahnenberg@apple.com <mhahnenberg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Sep 2011 19:37:09 +0000 (19:37 +0000)
commit1da71978fcaa522c6d1be3a4287bf7581f92432d
tree2b9f1619f98f5edb9e2a1dea16f2387bd719bb88
parenta543bd2e910fd5a322b9288333388ff1e4b4b7fb
De-virtualize JSCell::visitChildrenVirtual and remove all other visitChildrenVirtual methods
https://bugs.webkit.org/show_bug.cgi?id=68839

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Removed the remaining visitChildrenVirtual methods.  This patch completes the process of
de-virtualizing visitChildren.

* API/JSCallbackObject.h:
* JavaScriptCore.exp:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
* debugger/DebuggerActivation.cpp:
* debugger/DebuggerActivation.h:
* runtime/Arguments.cpp:
* runtime/Arguments.h:
* runtime/Executable.cpp:
* runtime/Executable.h:
* runtime/GetterSetter.cpp:
* runtime/GetterSetter.h:
* runtime/JSActivation.cpp:
* runtime/JSActivation.h:
* runtime/JSArray.cpp:
* runtime/JSArray.h:
* runtime/JSFunction.cpp:
* runtime/JSFunction.h:
* runtime/JSGlobalObject.cpp:
* runtime/JSGlobalObject.h:
* runtime/JSObject.cpp:
* runtime/JSPropertyNameIterator.cpp:
* runtime/JSPropertyNameIterator.h:
* runtime/JSStaticScopeObject.cpp:
* runtime/JSStaticScopeObject.h:
* runtime/JSValue.h:
* runtime/NativeErrorConstructor.cpp:
* runtime/NativeErrorConstructor.h:
* runtime/RegExpObject.cpp:
* runtime/RegExpObject.h:
* runtime/Structure.cpp:
* runtime/Structure.h:
* runtime/StructureChain.cpp:
* runtime/StructureChain.h:

Inlined the method table access and call to the visitChildren function (the only call sites
to visitChildren are here).
* heap/MarkStack.cpp:
(JSC::SlotVisitor::visitChildren):

Changed the field name for the visitChildren function pointer to visitChildren (from
visitChildrenFunctionPtr) to make call sites less verbose.
* runtime/ClassInfo.h:

Discovered JSBoundFunction doesn't have its own ClassInfo (it used JSFunction's ClassInfo) but
overrides visitChildren, so it needs to have its own ClassInfo.
* runtime/JSBoundFunction.cpp:
* runtime/JSBoundFunction.h:

Had to move className up to make sure that the virtual destructor in JSObject wasn't
the first non-inline virtual method in JSObject (as per the comment in the file).
Also moved JSCell::visitChildrenVirtual into JSObject.h in order for it be inline-able
to mitigate the cost of an extra method call.

Also added a convenience accessor function methodTable() to JSCell to return the MethodTable to make
call sites more concise.  Implementation is inline in JSObject.h.
* runtime/JSObject.h:
(JSC::JSCell::methodTable):
* runtime/JSCell.h:

Added an out of line virtual destructor to JSWrapperObject and ScopeChainNode to
appease the vtable gods.  It refused to compile if there were no virtual methods in
both of these classes due to the presence of a weak vtable pointer.
* runtime/JSWrapperObject.cpp:
(JSC::JSWrapperObject::~JSWrapperObject):
* runtime/JSWrapperObject.h:
* runtime/ScopeChain.cpp:
(JSC::ScopeChainNode::~ScopeChainNode):
* runtime/ScopeChain.h:

Source/JavaScriptGlue:

Removed the remaining visitChildrenVirtual methods.  This patch completes the process of
de-virtualizing visitChildren.

* UserObjectImp.cpp:
* UserObjectImp.h:

Source/WebCore:

No new tests.

Removed the remaining visitChildrenVirtual methods.  This patch completes the process of
de-virtualizing visitChildren.

* WebCore.exp.in:
* bindings/js/JSAttrCustom.cpp:
* bindings/js/JSAudioContextCustom.cpp:
* bindings/js/JSCSSRuleCustom.cpp:
* bindings/js/JSCSSStyleDeclarationCustom.cpp:
* bindings/js/JSCanvasRenderingContextCustom.cpp:
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::~JSDOMGlobalObject):
(WebCore::JSDOMGlobalObject::finishCreation):
* bindings/js/JSDOMGlobalObject.h:
* bindings/js/JSDOMWindowCustom.cpp:
* bindings/js/JSDOMWindowShell.cpp:
* bindings/js/JSDOMWindowShell.h:
* bindings/js/JSJavaScriptAudioNodeCustom.cpp:
* bindings/js/JSMessageChannelCustom.cpp:
* bindings/js/JSMessagePortCustom.cpp:
* bindings/js/JSNamedNodeMapCustom.cpp:
* bindings/js/JSNodeCustom.cpp:
* bindings/js/JSNodeFilterCustom.cpp:
* bindings/js/JSNodeIteratorCustom.cpp:
* bindings/js/JSSVGElementInstanceCustom.cpp:
* bindings/js/JSSharedWorkerCustom.cpp:
* bindings/js/JSStyleSheetCustom.cpp:
* bindings/js/JSTreeWalkerCustom.cpp:
* bindings/js/JSWebGLRenderingContextCustom.cpp:
* bindings/js/JSWorkerContextCustom.cpp:
* bindings/js/JSXMLHttpRequestCustom.cpp:
* bindings/js/JSXPathResultCustom.cpp:
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
(GenerateImplementation):
* bridge/qt/qt_instance.cpp:
* bridge/qt/qt_runtime.cpp:
* bridge/qt/qt_runtime.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@96346 268f45cc-cd09-0410-ab3c-d52691b4dbfc
78 files changed:
Source/JavaScriptCore/API/JSCallbackObject.h
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.exp
Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
Source/JavaScriptCore/debugger/DebuggerActivation.cpp
Source/JavaScriptCore/debugger/DebuggerActivation.h
Source/JavaScriptCore/heap/MarkStack.cpp
Source/JavaScriptCore/runtime/Arguments.cpp
Source/JavaScriptCore/runtime/Arguments.h
Source/JavaScriptCore/runtime/ClassInfo.h
Source/JavaScriptCore/runtime/Executable.cpp
Source/JavaScriptCore/runtime/Executable.h
Source/JavaScriptCore/runtime/GetterSetter.cpp
Source/JavaScriptCore/runtime/GetterSetter.h
Source/JavaScriptCore/runtime/JSActivation.cpp
Source/JavaScriptCore/runtime/JSActivation.h
Source/JavaScriptCore/runtime/JSArray.cpp
Source/JavaScriptCore/runtime/JSArray.h
Source/JavaScriptCore/runtime/JSBoundFunction.cpp
Source/JavaScriptCore/runtime/JSBoundFunction.h
Source/JavaScriptCore/runtime/JSCell.h
Source/JavaScriptCore/runtime/JSFunction.cpp
Source/JavaScriptCore/runtime/JSFunction.h
Source/JavaScriptCore/runtime/JSGlobalObject.cpp
Source/JavaScriptCore/runtime/JSGlobalObject.h
Source/JavaScriptCore/runtime/JSObject.cpp
Source/JavaScriptCore/runtime/JSObject.h
Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp
Source/JavaScriptCore/runtime/JSPropertyNameIterator.h
Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp
Source/JavaScriptCore/runtime/JSStaticScopeObject.h
Source/JavaScriptCore/runtime/JSValue.h
Source/JavaScriptCore/runtime/JSWrapperObject.cpp
Source/JavaScriptCore/runtime/JSWrapperObject.h
Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp
Source/JavaScriptCore/runtime/NativeErrorConstructor.h
Source/JavaScriptCore/runtime/RegExpObject.cpp
Source/JavaScriptCore/runtime/RegExpObject.h
Source/JavaScriptCore/runtime/ScopeChain.cpp
Source/JavaScriptCore/runtime/ScopeChain.h
Source/JavaScriptCore/runtime/Structure.cpp
Source/JavaScriptCore/runtime/Structure.h
Source/JavaScriptCore/runtime/StructureChain.cpp
Source/JavaScriptCore/runtime/StructureChain.h
Source/JavaScriptGlue/ChangeLog
Source/JavaScriptGlue/UserObjectImp.cpp
Source/JavaScriptGlue/UserObjectImp.h
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/bindings/js/JSAttrCustom.cpp
Source/WebCore/bindings/js/JSAudioContextCustom.cpp
Source/WebCore/bindings/js/JSCSSRuleCustom.cpp
Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
Source/WebCore/bindings/js/JSCanvasRenderingContextCustom.cpp
Source/WebCore/bindings/js/JSDOMGlobalObject.cpp
Source/WebCore/bindings/js/JSDOMGlobalObject.h
Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
Source/WebCore/bindings/js/JSDOMWindowShell.cpp
Source/WebCore/bindings/js/JSDOMWindowShell.h
Source/WebCore/bindings/js/JSJavaScriptAudioNodeCustom.cpp
Source/WebCore/bindings/js/JSMessageChannelCustom.cpp
Source/WebCore/bindings/js/JSMessagePortCustom.cpp
Source/WebCore/bindings/js/JSNamedNodeMapCustom.cpp
Source/WebCore/bindings/js/JSNodeCustom.cpp
Source/WebCore/bindings/js/JSNodeFilterCustom.cpp
Source/WebCore/bindings/js/JSNodeIteratorCustom.cpp
Source/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp
Source/WebCore/bindings/js/JSSharedWorkerCustom.cpp
Source/WebCore/bindings/js/JSStyleSheetCustom.cpp
Source/WebCore/bindings/js/JSTreeWalkerCustom.cpp
Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp
Source/WebCore/bindings/js/JSWorkerContextCustom.cpp
Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
Source/WebCore/bindings/js/JSXPathResultCustom.cpp
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bridge/qt/qt_instance.cpp
Source/WebCore/bridge/qt/qt_runtime.cpp
Source/WebCore/bridge/qt/qt_runtime.h