Ignore:
Timestamp:
Oct 7, 2011, 6:44:10 PM (14 years ago)
Author:
[email protected]
Message:

Remove getCallDataVirtual methods
https://bugs.webkit.org/show_bug.cgi?id=69186

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Removed all getCallDataVirtual methods and replaced their call sites
with an explicit lookup in the MethodTable.

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

(JSObjectIsFunction):
(JSObjectCallAsFunction):

(JSC::Interpreter::privateExecute):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

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

(JSC::createTypeErrorFunction):

Moved StrictModeTypeErrorFunction to Error.h in order to be able to include
the class definition in JSGlobalObject.cpp.

  • runtime/Error.h:

(JSC::StrictModeTypeErrorFunction::StrictModeTypeErrorFunction):
(JSC::StrictModeTypeErrorFunction::create):
(JSC::StrictModeTypeErrorFunction::constructThrowTypeError):
(JSC::StrictModeTypeErrorFunction::getConstructData):
(JSC::StrictModeTypeErrorFunction::callThrowTypeError):
(JSC::StrictModeTypeErrorFunction::getCallData):
(JSC::StrictModeTypeErrorFunction::createStructure):

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

To allow subclasses of InternalFunction (e.g. QtRuntimeMethod) to not have
to declare their own ClassInfo if they don't override getCallData, provided
an implementation that calls ASSERT_NOT_REACHED if called, providing roughly the same
functionality as of the pure virtual method InternalFunction used to have.
Also made this new implementation protected rather than private for the same reason.
Also added an ASSERT in InternalFunction::finishCreation to make sure that whatever
object is being created provides their own implementation of getCallData. This
just makes execution fail earlier in a place where the source of the error is
easy to trace. These ASSERTs are better than putting a null in the MethodTable because
they appear much more intentional to anybody who fails to provide their own
implementation or who tries to explicitly call InternalFunction::getCallData.

  • runtime/InternalFunction.cpp:

(JSC::InternalFunction::finishCreation):
(JSC::InternalFunction::getCallData):

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

Added a global structure to JSGlobalObject for StrictModeTypeErrorFunction to enable
it to be reused rather than creating a new Structure every time we instantiate it.

  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::reset):
(JSC::JSGlobalObject::visitChildren):

  • runtime/JSGlobalObject.h:

(JSC::JSGlobalObject::strictModeTypeErrorFunctionStructure):

  • runtime/JSONObject.cpp:

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

  • runtime/JSObject.cpp:

(JSC::JSObject::put):

  • runtime/JSObject.h:

(JSC::getCallData):

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

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

  • runtime/PropertySlot.cpp:

(JSC::PropertySlot::functionGetter):

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

Source/JavaScriptGlue:

Removed all getCallDataVirtual methods and replaced their call sites
with an explicit lookup in the MethodTable.

  • JSValueWrapper.cpp:

(JSValueWrapper::JSObjectCallFunction):

  • UserObjectImp.cpp:
  • UserObjectImp.h:

Source/WebCore:

No new tests.

Removed all getCallDataVirtual methods and replaced their call sites
with an explicit lookup in the MethodTable.

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

(WebCore::JSCallbackData::invokeCallback):

  • bindings/js/JSCustomXPathNSResolver.cpp:

(WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):

  • bindings/js/JSErrorHandler.cpp:

(WebCore::JSErrorHandler::handleEvent):

  • bindings/js/JSEventListener.cpp:

(WebCore::JSEventListener::handleEvent):

  • bindings/js/JSHTMLAllCollectionCustom.cpp:
  • bindings/js/JSHTMLAppletElementCustom.cpp:
  • bindings/js/JSHTMLEmbedElementCustom.cpp:
  • bindings/js/JSHTMLObjectElementCustom.cpp:
  • bindings/js/JSInjectedScriptHostCustom.cpp:

(WebCore::JSInjectedScriptHost::evaluate):

  • bindings/js/JSPluginElementFunctions.cpp:

(WebCore::runtimeObjectGetCallData):

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateHeader):

  • bridge/objc/objc_runtime.h:
  • bridge/objc/objc_runtime.mm:
  • bridge/qt/qt_runtime.cpp:

(JSC::Bindings::QtRuntimeConnectionMethod::call):
(JSC::Bindings::isJavaScriptFunction):

  • bridge/qt/qt_runtime.h:

(JSC::Bindings::QtRuntimeMetaMethod::createStructure):
(JSC::Bindings::QtRuntimeConnectionMethod::createStructure):

  • bridge/runtime_method.cpp:
  • bridge/runtime_method.h:
  • bridge/runtime_object.cpp:
  • bridge/runtime_object.h:

Source/WebKit/mac:

Removed all getCallDataVirtual methods and replaced their call sites
with an explicit lookup in the MethodTable.

  • Plugins/Hosted/NetscapePluginInstanceProxy.mm:

(WebKit::NetscapePluginInstanceProxy::invokeDefault):

Source/WebKit2:

Removed all getCallDataVirtual methods and replaced their call sites
with an explicit lookup in the MethodTable.

  • WebProcess/Plugins/Netscape/JSNPMethod.cpp:
  • WebProcess/Plugins/Netscape/JSNPMethod.h:
  • WebProcess/Plugins/Netscape/JSNPObject.cpp:
  • WebProcess/Plugins/Netscape/JSNPObject.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r96717 r96996  
    28302830                        JSObject* getter = getterSetter->getter();
    28312831                        CallData callData;
    2832                         CallType callType = getter->getCallDataVirtual(callData);
     2832                        CallType callType = getter->methodTable()->getCallData(getter, callData);
    28332833                        JSValue result = call(callFrame, getter, callType, callData, asObject(baseCell), ArgList());
    28342834                        CHECK_FOR_EXCEPTION();
     
    29652965                    JSObject* getter = getterSetter->getter();
    29662966                    CallData callData;
    2967                     CallType callType = getter->getCallDataVirtual(callData);
     2967                    CallType callType = getter->methodTable()->getCallData(getter, callData);
    29682968                    JSValue result = call(callFrame, getter, callType, callData, baseObject, ArgList());
    29692969                    CHECK_FOR_EXCEPTION();
     
    30733073                            JSObject* getter = getterSetter->getter();
    30743074                            CallData callData;
    3075                             CallType callType = getter->getCallDataVirtual(callData);
     3075                            CallType callType = getter->methodTable()->getCallData(getter, callData);
    30763076                            JSValue result = call(callFrame, getter, callType, callData, baseValue, ArgList());
    30773077                            CHECK_FOR_EXCEPTION();
Note: See TracChangeset for help on using the changeset viewer.