Changeset 96164 in webkit for trunk/Source/JavaScriptCore/API


Ignore:
Timestamp:
Sep 27, 2011, 3:46:51 PM (14 years ago)
Author:
[email protected]
Message:

Source/JavaScriptCore: Add static version of JSCell::getCallData
https://bugs.webkit.org/show_bug.cgi?id=68741

Reviewed by Darin Adler.

In this patch we just extract the bodies of the virtual getCallData methods
throughout the JSCell inheritance hierarchy out into static methods, which are
now called from the virtual methods. This is an intermediate step in trying to
move the virtual-ness of getCallData into our own method table stored in
ClassInfo. We need to convert the methods to static methods because static methods
can be represented as function pointers rather than pointers to member functions, and
function pointers are smaller and faster to call than pointers to member functions.

  • API/JSCallbackFunction.cpp:

(JSC::JSCallbackFunction::getCallDataVirtual):
(JSC::JSCallbackFunction::getCallData):

  • API/JSCallbackFunction.h:
  • API/JSCallbackObject.h:
  • API/JSCallbackObjectFunctions.h:

(JSC::::getCallDataVirtual):
(JSC::::getCallData):

  • API/JSObjectRef.cpp:

(JSObjectIsFunction):
(JSObjectCallAsFunction):

(JSC::Interpreter::privateExecute):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • runtime/ArrayConstructor.cpp:

(JSC::ArrayConstructor::getCallDataVirtual):
(JSC::ArrayConstructor::getCallData):

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

(JSC::BooleanConstructor::getCallDataVirtual):
(JSC::BooleanConstructor::getCallData):

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

(JSC::DateConstructor::getCallDataVirtual):
(JSC::DateConstructor::getCallData):

  • runtime/DateConstructor.h:
  • runtime/Error.cpp:

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

  • runtime/ErrorConstructor.cpp:

(JSC::ErrorConstructor::getCallDataVirtual):
(JSC::ErrorConstructor::getCallData):

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

(JSC::FunctionConstructor::getCallDataVirtual):
(JSC::FunctionConstructor::getCallData):

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

(JSC::FunctionPrototype::getCallDataVirtual):
(JSC::FunctionPrototype::getCallData):

  • runtime/FunctionPrototype.h:
  • runtime/InternalFunction.h:
  • runtime/JSCell.cpp:

(JSC::JSCell::getCallDataVirtual):
(JSC::JSCell::getCallData):

  • runtime/JSCell.h:

(JSC::getCallData):

  • runtime/JSFunction.cpp:

(JSC::JSFunction::getCallDataVirtual):
(JSC::JSFunction::getCallData):

  • runtime/JSFunction.h:
  • runtime/JSONObject.cpp:

(JSC::Stringifier::Stringifier):
(JSC::Stringifier::toJSON):
(JSC::Stringifier::appendStringifiedValue):

  • runtime/JSObject.cpp:

(JSC::JSObject::put):

  • runtime/NativeErrorConstructor.cpp:

(JSC::NativeErrorConstructor::getCallDataVirtual):
(JSC::NativeErrorConstructor::getCallData):

  • runtime/NativeErrorConstructor.h:
  • runtime/NumberConstructor.cpp:

(JSC::NumberConstructor::getCallDataVirtual):
(JSC::NumberConstructor::getCallData):

  • runtime/NumberConstructor.h:
  • runtime/ObjectConstructor.cpp:

(JSC::ObjectConstructor::getCallDataVirtual):
(JSC::ObjectConstructor::getCallData):

  • runtime/ObjectConstructor.h:
  • runtime/Operations.cpp:

(JSC::jsTypeStringForValue):
(JSC::jsIsObjectType):
(JSC::jsIsFunctionType):

  • runtime/PropertySlot.cpp:

(JSC::PropertySlot::functionGetter):

  • runtime/RegExpConstructor.cpp:

(JSC::RegExpConstructor::getCallDataVirtual):
(JSC::RegExpConstructor::getCallData):

  • runtime/RegExpConstructor.h:
  • runtime/StringConstructor.cpp:

(JSC::StringConstructor::getCallDataVirtual):
(JSC::StringConstructor::getCallData):

  • runtime/StringConstructor.h:

Source/JavaScriptGlue: Add static version of JSCell::getCallData
https://bugs.webkit.org/show_bug.cgi?id=68741

Reviewed by Darin Adler.

In this patch we just extract the bodies of the virtual getCallData methods
throughout the JSCell inheritance hierarchy out into static methods, which are
now called from the virtual methods. This is an intermediate step in trying to
move the virtual-ness of getCallData into our own method table stored in
ClassInfo. We need to convert the methods to static methods because static methods
can be represented as function pointers rather than pointers to member functions, and
function pointers are smaller and faster to call than pointers to member functions.

  • JSValueWrapper.cpp:

(JSValueWrapper::JSObjectCallFunction):

  • UserObjectImp.cpp:

(UserObjectImp::getCallDataVirtual):
(UserObjectImp::getCallData):

  • UserObjectImp.h:

Source/WebCore: Add static version of JSCell::visitChildren
https://bugs.webkit.org/show_bug.cgi?id=68404

Reviewed by Darin Adler.

No new tests.

In this patch we just extract the bodies of the virtual visitChildren methods
throughout the JSCell inheritance hierarchy out into static methods, which are
now called from the virtual methods. This is an intermediate step in trying to
move the virtual-ness of visitChildren into our own custom vtable stored in
ClassInfo. We need to convert the methods to static methods in order to be
able to more easily store and refer to them in our custom vtable since normal
member methods store some implicit information in their types, making it
impossible to store them generically in ClassInfo.

  • WebCore.exp.in:
  • bindings/js/JSAttrCustom.cpp:

(WebCore::JSAttr::visitChildrenVirtual):
(WebCore::JSAttr::visitChildren):

  • bindings/js/JSAudioContextCustom.cpp:

(WebCore::JSAudioContext::visitChildrenVirtual):
(WebCore::JSAudioContext::visitChildren):

  • bindings/js/JSCSSRuleCustom.cpp:

(WebCore::JSCSSRule::visitChildrenVirtual):
(WebCore::JSCSSRule::visitChildren):

  • bindings/js/JSCSSStyleDeclarationCustom.cpp:

(WebCore::JSCSSStyleDeclaration::visitChildrenVirtual):
(WebCore::JSCSSStyleDeclaration::visitChildren):

  • bindings/js/JSCanvasRenderingContextCustom.cpp:

(WebCore::JSCanvasRenderingContext::visitChildrenVirtual):
(WebCore::JSCanvasRenderingContext::visitChildren):

  • bindings/js/JSDOMGlobalObject.cpp:

(WebCore::JSDOMGlobalObject::visitChildrenVirtual):
(WebCore::JSDOMGlobalObject::visitChildren):

  • bindings/js/JSDOMGlobalObject.h:
  • bindings/js/JSDOMWindowCustom.cpp:

(WebCore::JSDOMWindow::visitChildrenVirtual):
(WebCore::JSDOMWindow::visitChildren):

  • bindings/js/JSDOMWindowShell.cpp:

(WebCore::JSDOMWindowShell::visitChildrenVirtual):
(WebCore::JSDOMWindowShell::visitChildren):

  • bindings/js/JSDOMWindowShell.h:
  • bindings/js/JSJavaScriptAudioNodeCustom.cpp:

(WebCore::JSJavaScriptAudioNode::visitChildrenVirtual):
(WebCore::JSJavaScriptAudioNode::visitChildren):

  • bindings/js/JSMessageChannelCustom.cpp:

(WebCore::JSMessageChannel::visitChildrenVirtual):
(WebCore::JSMessageChannel::visitChildren):

  • bindings/js/JSMessagePortCustom.cpp:

(WebCore::JSMessagePort::visitChildrenVirtual):
(WebCore::JSMessagePort::visitChildren):

  • bindings/js/JSNamedNodeMapCustom.cpp:

(WebCore::JSNamedNodeMap::visitChildrenVirtual):
(WebCore::JSNamedNodeMap::visitChildren):

  • bindings/js/JSNodeCustom.cpp:

(WebCore::JSNode::visitChildrenVirtual):
(WebCore::JSNode::visitChildren):

  • bindings/js/JSNodeFilterCustom.cpp:

(WebCore::JSNodeFilter::visitChildrenVirtual):
(WebCore::JSNodeFilter::visitChildren):

  • bindings/js/JSNodeIteratorCustom.cpp:

(WebCore::JSNodeIterator::visitChildrenVirtual):
(WebCore::JSNodeIterator::visitChildren):

  • bindings/js/JSSVGElementInstanceCustom.cpp:

(WebCore::JSSVGElementInstance::visitChildrenVirtual):
(WebCore::JSSVGElementInstance::visitChildren):

  • bindings/js/JSSharedWorkerCustom.cpp:

(WebCore::JSSharedWorker::visitChildrenVirtual):
(WebCore::JSSharedWorker::visitChildren):

  • bindings/js/JSStyleSheetCustom.cpp:

(WebCore::JSStyleSheet::visitChildrenVirtual):
(WebCore::JSStyleSheet::visitChildren):

  • bindings/js/JSTreeWalkerCustom.cpp:

(WebCore::JSTreeWalker::visitChildrenVirtual):
(WebCore::JSTreeWalker::visitChildren):

  • bindings/js/JSWebGLRenderingContextCustom.cpp:

(WebCore::JSWebGLRenderingContext::visitChildrenVirtual):
(WebCore::JSWebGLRenderingContext::visitChildren):

  • bindings/js/JSWorkerContextCustom.cpp:

(WebCore::JSWorkerContext::visitChildrenVirtual):
(WebCore::JSWorkerContext::visitChildren):

  • bindings/js/JSXMLHttpRequestCustom.cpp:

(WebCore::JSXMLHttpRequest::visitChildrenVirtual):
(WebCore::JSXMLHttpRequest::visitChildren):

  • bindings/js/JSXPathResultCustom.cpp:

(WebCore::JSXPathResult::visitChildrenVirtual):
(WebCore::JSXPathResult::visitChildren):

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateHeader):
(GenerateImplementation):

  • bindings/scripts/test/JS/JSTestObj.cpp:

(WebCore::JSTestObj::visitChildrenVirtual):
(WebCore::JSTestObj::visitChildren):

  • bindings/scripts/test/JS/JSTestObj.h:
  • bridge/qt/qt_instance.cpp:

(JSC::Bindings::QtRuntimeObject::visitChildrenVirtual):
(JSC::Bindings::QtRuntimeObject::visitChildren):

  • bridge/qt/qt_runtime.cpp:

(JSC::Bindings::QtRuntimeMetaMethod::visitChildrenVirtual):
(JSC::Bindings::QtRuntimeMetaMethod::visitChildren):

  • bridge/qt/qt_runtime.h:
  • workers/WorkerContext.h:

Source/WebKit/mac: Add static version of JSCell::getCallData
https://bugs.webkit.org/show_bug.cgi?id=68741

Reviewed by Darin Adler.

In this patch we just extract the bodies of the virtual getCallData methods
throughout the JSCell inheritance hierarchy out into static methods, which are
now called from the virtual methods. This is an intermediate step in trying to
move the virtual-ness of getCallData into our own method table stored in
ClassInfo. We need to convert the methods to static methods because static methods
can be represented as function pointers rather than pointers to member functions, and
function pointers are smaller and faster to call than pointers to member functions.

  • Plugins/Hosted/NetscapePluginInstanceProxy.mm:

(WebKit::NetscapePluginInstanceProxy::invokeDefault):

Source/WebKit2: Add static version of JSCell::getCallData
https://bugs.webkit.org/show_bug.cgi?id=68741

Reviewed by Darin Adler.

In this patch we just extract the bodies of the virtual getCallData methods
throughout the JSCell inheritance hierarchy out into static methods, which are
now called from the virtual methods. This is an intermediate step in trying to
move the virtual-ness of getCallData into our own method table stored in
ClassInfo. We need to convert the methods to static methods because static methods
can be represented as function pointers rather than pointers to member functions, and
function pointers are smaller and faster to call than pointers to member functions.

  • WebProcess/Plugins/Netscape/JSNPMethod.cpp:

(WebKit::JSNPMethod::getCallDataVirtual):
(WebKit::JSNPMethod::getCallData):

  • WebProcess/Plugins/Netscape/JSNPMethod.h:
  • WebProcess/Plugins/Netscape/JSNPObject.cpp:

(WebKit::JSNPObject::getCallDataVirtual):
(WebKit::JSNPObject::getCallData):

  • WebProcess/Plugins/Netscape/JSNPObject.h:
Location:
trunk/Source/JavaScriptCore/API
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSCallbackFunction.cpp

    r95936 r96164  
    7878}
    7979
    80 CallType JSCallbackFunction::getCallData(CallData& callData)
     80CallType JSCallbackFunction::getCallDataVirtual(CallData& callData)
     81{
     82    return getCallData(this, callData);
     83}
     84
     85CallType JSCallbackFunction::getCallData(JSCell*, CallData& callData)
    8186{
    8287    callData.native.function = call;
  • trunk/Source/JavaScriptCore/API/JSCallbackFunction.h

    r95108 r96164  
    5757
    5858private:
    59     virtual CallType getCallData(CallData&);
     59    virtual CallType getCallDataVirtual(CallData&);
     60    static CallType getCallData(JSCell*, CallData&);
    6061
    6162    static EncodedJSValue JSC_HOST_CALL call(ExecState*);
  • trunk/Source/JavaScriptCore/API/JSCallbackObject.h

    r95849 r96164  
    195195
    196196    virtual ConstructType getConstructData(ConstructData&);
    197     virtual CallType getCallData(CallData&);
     197    virtual CallType getCallDataVirtual(CallData&);
     198    static CallType getCallData(JSCell*, CallData&);
    198199
    199200    virtual void visitChildrenVirtual(SlotVisitor& visitor)
  • trunk/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h

    r95250 r96164  
    373373
    374374template <class Parent>
    375 CallType JSCallbackObject<Parent>::getCallData(CallData& callData)
    376 {
    377     for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
     375CallType JSCallbackObject<Parent>::getCallDataVirtual(CallData& callData)
     376{
     377    return getCallData(this, callData);
     378}
     379
     380template <class Parent>
     381CallType JSCallbackObject<Parent>::getCallData(JSCell* cell, CallData& callData)
     382{
     383    JSCallbackObject* thisObject = static_cast<JSCallbackObject*>(cell);
     384    for (JSClassRef jsClass = thisObject->classRef(); jsClass; jsClass = jsClass->parentClass) {
    378385        if (jsClass->callAsFunction) {
    379386            callData.native.function = call;
  • trunk/Source/JavaScriptCore/API/JSObjectRef.cpp

    r94701 r96164  
    417417{
    418418    CallData callData;
    419     return toJS(object)->getCallData(callData) != CallTypeNone;
     419    return toJS(object)->getCallDataVirtual(callData) != CallTypeNone;
    420420}
    421421
     
    436436
    437437    CallData callData;
    438     CallType callType = jsObject->getCallData(callData);
     438    CallType callType = jsObject->getCallDataVirtual(callData);
    439439    if (callType == CallTypeNone)
    440440        return 0;
Note: See TracChangeset for help on using the changeset viewer.