• ggaren@apple.com's avatar
    NotNullPassRefPtr: smart pointer optimized for passing references that are not null · 6740e6f2
    ggaren@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=29822
            
    Patch by Geoffrey Garen <ggaren@apple.com> on 2009-09-28
    Reviewed by Darin Adler.
    
    JavaScriptCore: 
    
    Added NotNullPassRefPtr, and deployed it in all places that initialize
    JavaScript objects.
            
    2.2% speedup on bench-allocate-nonretained.js.
    
    * API/JSCallbackConstructor.cpp:
    (JSC::JSCallbackConstructor::JSCallbackConstructor):
    * API/JSCallbackConstructor.h:
    * API/JSCallbackObject.h:
    * API/JSCallbackObjectFunctions.h:
    (JSC::JSCallbackObject::JSCallbackObject):
    * JavaScriptCore.exp:
    * bytecode/CodeBlock.h:
    (JSC::CodeBlock::addFunctionDecl):
    (JSC::CodeBlock::addFunctionExpr):
    * runtime/ArrayConstructor.cpp:
    (JSC::ArrayConstructor::ArrayConstructor):
    * runtime/ArrayConstructor.h:
    * runtime/ArrayPrototype.cpp:
    (JSC::ArrayPrototype::ArrayPrototype):
    * runtime/ArrayPrototype.h:
    * runtime/BooleanConstructor.cpp:
    (JSC::BooleanConstructor::BooleanConstructor):
    * runtime/BooleanConstructor.h:
    * runtime/BooleanObject.cpp:
    (JSC::BooleanObject::BooleanObject):
    * runtime/BooleanObject.h:
    * runtime/BooleanPrototype.cpp:
    (JSC::BooleanPrototype::BooleanPrototype):
    * runtime/BooleanPrototype.h:
    * runtime/DateConstructor.cpp:
    (JSC::DateConstructor::DateConstructor):
    * runtime/DateConstructor.h:
    * runtime/DateInstance.cpp:
    (JSC::DateInstance::DateInstance):
    * runtime/DateInstance.h:
    * runtime/DatePrototype.cpp:
    (JSC::DatePrototype::DatePrototype):
    * runtime/DatePrototype.h:
    * runtime/ErrorConstructor.cpp:
    (JSC::ErrorConstructor::ErrorConstructor):
    * runtime/ErrorConstructor.h:
    * runtime/ErrorInstance.cpp:
    (JSC::ErrorInstance::ErrorInstance):
    * runtime/ErrorInstance.h:
    * runtime/ErrorPrototype.cpp:
    (JSC::ErrorPrototype::ErrorPrototype):
    * runtime/ErrorPrototype.h:
    * runtime/FunctionConstructor.cpp:
    (JSC::FunctionConstructor::FunctionConstructor):
    * runtime/FunctionConstructor.h:
    * runtime/FunctionPrototype.cpp:
    (JSC::FunctionPrototype::FunctionPrototype):
    * runtime/FunctionPrototype.h:
    * runtime/GlobalEvalFunction.cpp:
    (JSC::GlobalEvalFunction::GlobalEvalFunction):
    * runtime/GlobalEvalFunction.h:
    * runtime/InternalFunction.cpp:
    (JSC::InternalFunction::InternalFunction):
    * runtime/InternalFunction.h:
    (JSC::InternalFunction::InternalFunction):
    * runtime/JSActivation.cpp:
    (JSC::JSActivation::JSActivation):
    * runtime/JSActivation.h:
    (JSC::JSActivation::JSActivationData::JSActivationData):
    * runtime/JSArray.cpp:
    (JSC::JSArray::JSArray):
    * runtime/JSArray.h:
    * runtime/JSByteArray.cpp:
    (JSC::JSByteArray::JSByteArray):
    * runtime/JSByteArray.h:
    * runtime/JSFunction.cpp:
    (JSC::JSFunction::JSFunction):
    * runtime/JSFunction.h:
    * runtime/JSGlobalObject.h:
    (JSC::JSGlobalObject::JSGlobalObject):
    * runtime/JSONObject.h:
    (JSC::JSONObject::JSONObject):
    * runtime/JSObject.h:
    (JSC::JSObject::JSObject):
    (JSC::JSObject::setStructure):
    * runtime/JSVariableObject.h:
    (JSC::JSVariableObject::JSVariableObject):
    * runtime/JSWrapperObject.h:
    (JSC::JSWrapperObject::JSWrapperObject):
    * runtime/MathObject.cpp:
    (JSC::MathObject::MathObject):
    * runtime/MathObject.h:
    * runtime/NativeErrorConstructor.cpp:
    (JSC::NativeErrorConstructor::NativeErrorConstructor):
    * runtime/NativeErrorConstructor.h:
    * runtime/NativeErrorPrototype.cpp:
    (JSC::NativeErrorPrototype::NativeErrorPrototype):
    * runtime/NativeErrorPrototype.h:
    * runtime/NumberConstructor.cpp:
    (JSC::NumberConstructor::NumberConstructor):
    * runtime/NumberConstructor.h:
    * runtime/NumberObject.cpp:
    (JSC::NumberObject::NumberObject):
    * runtime/NumberObject.h:
    * runtime/NumberPrototype.cpp:
    (JSC::NumberPrototype::NumberPrototype):
    * runtime/NumberPrototype.h:
    * runtime/ObjectConstructor.cpp:
    (JSC::ObjectConstructor::ObjectConstructor):
    * runtime/ObjectConstructor.h:
    * runtime/ObjectPrototype.cpp:
    (JSC::ObjectPrototype::ObjectPrototype):
    * runtime/ObjectPrototype.h:
    * runtime/PropertyNameArray.h:
    (JSC::PropertyNameArrayData::setCachedPrototypeChain):
    * runtime/PrototypeFunction.cpp:
    (JSC::PrototypeFunction::PrototypeFunction):
    * runtime/PrototypeFunction.h:
    * runtime/RegExpConstructor.cpp:
    (JSC::RegExpConstructor::RegExpConstructor):
    * runtime/RegExpConstructor.h:
    * runtime/RegExpObject.cpp:
    (JSC::RegExpObject::RegExpObject):
    * runtime/RegExpObject.h:
    (JSC::RegExpObject::RegExpObjectData::RegExpObjectData):
    * runtime/RegExpPrototype.cpp:
    (JSC::RegExpPrototype::RegExpPrototype):
    * runtime/RegExpPrototype.h:
    * runtime/StringConstructor.cpp:
    (JSC::StringConstructor::StringConstructor):
    * runtime/StringConstructor.h:
    * runtime/StringObject.cpp:
    (JSC::StringObject::StringObject):
    * runtime/StringObject.h:
    * runtime/StringObjectThatMasqueradesAsUndefined.h:
    (JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
    * runtime/StringPrototype.cpp:
    (JSC::StringPrototype::StringPrototype):
    * runtime/StringPrototype.h:
    * wtf/PassRefPtr.h:
    (WTF::NotNullPassRefPtr::NotNullPassRefPtr):
    (WTF::NotNullPassRefPtr::~NotNullPassRefPtr):
    (WTF::NotNullPassRefPtr::get):
    (WTF::NotNullPassRefPtr::clear):
    (WTF::NotNullPassRefPtr::releaseRef):
    (WTF::NotNullPassRefPtr::operator*):
    (WTF::NotNullPassRefPtr::operator->):
    (WTF::NotNullPassRefPtr::operator!):
    (WTF::NotNullPassRefPtr::operator UnspecifiedBoolType):
    * wtf/RefPtr.h:
    (WTF::RefPtr::RefPtr):
    (WTF::operator==):
    
    WebCore: 
    
    Added NotNullPassRefPtr, and deployed it in all places that initialize
    JavaScript objects.
    
    * bindings/js/DOMObjectWithSVGContext.h:
    (WebCore::DOMObjectWithSVGContext::DOMObjectWithSVGContext):
    * bindings/js/JSDOMBinding.cpp:
    (WebCore::cacheDOMStructure):
    * bindings/js/JSDOMBinding.h:
    (WebCore::DOMObject::DOMObject):
    (WebCore::DOMObjectWithGlobalPointer::DOMObjectWithGlobalPointer):
    (WebCore::DOMConstructorObject::DOMConstructorObject):
    (WebCore::DOMConstructorWithDocument::DOMConstructorWithDocument):
    * bindings/js/JSDOMGlobalObject.cpp:
    (WebCore::JSDOMGlobalObject::JSDOMGlobalObject):
    * bindings/js/JSDOMGlobalObject.h:
    * bindings/js/JSDOMWindowBase.cpp:
    (WebCore::JSDOMWindowBase::JSDOMWindowBase):
    * bindings/js/JSDOMWindowBase.h:
    * bindings/js/JSHTMLAllCollection.h:
    (WebCore::JSHTMLAllCollection::JSHTMLAllCollection):
    * bindings/js/JSInspectedObjectWrapper.cpp:
    (WebCore::JSInspectedObjectWrapper::JSInspectedObjectWrapper):
    * bindings/js/JSInspectedObjectWrapper.h:
    * bindings/js/JSInspectorCallbackWrapper.cpp:
    (WebCore::JSInspectorCallbackWrapper::JSInspectorCallbackWrapper):
    * bindings/js/JSInspectorCallbackWrapper.h:
    * bindings/js/JSQuarantinedObjectWrapper.cpp:
    (WebCore::JSQuarantinedObjectWrapper::JSQuarantinedObjectWrapper):
    * bindings/js/JSQuarantinedObjectWrapper.h:
    * bindings/js/JSWorkerContextBase.cpp:
    (WebCore::JSWorkerContextBase::JSWorkerContextBase):
    * bindings/js/JSWorkerContextBase.h:
    * bindings/scripts/CodeGeneratorJS.pm:
    * bridge/runtime_object.cpp:
    (JSC::RuntimeObjectImp::RuntimeObjectImp):
    * bridge/runtime_object.h:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48836 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    6740e6f2
JSArray.cpp 36.5 KB