• mhahnenberg@apple.com's avatar
    Add jsCast to replace static_cast · 135f0517
    mhahnenberg@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=72071
    
    Reviewed by Geoffrey Garen.
    
    Source/JavaScriptCore: 
    
    Added new jsCast and changed all of the static_cast sites in functions that 
    are in the MethodTable to use jsCast instead.
    
    * API/JSCallbackFunction.cpp:
    (JSC::JSCallbackFunction::toStringCallback):
    (JSC::JSCallbackFunction::valueOfCallback):
    * API/JSCallbackObject.h:
    (JSC::JSCallbackObject::visitChildren):
    * API/JSCallbackObjectFunctions.h:
    (JSC::::className):
    (JSC::::getOwnPropertySlot):
    (JSC::::getOwnPropertyDescriptor):
    (JSC::::put):
    (JSC::::deleteProperty):
    (JSC::::deletePropertyByIndex):
    (JSC::::getConstructData):
    (JSC::::hasInstance):
    (JSC::::getCallData):
    (JSC::::getOwnPropertyNames):
    * debugger/DebuggerActivation.cpp:
    (JSC::DebuggerActivation::visitChildren):
    (JSC::DebuggerActivation::className):
    (JSC::DebuggerActivation::getOwnPropertySlot):
    (JSC::DebuggerActivation::put):
    (JSC::DebuggerActivation::putWithAttributes):
    (JSC::DebuggerActivation::deleteProperty):
    (JSC::DebuggerActivation::getOwnPropertyNames):
    (JSC::DebuggerActivation::getOwnPropertyDescriptor):
    (JSC::DebuggerActivation::defineGetter):
    (JSC::DebuggerActivation::defineSetter):
    * runtime/Arguments.cpp:
    (JSC::Arguments::visitChildren):
    (JSC::Arguments::getOwnPropertySlotByIndex):
    (JSC::Arguments::getOwnPropertySlot):
    (JSC::Arguments::getOwnPropertyDescriptor):
    (JSC::Arguments::getOwnPropertyNames):
    (JSC::Arguments::putByIndex):
    (JSC::Arguments::put):
    (JSC::Arguments::deletePropertyByIndex):
    (JSC::Arguments::deleteProperty):
    * runtime/ArrayConstructor.cpp:
    (JSC::ArrayConstructor::getOwnPropertySlot):
    (JSC::ArrayConstructor::getOwnPropertyDescriptor):
    * runtime/ArrayPrototype.cpp:
    (JSC::ArrayPrototype::getOwnPropertySlot):
    (JSC::ArrayPrototype::getOwnPropertyDescriptor):
    * runtime/BooleanPrototype.cpp:
    (JSC::BooleanPrototype::getOwnPropertySlot):
    (JSC::BooleanPrototype::getOwnPropertyDescriptor):
    * runtime/DateConstructor.cpp:
    (JSC::DateConstructor::getOwnPropertySlot):
    (JSC::DateConstructor::getOwnPropertyDescriptor):
    * runtime/DatePrototype.cpp:
    (JSC::DatePrototype::getOwnPropertySlot):
    (JSC::DatePrototype::getOwnPropertyDescriptor):
    * runtime/ErrorPrototype.cpp:
    (JSC::ErrorPrototype::getOwnPropertySlot):
    (JSC::ErrorPrototype::getOwnPropertyDescriptor):
    * runtime/Executable.cpp:
    (JSC::ExecutableBase::clearCode):
    (JSC::EvalExecutable::visitChildren):
    (JSC::ProgramExecutable::visitChildren):
    (JSC::FunctionExecutable::visitChildren):
    * runtime/GetterSetter.cpp:
    (JSC::GetterSetter::visitChildren):
    * runtime/JSActivation.cpp:
    (JSC::JSActivation::visitChildren):
    (JSC::JSActivation::getOwnPropertyNames):
    (JSC::JSActivation::getOwnPropertySlot):
    (JSC::JSActivation::put):
    (JSC::JSActivation::putWithAttributes):
    * runtime/JSArray.cpp:
    (JSC::JSArray::getOwnPropertySlotByIndex):
    (JSC::JSArray::getOwnPropertySlot):
    (JSC::JSArray::getOwnPropertyDescriptor):
    (JSC::JSArray::put):
    (JSC::JSArray::putByIndex):
    (JSC::JSArray::deleteProperty):
    (JSC::JSArray::deletePropertyByIndex):
    (JSC::JSArray::getOwnPropertyNames):
    (JSC::JSArray::visitChildren):
    * runtime/JSBoundFunction.cpp:
    (JSC::JSBoundFunction::hasInstance):
    (JSC::JSBoundFunction::visitChildren):
    * runtime/JSByteArray.cpp:
    (JSC::JSByteArray::getOwnPropertySlot):
    (JSC::JSByteArray::getOwnPropertyDescriptor):
    (JSC::JSByteArray::getOwnPropertySlotByIndex):
    (JSC::JSByteArray::put):
    (JSC::JSByteArray::putByIndex):
    (JSC::JSByteArray::getOwnPropertyNames):
    * runtime/JSCell.h:
    (JSC::JSCell::visitChildren):
    (JSC::jsCast):
    * runtime/JSFunction.cpp:
    (JSC::JSFunction::visitChildren):
    (JSC::JSFunction::getCallData):
    (JSC::JSFunction::getOwnPropertySlot):
    (JSC::JSFunction::getOwnPropertyDescriptor):
    (JSC::JSFunction::getOwnPropertyNames):
    (JSC::JSFunction::put):
    (JSC::JSFunction::deleteProperty):
    (JSC::JSFunction::getConstructData):
    * runtime/JSGlobalData.cpp:
    (JSC::StackPreservingRecompiler::operator()):
    * runtime/JSGlobalObject.cpp:
    (JSC::JSGlobalObject::put):
    (JSC::JSGlobalObject::putWithAttributes):
    (JSC::JSGlobalObject::defineGetter):
    (JSC::JSGlobalObject::defineSetter):
    (JSC::JSGlobalObject::visitChildren):
    (JSC::JSGlobalObject::getOwnPropertySlot):
    (JSC::JSGlobalObject::getOwnPropertyDescriptor):
    (JSC::JSGlobalObject::clearRareData):
    * runtime/JSGlobalThis.cpp:
    (JSC::JSGlobalThis::visitChildren):
    * runtime/JSONObject.cpp:
    (JSC::JSONObject::getOwnPropertySlot):
    (JSC::JSONObject::getOwnPropertyDescriptor):
    * runtime/JSObject.cpp:
    (JSC::JSObject::finalize):
    (JSC::JSObject::visitChildren):
    (JSC::JSObject::getOwnPropertySlotByIndex):
    (JSC::JSObject::put):
    (JSC::JSObject::putByIndex):
    (JSC::JSObject::deleteProperty):
    (JSC::JSObject::deletePropertyByIndex):
    * runtime/JSObject.h:
    (JSC::JSObject::getOwnPropertySlot):
    * runtime/JSPropertyNameIterator.cpp:
    (JSC::JSPropertyNameIterator::visitChildren):
    * runtime/JSStaticScopeObject.cpp:
    (JSC::JSStaticScopeObject::visitChildren):
    (JSC::JSStaticScopeObject::put):
    (JSC::JSStaticScopeObject::putWithAttributes):
    (JSC::JSStaticScopeObject::getOwnPropertySlot):
    * runtime/JSString.cpp:
    (JSC::JSString::visitChildren):
    (JSC::JSString::toThisObject):
    (JSC::JSString::getOwnPropertySlot):
    (JSC::JSString::getOwnPropertySlotByIndex):
    * runtime/JSVariableObject.cpp:
    (JSC::JSVariableObject::deleteProperty):
    (JSC::JSVariableObject::getOwnPropertyNames):
    * runtime/JSWrapperObject.cpp:
    (JSC::JSWrapperObject::visitChildren):
    * runtime/MathObject.cpp:
    (JSC::MathObject::getOwnPropertySlot):
    (JSC::MathObject::getOwnPropertyDescriptor):
    * runtime/NativeErrorConstructor.cpp:
    (JSC::NativeErrorConstructor::visitChildren):
    * runtime/NumberConstructor.cpp:
    (JSC::NumberConstructor::getOwnPropertySlot):
    (JSC::NumberConstructor::getOwnPropertyDescriptor):
    * runtime/NumberPrototype.cpp:
    (JSC::NumberPrototype::getOwnPropertySlot):
    (JSC::NumberPrototype::getOwnPropertyDescriptor):
    * runtime/ObjectConstructor.cpp:
    (JSC::ObjectConstructor::getOwnPropertySlot):
    (JSC::ObjectConstructor::getOwnPropertyDescriptor):
    * runtime/ObjectPrototype.cpp:
    (JSC::ObjectPrototype::put):
    (JSC::ObjectPrototype::getOwnPropertySlotByIndex):
    (JSC::ObjectPrototype::getOwnPropertySlot):
    (JSC::ObjectPrototype::getOwnPropertyDescriptor):
    * runtime/RegExpConstructor.cpp:
    (JSC::RegExpConstructor::getOwnPropertySlot):
    (JSC::RegExpConstructor::getOwnPropertyDescriptor):
    (JSC::RegExpConstructor::put):
    * runtime/RegExpMatchesArray.h:
    (JSC::RegExpMatchesArray::getOwnPropertySlot):
    (JSC::RegExpMatchesArray::getOwnPropertySlotByIndex):
    (JSC::RegExpMatchesArray::getOwnPropertyDescriptor):
    (JSC::RegExpMatchesArray::put):
    (JSC::RegExpMatchesArray::putByIndex):
    (JSC::RegExpMatchesArray::deleteProperty):
    (JSC::RegExpMatchesArray::deletePropertyByIndex):
    (JSC::RegExpMatchesArray::getOwnPropertyNames):
    * runtime/RegExpObject.cpp:
    (JSC::RegExpObject::visitChildren):
    (JSC::RegExpObject::getOwnPropertySlot):
    (JSC::RegExpObject::getOwnPropertyDescriptor):
    (JSC::RegExpObject::put):
    * runtime/RegExpPrototype.cpp:
    (JSC::RegExpPrototype::getOwnPropertySlot):
    (JSC::RegExpPrototype::getOwnPropertyDescriptor):
    * runtime/ScopeChain.cpp:
    (JSC::ScopeChainNode::visitChildren):
    * runtime/StringConstructor.cpp:
    (JSC::StringConstructor::getOwnPropertySlot):
    (JSC::StringConstructor::getOwnPropertyDescriptor):
    * runtime/StringObject.cpp:
    (JSC::StringObject::getOwnPropertySlot):
    (JSC::StringObject::getOwnPropertySlotByIndex):
    (JSC::StringObject::getOwnPropertyDescriptor):
    (JSC::StringObject::deleteProperty):
    (JSC::StringObject::getOwnPropertyNames):
    * runtime/StringPrototype.cpp:
    (JSC::StringPrototype::getOwnPropertySlot):
    (JSC::StringPrototype::getOwnPropertyDescriptor):
    * runtime/Structure.cpp:
    (JSC::Structure::visitChildren):
    * runtime/StructureChain.cpp:
    (JSC::StructureChain::visitChildren):
    
    Source/JavaScriptGlue: 
    
    Added new jsCast and changed all of the static_cast sites in functions that 
    are in the MethodTable to use jsCast instead.
    
    * UserObjectImp.cpp:
    (UserObjectImp::getCallData):
    (UserObjectImp::getOwnPropertyNames):
    (UserObjectImp::getOwnPropertySlot):
    (UserObjectImp::put):
    (UserObjectImp::visitChildren):
    
    Source/WebCore: 
    
    No new tests. 
    
    Added new jsCast and changed all of the static_cast sites in functions that 
    are in the MethodTable to use jsCast instead.
    
    * bindings/js/JSAttrCustom.cpp:
    (WebCore::JSAttr::visitChildren):
    * bindings/js/JSAudioContextCustom.cpp:
    (WebCore::JSAudioContext::visitChildren):
    * bindings/js/JSCSSRuleCustom.cpp:
    (WebCore::JSCSSRule::visitChildren):
    * bindings/js/JSCSSStyleDeclarationCustom.cpp:
    (WebCore::JSCSSStyleDeclaration::visitChildren):
    * bindings/js/JSCanvasRenderingContext2DCustom.cpp:
    (WebCore::toHTMLCanvasStyle):
    * bindings/js/JSCanvasRenderingContextCustom.cpp:
    (WebCore::JSCanvasRenderingContext::visitChildren):
    * bindings/js/JSDOMGlobalObject.cpp:
    (WebCore::JSDOMGlobalObject::visitChildren):
    * bindings/js/JSDOMStringMapCustom.cpp:
    (WebCore::JSDOMStringMap::getOwnPropertyNames):
    (WebCore::JSDOMStringMap::deleteProperty):
    * bindings/js/JSDOMWindowBase.cpp:
    (WebCore::JSDOMWindowBase::toThisObject):
    * bindings/js/JSDOMWindowCustom.cpp:
    (WebCore::JSDOMWindow::visitChildren):
    (WebCore::JSDOMWindow::getOwnPropertySlot):
    (WebCore::JSDOMWindow::getOwnPropertyDescriptor):
    (WebCore::JSDOMWindow::put):
    (WebCore::JSDOMWindow::deleteProperty):
    (WebCore::JSDOMWindow::getPropertyNames):
    (WebCore::JSDOMWindow::getOwnPropertyNames):
    (WebCore::JSDOMWindow::defineGetter):
    (WebCore::JSDOMWindow::defineSetter):
    (WebCore::JSDOMWindow::defineOwnProperty):
    * bindings/js/JSDOMWindowShell.cpp:
    (WebCore::JSDOMWindowShell::className):
    (WebCore::JSDOMWindowShell::getOwnPropertySlot):
    (WebCore::JSDOMWindowShell::getOwnPropertyDescriptor):
    (WebCore::JSDOMWindowShell::put):
    (WebCore::JSDOMWindowShell::putWithAttributes):
    (WebCore::JSDOMWindowShell::defineOwnProperty):
    (WebCore::JSDOMWindowShell::deleteProperty):
    (WebCore::JSDOMWindowShell::getPropertyNames):
    (WebCore::JSDOMWindowShell::getOwnPropertyNames):
    (WebCore::JSDOMWindowShell::defineGetter):
    (WebCore::JSDOMWindowShell::defineSetter):
    * bindings/js/JSHTMLAppletElementCustom.cpp:
    (WebCore::JSHTMLAppletElement::getCallData):
    * bindings/js/JSHTMLEmbedElementCustom.cpp:
    (WebCore::JSHTMLEmbedElement::getCallData):
    * bindings/js/JSHTMLObjectElementCustom.cpp:
    (WebCore::JSHTMLObjectElement::getCallData):
    * bindings/js/JSHistoryCustom.cpp:
    (WebCore::JSHistory::deleteProperty):
    (WebCore::JSHistory::getOwnPropertyNames):
    * bindings/js/JSJavaScriptAudioNodeCustom.cpp:
    (WebCore::JSJavaScriptAudioNode::visitChildren):
    * bindings/js/JSLocationCustom.cpp:
    (WebCore::JSLocation::deleteProperty):
    (WebCore::JSLocation::getOwnPropertyNames):
    * bindings/js/JSMessageChannelCustom.cpp:
    (WebCore::JSMessageChannel::visitChildren):
    * bindings/js/JSMessagePortCustom.cpp:
    (WebCore::JSMessagePort::visitChildren):
    * bindings/js/JSNamedNodeMapCustom.cpp:
    (WebCore::JSNamedNodeMap::visitChildren):
    * bindings/js/JSNodeCustom.cpp:
    (WebCore::JSNode::visitChildren):
    * bindings/js/JSNodeFilterCustom.cpp:
    (WebCore::JSNodeFilter::visitChildren):
    * bindings/js/JSNodeIteratorCustom.cpp:
    (WebCore::JSNodeIterator::visitChildren):
    * bindings/js/JSSVGElementInstanceCustom.cpp:
    (WebCore::JSSVGElementInstance::visitChildren):
    * bindings/js/JSSharedWorkerCustom.cpp:
    (WebCore::JSSharedWorker::visitChildren):
    * bindings/js/JSStorageCustom.cpp:
    (WebCore::JSStorage::deleteProperty):
    (WebCore::JSStorage::getOwnPropertyNames):
    * bindings/js/JSStyleSheetCustom.cpp:
    (WebCore::JSStyleSheet::visitChildren):
    * bindings/js/JSTreeWalkerCustom.cpp:
    (WebCore::JSTreeWalker::visitChildren):
    * bindings/js/JSWebGLRenderingContextCustom.cpp:
    (WebCore::JSWebGLRenderingContext::visitChildren):
    * bindings/js/JSWorkerContextCustom.cpp:
    (WebCore::JSWorkerContext::visitChildren):
    * bindings/js/JSXMLHttpRequestCustom.cpp:
    (WebCore::JSXMLHttpRequest::visitChildren):
    * bindings/js/JSXPathResultCustom.cpp:
    (WebCore::JSXPathResult::visitChildren):
    * bindings/scripts/CodeGeneratorJS.pm:
    (GenerateHeader):
    (GenerateImplementation):
    * bindings/scripts/test/JS/JSTestInterface.cpp:
    (WebCore::JSTestInterface::getOwnPropertySlot):
    (WebCore::JSTestInterface::getOwnPropertyDescriptor):
    * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
    (WebCore::JSTestMediaQueryListListenerPrototype::getOwnPropertySlot):
    (WebCore::JSTestMediaQueryListListenerPrototype::getOwnPropertyDescriptor):
    (WebCore::JSTestMediaQueryListListener::getOwnPropertySlot):
    (WebCore::JSTestMediaQueryListListener::getOwnPropertyDescriptor):
    * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
    (WebCore::JSTestNamedConstructor::getOwnPropertySlot):
    (WebCore::JSTestNamedConstructor::getOwnPropertyDescriptor):
    * bindings/scripts/test/JS/JSTestObj.cpp:
    (WebCore::JSTestObjPrototype::getOwnPropertySlot):
    (WebCore::JSTestObjPrototype::getOwnPropertyDescriptor):
    (WebCore::JSTestObj::getOwnPropertySlot):
    (WebCore::JSTestObj::getOwnPropertyDescriptor):
    (WebCore::JSTestObj::put):
    (WebCore::JSTestObj::visitChildren):
    * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
    (WebCore::JSTestSerializedScriptValueInterface::getOwnPropertySlot):
    (WebCore::JSTestSerializedScriptValueInterface::getOwnPropertyDescriptor):
    * bridge/objc/objc_runtime.mm:
    (JSC::Bindings::ObjcFallbackObjectImp::getCallData):
    (JSC::Bindings::ObjcFallbackObjectImp::defaultValue):
    * bridge/qt/qt_instance.cpp:
    (JSC::Bindings::QtRuntimeObject::visitChildren):
    * bridge/qt/qt_runtime.cpp:
    (JSC::Bindings::QtRuntimeMetaMethod::visitChildren):
    (JSC::Bindings::QtRuntimeMetaMethod::getOwnPropertySlot):
    (JSC::Bindings::QtRuntimeMetaMethod::getOwnPropertyDescriptor):
    (JSC::Bindings::QtRuntimeConnectionMethod::getOwnPropertySlot):
    (JSC::Bindings::QtRuntimeConnectionMethod::getOwnPropertyDescriptor):
    * bridge/runtime_array.cpp:
    (JSC::RuntimeArray::getOwnPropertyNames):
    (JSC::RuntimeArray::getOwnPropertySlot):
    (JSC::RuntimeArray::getOwnPropertyDescriptor):
    (JSC::RuntimeArray::getOwnPropertySlotByIndex):
    (JSC::RuntimeArray::put):
    (JSC::RuntimeArray::putByIndex):
    * bridge/runtime_method.cpp:
    (JSC::RuntimeMethod::getOwnPropertySlot):
    (JSC::RuntimeMethod::getOwnPropertyDescriptor):
    * bridge/runtime_object.cpp:
    (JSC::Bindings::RuntimeObject::getOwnPropertySlot):
    (JSC::Bindings::RuntimeObject::getOwnPropertyDescriptor):
    (JSC::Bindings::RuntimeObject::put):
    (JSC::Bindings::RuntimeObject::defaultValue):
    (JSC::Bindings::RuntimeObject::getCallData):
    (JSC::Bindings::RuntimeObject::getConstructData):
    (JSC::Bindings::RuntimeObject::getOwnPropertyNames):
    
    Source/WebKit2: 
    
    Added new jsCast and changed all of the static_cast sites in functions that 
    are in the MethodTable to use jsCast instead.
    
    * WebProcess/Plugins/Netscape/JSNPObject.cpp:
    (WebKit::JSNPObject::getCallData):
    (WebKit::JSNPObject::getConstructData):
    (WebKit::JSNPObject::getOwnPropertySlot):
    (WebKit::JSNPObject::getOwnPropertyDescriptor):
    (WebKit::JSNPObject::put):
    (WebKit::JSNPObject::deleteProperty):
    (WebKit::JSNPObject::deletePropertyByIndex):
    (WebKit::JSNPObject::getOwnPropertyNames):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@100006 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    135f0517
StringConstructor.cpp 4.58 KB