Commit cff5e5ee authored by mjs's avatar mjs

JavaScriptCore:

        Reviewed by John.

	- replace dlmalloc with tcmalloc
	http://bugzilla.opendarwin.org/show_bug.cgi?id=5145

	I also moved SharedPtr and the assertion code from WebCore into a
	new kxmlcore directory.

        * JavaScriptCore.xcodeproj/project.pbxproj:
        * kjs/collector.cpp:
        (KJS::Collector::allocate):
        (KJS::Collector::collect):
        * kjs/config.h:
        * kjs/fast_malloc.cpp: Removed.
        * kjs/fast_malloc.h: Removed.
        * kjs/function.cpp:
        * kjs/function.h:
        * kjs/function_object.cpp:
        * kjs/identifier.cpp:
        (KJS::Identifier::add):
        * kjs/internal.cpp:
        * kjs/internal.h:
        * kjs/nodes.h:
        * kjs/nodes2string.cpp:
        * kjs/property_map.cpp:
        (KJS::PropertyMap::~PropertyMap):
        (KJS::PropertyMap::rehash):
        * kjs/scope_chain.h:
        * kjs/shared_ptr.h: Removed.
        * kjs/string_object.cpp:
        (StringObjectFuncImp::callAsFunction):
        * kjs/ustring.cpp:
        (KJS::UString::Rep::createCopying):
        (KJS::UString::Rep::destroy):
        (KJS::UString::expandCapacity):
        (KJS::UString::expandPreCapacity):
        (KJS::UString::UString):
        (KJS::UString::spliceSubstringsWithSeparators):
        (KJS::UString::append):
        (KJS::UString::operator=):
        (KJS::UString::detach):
        * kjs/ustring.h:
        * kxmlcore/Assertions.h: Added.
        * kxmlcore/Assertions.mm: Added.
        * kxmlcore/FastMalloc.cpp: Added.
        (KXMLCore::LgFloor):
        (KXMLCore::SizeClass):
        (KXMLCore::ByteSizeForClass):
        (KXMLCore::InitSizeClasses):
        (KXMLCore::MetaDataAlloc):
        (KXMLCore::PageHeapAllocator::Init):
        (KXMLCore::PageHeapAllocator::New):
        (KXMLCore::PageHeapAllocator::Delete):
        (KXMLCore::PageHeapAllocator::inuse):
        (KXMLCore::pages):
        (KXMLCore::AllocationSize):
        (KXMLCore::Event):
        (KXMLCore::NewSpan):
        (KXMLCore::DeleteSpan):
        (KXMLCore::DLL_Init):
        (KXMLCore::DLL_Remove):
        (KXMLCore::DLL_IsEmpty):
        (KXMLCore::DLL_Length):
        (KXMLCore::DLL_Print):
        (KXMLCore::DLL_Prepend):
        (KXMLCore::DLL_InsertOrdered):
        (KXMLCore::):
        (KXMLCore::TCMalloc_PageHeap::GetDescriptor):
        (KXMLCore::TCMalloc_PageHeap::SystemBytes):
        (KXMLCore::TCMalloc_PageHeap::FreeBytes):
        (KXMLCore::TCMalloc_PageHeap::RecordSpan):
        (KXMLCore::TCMalloc_PageHeap::TCMalloc_PageHeap):
        (KXMLCore::TCMalloc_PageHeap::New):
        (KXMLCore::TCMalloc_PageHeap::Split):
        (KXMLCore::TCMalloc_PageHeap::Carve):
        (KXMLCore::TCMalloc_PageHeap::Delete):
        (KXMLCore::TCMalloc_PageHeap::RegisterSizeClass):
        (KXMLCore::TCMalloc_PageHeap::Dump):
        (KXMLCore::TCMalloc_PageHeap::GrowHeap):
        (KXMLCore::TCMalloc_PageHeap::Check):
        (KXMLCore::TCMalloc_PageHeap::CheckList):
        (KXMLCore::TCMalloc_ThreadCache_FreeList::Init):
        (KXMLCore::TCMalloc_ThreadCache_FreeList::length):
        (KXMLCore::TCMalloc_ThreadCache_FreeList::empty):
        (KXMLCore::TCMalloc_ThreadCache_FreeList::lowwatermark):
        (KXMLCore::TCMalloc_ThreadCache_FreeList::clear_lowwatermark):
        (KXMLCore::TCMalloc_ThreadCache_FreeList::Push):
        (KXMLCore::TCMalloc_ThreadCache_FreeList::Pop):
        (KXMLCore::TCMalloc_ThreadCache::freelist_length):
        (KXMLCore::TCMalloc_ThreadCache::Size):
        (KXMLCore::TCMalloc_Central_FreeList::length):
        (KXMLCore::TCMalloc_Central_FreeList::Init):
        (KXMLCore::TCMalloc_Central_FreeList::Insert):
        (KXMLCore::TCMalloc_Central_FreeList::Remove):
        (KXMLCore::TCMalloc_Central_FreeList::Populate):
        (KXMLCore::TCMalloc_ThreadCache::SampleAllocation):
        (KXMLCore::TCMalloc_ThreadCache::Init):
        (KXMLCore::TCMalloc_ThreadCache::Cleanup):
        (KXMLCore::TCMalloc_ThreadCache::Allocate):
        (KXMLCore::TCMalloc_ThreadCache::Deallocate):
        (KXMLCore::TCMalloc_ThreadCache::FetchFromCentralCache):
        (KXMLCore::TCMalloc_ThreadCache::ReleaseToCentralCache):
        (KXMLCore::TCMalloc_ThreadCache::Scavenge):
        (KXMLCore::TCMalloc_ThreadCache::GetCache):
        (KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
        (KXMLCore::TCMalloc_ThreadCache::PickNextSample):
        (KXMLCore::TCMalloc_ThreadCache::InitModule):
        (KXMLCore::TCMalloc_ThreadCache::InitTSD):
        (KXMLCore::TCMalloc_ThreadCache::CreateCacheIfNecessary):
        (KXMLCore::TCMalloc_ThreadCache::DeleteCache):
        (KXMLCore::TCMalloc_ThreadCache::RecomputeThreadCacheSize):
        (KXMLCore::TCMalloc_ThreadCache::Print):
        (KXMLCore::ExtractStats):
        (KXMLCore::DumpStats):
        (KXMLCore::PrintStats):
        (KXMLCore::DumpStackTraces):
        (KXMLCore::TCMallocImplementation::GetStats):
        (KXMLCore::TCMallocImplementation::ReadStackTraces):
        (KXMLCore::TCMallocImplementation::GetNumericProperty):
        (KXMLCore::TCMallocImplementation::SetNumericProperty):
        (KXMLCore::DoSampledAllocation):
        (KXMLCore::do_malloc):
        (KXMLCore::do_free):
        (KXMLCore::do_memalign):
        (KXMLCore::TCMallocGuard::TCMallocGuard):
        (KXMLCore::TCMallocGuard::~TCMallocGuard):
        (KXMLCore::malloc):
        (KXMLCore::free):
        (KXMLCore::calloc):
        (KXMLCore::cfree):
        (KXMLCore::realloc):
        (KXMLCore::memalign):
        (KXMLCore::posix_memalign):
        (KXMLCore::valloc):
        (KXMLCore::pvalloc):
        (KXMLCore::malloc_stats):
        (KXMLCore::mallopt):
        (KXMLCore::mallinfo):
        * kxmlcore/FastMalloc.h: Added.
        (KXMLCore::FastAllocated::operator new):
        (KXMLCore::FastAllocated::operator delete):
        (KXMLCore::FastAllocated::operator new[]):
        (KXMLCore::FastAllocated::operator delete[]):
        * kxmlcore/SharedPtr.h: Added.
        (KXMLCore::SharedPtr::SharedPtr):
        (KXMLCore::SharedPtr::~SharedPtr):
        (KXMLCore::SharedPtr::isNull):
        (KXMLCore::SharedPtr::notNull):
        (KXMLCore::SharedPtr::reset):
        (KXMLCore::SharedPtr::get):
        (KXMLCore::SharedPtr::operator*):
        (KXMLCore::SharedPtr::operator->):
        (KXMLCore::SharedPtr::operator!):
        (KXMLCore::SharedPtr::operator bool):
        (KXMLCore::::operator):
        (KXMLCore::operator==):
        (KXMLCore::operator!=):
        (KXMLCore::static_pointer_cast):
        (KXMLCore::const_pointer_cast):
        * kxmlcore/TCPageMap.h: Added.
        (TCMalloc_PageMap1::TCMalloc_PageMap1):
        (TCMalloc_PageMap1::Ensure):
        (TCMalloc_PageMap1::get):
        (TCMalloc_PageMap1::set):
        (TCMalloc_PageMap2::TCMalloc_PageMap2):
        (TCMalloc_PageMap2::get):
        (TCMalloc_PageMap2::set):
        (TCMalloc_PageMap2::Ensure):
        (TCMalloc_PageMap3::NewNode):
        (TCMalloc_PageMap3::TCMalloc_PageMap3):
        (TCMalloc_PageMap3::get):
        (TCMalloc_PageMap3::set):
        (TCMalloc_PageMap3::Ensure):
        * kxmlcore/TCSpinLock.h: Added.
        (TCMalloc_SpinLock::Init):
        (TCMalloc_SpinLock::Finalize):
        (TCMalloc_SpinLock::Lock):
        (TCMalloc_SpinLock::Unlock):
        (TCMalloc_SlowLock):
        (TCMalloc_SpinLockHolder::TCMalloc_SpinLockHolder):
        (TCMalloc_SpinLockHolder::~TCMalloc_SpinLockHolder):
        * kxmlcore/TCSystemAlloc.cpp: Added.
        (TrySbrk):
        (TryMmap):
        (TryDevMem):
        (TCMalloc_SystemAlloc):
        * kxmlcore/TCSystemAlloc.h: Added.

WebCore:

        Reviewed by John.

	- replace dlmalloc with tcmalloc
	http://bugzilla.opendarwin.org/show_bug.cgi?id=5145

	I also moved SharedPtr and the assertion code from WebCore into a
	new kxmlcore directory.

        * ForwardingHeaders/kjs/shared_ptr.h: Removed.
        * ForwardingHeaders/kxmlcore/Assertions.h: Added.
        * ForwardingHeaders/kxmlcore/FastMalloc.h: Added.
        * ForwardingHeaders/kxmlcore/SharedPtr.h: Added.
        * ForwardingHeaders/misc/main_thread_malloc.h: Removed.
        * WebCore.xcodeproj/project.pbxproj:
        * khtml/css/css_base.h:
        * khtml/css/css_computedstyle.cpp:
        * khtml/css/css_ruleimpl.h:
        * khtml/css/css_valueimpl.h:
        * khtml/css/cssstyleselector.h:
        * khtml/ecma/domparser.h:
        * khtml/ecma/kjs_css.h:
        * khtml/ecma/kjs_dom.cpp:
        * khtml/ecma/kjs_dom.h:
        * khtml/ecma/kjs_events.h:
        * khtml/ecma/kjs_html.cpp:
        * khtml/ecma/kjs_html.h:
        * khtml/ecma/kjs_range.h:
        * khtml/ecma/kjs_traversal.h:
        * khtml/ecma/kjs_views.cpp:
        * khtml/ecma/kjs_views.h:
        * khtml/ecma/kjs_window.cpp:
        * khtml/ecma/xmlhttprequest.h:
        * khtml/editing/SelectionController.cpp:
        * khtml/editing/append_node_command.cpp:
        * khtml/editing/apply_style_command.cpp:
        * khtml/editing/break_blockquote_command.cpp:
        * khtml/editing/composite_edit_command.cpp:
        * khtml/editing/delete_from_text_node_command.cpp:
        * khtml/editing/delete_selection_command.cpp:
        * khtml/editing/edit_command.cpp:
        * khtml/editing/htmlediting.cpp:
        * khtml/editing/insert_into_text_node_command.cpp:
        * khtml/editing/insert_line_break_command.cpp:
        * khtml/editing/insert_node_before_command.cpp:
        * khtml/editing/insert_paragraph_separator_command.cpp:
        * khtml/editing/insert_text_command.cpp:
        * khtml/editing/join_text_nodes_command.cpp:
        * khtml/editing/markup.cpp:
        * khtml/editing/merge_identical_elements_command.cpp:
        * khtml/editing/move_selection_command.cpp:
        * khtml/editing/rebalance_whitespace_command.cpp:
        * khtml/editing/remove_css_property_command.cpp:
        * khtml/editing/remove_node_attribute_command.cpp:
        * khtml/editing/remove_node_command.cpp:
        * khtml/editing/remove_node_preserving_children_command.cpp:
        * khtml/editing/replace_selection_command.cpp:
        * khtml/editing/set_node_attribute_command.cpp:
        * khtml/editing/split_element_command.cpp:
        * khtml/editing/split_text_node_command.cpp:
        * khtml/editing/split_text_node_containing_element.cpp:
        * khtml/editing/typing_command.cpp:
        * khtml/editing/visible_position.cpp:
        * khtml/editing/visible_position.h:
        * khtml/editing/wrap_contents_in_dummy_span_command.cpp:
        * khtml/html/html_imageimpl.h:
        * khtml/html/html_tableimpl.h:
        * khtml/html/htmlparser.cpp:
        * khtml/khtmlpart_p.h:
        * khtml/misc/arena.cpp:
        (ArenaAllocate):
        (FreeArenaList):
        (ArenaFinish):
        * khtml/misc/hashtable.h:
        (khtml::HashTable::~HashTable):
        (khtml::::allocateTable):
        (khtml::::rehash):
        (khtml::::clear):
        (khtml::::HashTable):
        * khtml/misc/loader.cpp:
        * khtml/misc/main_thread_malloc.cpp: Removed.
        * khtml/misc/main_thread_malloc.h: Removed.
        * khtml/misc/shared.h:
        * khtml/rendering/render_style.h:
        * khtml/xml/dom2_eventsimpl.h:
        * khtml/xml/dom2_rangeimpl.h:
        * khtml/xml/dom2_traversalimpl.h:
        * khtml/xml/dom2_viewsimpl.h:
        * khtml/xml/dom_docimpl.h:
        * khtml/xml/dom_elementimpl.cpp:
        (NamedAttrMapImpl::clearAttributes):
        (NamedAttrMapImpl::operator=):
        (NamedAttrMapImpl::addAttribute):
        (NamedAttrMapImpl::removeAttribute):
        * khtml/xml/dom_elementimpl.h:
        * khtml/xml/dom_nodeimpl.cpp:
        * khtml/xml/dom_nodeimpl.h:
        * khtml/xml/dom_position.cpp:
        * khtml/xml/dom_stringimpl.h:
        * kwq/DOM-CSS.mm:
        * kwq/DOM.mm:
        * kwq/DOMEvents.mm:
        * kwq/DOMHTML.mm:
        * kwq/DOMInternal.mm:
        * kwq/DOMViews.mm:
        * kwq/KWQAccObject.mm:
        * kwq/KWQAccObjectCache.mm:
        * kwq/KWQArrayImpl.h:
        * kwq/KWQArrayImpl.mm:
        (KWQArrayImpl::KWQArrayPrivate::KWQArrayPrivate):
        (KWQArrayImpl::KWQArrayPrivate::~KWQArrayPrivate):
        (KWQArrayImpl::resize):
        * kwq/KWQAssertions.h: Removed.
        * kwq/KWQAssertions.m: Removed.
        * kwq/KWQButton.mm:
        * kwq/KWQCString.mm:
        * kwq/KWQClipboard.h:
        * kwq/KWQClipboard.mm:
        * kwq/KWQColor.mm:
        * kwq/KWQComboBox.mm:
        * kwq/KWQEditCommand.mm:
        * kwq/KWQExceptions.h:
        * kwq/KWQFileButton.mm:
        * kwq/KWQFontFamily.h:
        * kwq/KWQFormData.mm:
        * kwq/KWQKHTMLPart.h:
        * kwq/KWQKHTMLPart.mm:
        * kwq/KWQKPartsBrowserInterface.mm:
        * kwq/KWQKURL.mm:
        * kwq/KWQListBox.mm:
        * kwq/KWQListImpl.mm:
        * kwq/KWQLogging.h:
        * kwq/KWQLogging.m:
        * kwq/KWQMapImpl.h:
        * kwq/KWQMapImpl.mm:
        * kwq/KWQObject.mm:
        * kwq/KWQPageState.mm:
        * kwq/KWQPainter.mm:
        * kwq/KWQResourceLoader.mm:
        * kwq/KWQSignal.mm:
        * kwq/KWQSlot.mm:
        * kwq/KWQString.h:
        * kwq/KWQString.mm:
        (ALLOC_QCHAR):
        (QString::setBufferFromCFString):
        (allocatePageNode):
        * kwq/KWQTextArea.mm:
        * kwq/KWQTextCodec.mm:
        * kwq/KWQTextEdit.mm:
        * kwq/KWQTextField.mm:
        * kwq/KWQTimer.mm:
        * kwq/KWQValueListImpl.h:
        * kwq/KWQValueListImpl.mm:
        * kwq/WebCoreBridge.mm:
        * kwq/WebCoreCookieAdapter.m:
        * kwq/WebCoreGraphicsBridge.m:
        * kwq/WebCoreImageRendererFactory.m:
        * kwq/WebCoreKeyGenerator.m:
        * kwq/WebCoreTextRendererFactory.mm:
        * kwq/WebCoreViewFactory.m:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@10634 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e28a74b7
2005-09-26 Maciej Stachowiak <mjs@apple.com>
Reviewed by John.
- replace dlmalloc with tcmalloc
http://bugzilla.opendarwin.org/show_bug.cgi?id=5145
I also moved SharedPtr and the assertion code from WebCore into a
new kxmlcore directory.
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/collector.cpp:
(KJS::Collector::allocate):
(KJS::Collector::collect):
* kjs/config.h:
* kjs/fast_malloc.cpp: Removed.
* kjs/fast_malloc.h: Removed.
* kjs/function.cpp:
* kjs/function.h:
* kjs/function_object.cpp:
* kjs/identifier.cpp:
(KJS::Identifier::add):
* kjs/internal.cpp:
* kjs/internal.h:
* kjs/nodes.h:
* kjs/nodes2string.cpp:
* kjs/property_map.cpp:
(KJS::PropertyMap::~PropertyMap):
(KJS::PropertyMap::rehash):
* kjs/scope_chain.h:
* kjs/shared_ptr.h: Removed.
* kjs/string_object.cpp:
(StringObjectFuncImp::callAsFunction):
* kjs/ustring.cpp:
(KJS::UString::Rep::createCopying):
(KJS::UString::Rep::destroy):
(KJS::UString::expandCapacity):
(KJS::UString::expandPreCapacity):
(KJS::UString::UString):
(KJS::UString::spliceSubstringsWithSeparators):
(KJS::UString::append):
(KJS::UString::operator=):
(KJS::UString::detach):
* kjs/ustring.h:
* kxmlcore/Assertions.h: Added.
* kxmlcore/Assertions.mm: Added.
* kxmlcore/FastMalloc.cpp: Added.
(KXMLCore::LgFloor):
(KXMLCore::SizeClass):
(KXMLCore::ByteSizeForClass):
(KXMLCore::InitSizeClasses):
(KXMLCore::MetaDataAlloc):
(KXMLCore::PageHeapAllocator::Init):
(KXMLCore::PageHeapAllocator::New):
(KXMLCore::PageHeapAllocator::Delete):
(KXMLCore::PageHeapAllocator::inuse):
(KXMLCore::pages):
(KXMLCore::AllocationSize):
(KXMLCore::Event):
(KXMLCore::NewSpan):
(KXMLCore::DeleteSpan):
(KXMLCore::DLL_Init):
(KXMLCore::DLL_Remove):
(KXMLCore::DLL_IsEmpty):
(KXMLCore::DLL_Length):
(KXMLCore::DLL_Print):
(KXMLCore::DLL_Prepend):
(KXMLCore::DLL_InsertOrdered):
(KXMLCore::):
(KXMLCore::TCMalloc_PageHeap::GetDescriptor):
(KXMLCore::TCMalloc_PageHeap::SystemBytes):
(KXMLCore::TCMalloc_PageHeap::FreeBytes):
(KXMLCore::TCMalloc_PageHeap::RecordSpan):
(KXMLCore::TCMalloc_PageHeap::TCMalloc_PageHeap):
(KXMLCore::TCMalloc_PageHeap::New):
(KXMLCore::TCMalloc_PageHeap::Split):
(KXMLCore::TCMalloc_PageHeap::Carve):
(KXMLCore::TCMalloc_PageHeap::Delete):
(KXMLCore::TCMalloc_PageHeap::RegisterSizeClass):
(KXMLCore::TCMalloc_PageHeap::Dump):
(KXMLCore::TCMalloc_PageHeap::GrowHeap):
(KXMLCore::TCMalloc_PageHeap::Check):
(KXMLCore::TCMalloc_PageHeap::CheckList):
(KXMLCore::TCMalloc_ThreadCache_FreeList::Init):
(KXMLCore::TCMalloc_ThreadCache_FreeList::length):
(KXMLCore::TCMalloc_ThreadCache_FreeList::empty):
(KXMLCore::TCMalloc_ThreadCache_FreeList::lowwatermark):
(KXMLCore::TCMalloc_ThreadCache_FreeList::clear_lowwatermark):
(KXMLCore::TCMalloc_ThreadCache_FreeList::Push):
(KXMLCore::TCMalloc_ThreadCache_FreeList::Pop):
(KXMLCore::TCMalloc_ThreadCache::freelist_length):
(KXMLCore::TCMalloc_ThreadCache::Size):
(KXMLCore::TCMalloc_Central_FreeList::length):
(KXMLCore::TCMalloc_Central_FreeList::Init):
(KXMLCore::TCMalloc_Central_FreeList::Insert):
(KXMLCore::TCMalloc_Central_FreeList::Remove):
(KXMLCore::TCMalloc_Central_FreeList::Populate):
(KXMLCore::TCMalloc_ThreadCache::SampleAllocation):
(KXMLCore::TCMalloc_ThreadCache::Init):
(KXMLCore::TCMalloc_ThreadCache::Cleanup):
(KXMLCore::TCMalloc_ThreadCache::Allocate):
(KXMLCore::TCMalloc_ThreadCache::Deallocate):
(KXMLCore::TCMalloc_ThreadCache::FetchFromCentralCache):
(KXMLCore::TCMalloc_ThreadCache::ReleaseToCentralCache):
(KXMLCore::TCMalloc_ThreadCache::Scavenge):
(KXMLCore::TCMalloc_ThreadCache::GetCache):
(KXMLCore::TCMalloc_ThreadCache::GetCacheIfPresent):
(KXMLCore::TCMalloc_ThreadCache::PickNextSample):
(KXMLCore::TCMalloc_ThreadCache::InitModule):
(KXMLCore::TCMalloc_ThreadCache::InitTSD):
(KXMLCore::TCMalloc_ThreadCache::CreateCacheIfNecessary):
(KXMLCore::TCMalloc_ThreadCache::DeleteCache):
(KXMLCore::TCMalloc_ThreadCache::RecomputeThreadCacheSize):
(KXMLCore::TCMalloc_ThreadCache::Print):
(KXMLCore::ExtractStats):
(KXMLCore::DumpStats):
(KXMLCore::PrintStats):
(KXMLCore::DumpStackTraces):
(KXMLCore::TCMallocImplementation::GetStats):
(KXMLCore::TCMallocImplementation::ReadStackTraces):
(KXMLCore::TCMallocImplementation::GetNumericProperty):
(KXMLCore::TCMallocImplementation::SetNumericProperty):
(KXMLCore::DoSampledAllocation):
(KXMLCore::do_malloc):
(KXMLCore::do_free):
(KXMLCore::do_memalign):
(KXMLCore::TCMallocGuard::TCMallocGuard):
(KXMLCore::TCMallocGuard::~TCMallocGuard):
(KXMLCore::malloc):
(KXMLCore::free):
(KXMLCore::calloc):
(KXMLCore::cfree):
(KXMLCore::realloc):
(KXMLCore::memalign):
(KXMLCore::posix_memalign):
(KXMLCore::valloc):
(KXMLCore::pvalloc):
(KXMLCore::malloc_stats):
(KXMLCore::mallopt):
(KXMLCore::mallinfo):
* kxmlcore/FastMalloc.h: Added.
(KXMLCore::FastAllocated::operator new):
(KXMLCore::FastAllocated::operator delete):
(KXMLCore::FastAllocated::operator new[]):
(KXMLCore::FastAllocated::operator delete[]):
* kxmlcore/SharedPtr.h: Added.
(KXMLCore::SharedPtr::SharedPtr):
(KXMLCore::SharedPtr::~SharedPtr):
(KXMLCore::SharedPtr::isNull):
(KXMLCore::SharedPtr::notNull):
(KXMLCore::SharedPtr::reset):
(KXMLCore::SharedPtr::get):
(KXMLCore::SharedPtr::operator*):
(KXMLCore::SharedPtr::operator->):
(KXMLCore::SharedPtr::operator!):
(KXMLCore::SharedPtr::operator bool):
(KXMLCore::::operator):
(KXMLCore::operator==):
(KXMLCore::operator!=):
(KXMLCore::static_pointer_cast):
(KXMLCore::const_pointer_cast):
* kxmlcore/TCPageMap.h: Added.
(TCMalloc_PageMap1::TCMalloc_PageMap1):
(TCMalloc_PageMap1::Ensure):
(TCMalloc_PageMap1::get):
(TCMalloc_PageMap1::set):
(TCMalloc_PageMap2::TCMalloc_PageMap2):
(TCMalloc_PageMap2::get):
(TCMalloc_PageMap2::set):
(TCMalloc_PageMap2::Ensure):
(TCMalloc_PageMap3::NewNode):
(TCMalloc_PageMap3::TCMalloc_PageMap3):
(TCMalloc_PageMap3::get):
(TCMalloc_PageMap3::set):
(TCMalloc_PageMap3::Ensure):
* kxmlcore/TCSpinLock.h: Added.
(TCMalloc_SpinLock::Init):
(TCMalloc_SpinLock::Finalize):
(TCMalloc_SpinLock::Lock):
(TCMalloc_SpinLock::Unlock):
(TCMalloc_SlowLock):
(TCMalloc_SpinLockHolder::TCMalloc_SpinLockHolder):
(TCMalloc_SpinLockHolder::~TCMalloc_SpinLockHolder):
* kxmlcore/TCSystemAlloc.cpp: Added.
(TrySbrk):
(TryMmap):
(TryDevMem):
(TCMalloc_SystemAlloc):
* kxmlcore/TCSystemAlloc.h: Added.
2005-09-23 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
......
......@@ -21,7 +21,7 @@
#include "collector.h"
#include "fast_malloc.h"
#include <kxmlcore/FastMalloc.h>
#include "internal.h"
#include "list.h"
#include "value.h"
......@@ -118,10 +118,10 @@ void* Collector::allocate(size_t s)
if (usedOversizeCells == numOversizeCells) {
numOversizeCells = max(MIN_ARRAY_SIZE, numOversizeCells * GROWTH_FACTOR);
heap.numOversizeCells = numOversizeCells;
heap.oversizeCells = static_cast<CollectorCell **>(kjs_fast_realloc(heap.oversizeCells, numOversizeCells * sizeof(CollectorCell *)));
heap.oversizeCells = static_cast<CollectorCell **>(fastRealloc(heap.oversizeCells, numOversizeCells * sizeof(CollectorCell *)));
}
void *newCell = kjs_fast_malloc(s);
void *newCell = fastMalloc(s);
heap.oversizeCells[usedOversizeCells] = static_cast<CollectorCell *>(newCell);
heap.usedOversizeCells = usedOversizeCells + 1;
heap.numLiveObjects = numLiveObjects + 1;
......@@ -156,10 +156,10 @@ allocateNewBlock:
if (usedBlocks == numBlocks) {
numBlocks = max(MIN_ARRAY_SIZE, numBlocks * GROWTH_FACTOR);
heap.numBlocks = numBlocks;
heap.blocks = static_cast<CollectorBlock **>(kjs_fast_realloc(heap.blocks, numBlocks * sizeof(CollectorBlock *)));
heap.blocks = static_cast<CollectorBlock **>(fastRealloc(heap.blocks, numBlocks * sizeof(CollectorBlock *)));
}
targetBlock = static_cast<CollectorBlock *>(kjs_fast_calloc(1, sizeof(CollectorBlock)));
targetBlock = static_cast<CollectorBlock *>(fastCalloc(1, sizeof(CollectorBlock)));
targetBlock->freeList = targetBlock->cells;
targetBlockUsedCells = 0;
heap.blocks[usedBlocks] = targetBlock;
......@@ -454,7 +454,7 @@ bool Collector::collect()
emptyBlocks++;
if (emptyBlocks > SPARE_EMPTY_BLOCKS) {
#if !DEBUG_COLLECTOR
kjs_fast_free(curBlock);
fastFree(curBlock);
#endif
// swap with the last block so we compact as we go
heap.blocks[block] = heap.blocks[heap.usedBlocks - 1];
......@@ -463,7 +463,7 @@ bool Collector::collect()
if (heap.numBlocks > MIN_ARRAY_SIZE && heap.usedBlocks < heap.numBlocks / LOW_WATER_FACTOR) {
heap.numBlocks = heap.numBlocks / GROWTH_FACTOR;
heap.blocks = (CollectorBlock **)kjs_fast_realloc(heap.blocks, heap.numBlocks * sizeof(CollectorBlock *));
heap.blocks = (CollectorBlock **)fastRealloc(heap.blocks, heap.numBlocks * sizeof(CollectorBlock *));
}
}
}
......@@ -481,7 +481,7 @@ bool Collector::collect()
#if DEBUG_COLLECTOR
heap.oversizeCells[cell]->u.freeCell.zeroIfFree = 0;
#else
kjs_fast_free(imp);
fastFree(imp);
#endif
// swap with the last oversize cell so we compact as we go
......@@ -492,7 +492,7 @@ bool Collector::collect()
if (heap.numOversizeCells > MIN_ARRAY_SIZE && heap.usedOversizeCells < heap.numOversizeCells / LOW_WATER_FACTOR) {
heap.numOversizeCells = heap.numOversizeCells / GROWTH_FACTOR;
heap.oversizeCells = (CollectorCell **)kjs_fast_realloc(heap.oversizeCells, heap.numOversizeCells * sizeof(CollectorCell *));
heap.oversizeCells = (CollectorCell **)fastRealloc(heap.oversizeCells, heap.numOversizeCells * sizeof(CollectorCell *));
}
} else {
imp->m_marked = false;
......
......@@ -19,6 +19,10 @@
#define HAVE_ICU 1
#define HAVE_PCREPOSIX 1
#define HAVE_STRING_H 1
#define HAVE_STDINT_H 1
#define HAVE_MMAP 1
#define HAVE_SBRK 1
#ifdef __ppc__
#define WORDS_BIGENDIAN 1
......@@ -26,3 +30,5 @@
/* define to debug garbage collection */
#undef DEBUG_COLLECTOR
#define KXC_CHANGES 1
This diff is collapsed.
......@@ -31,7 +31,6 @@
#include "operations.h"
#include "debugger.h"
#include "context.h"
#include "shared_ptr.h"
#include <stdio.h>
#include <errno.h>
......@@ -42,8 +41,6 @@
#include <unicode/uchar.h>
using namespace KXMLCore;
namespace KJS {
// ----------------------------- FunctionImp ----------------------------------
......
......@@ -81,7 +81,7 @@ namespace KJS {
virtual Completion execute(ExecState *exec);
CodeType codeType() const { return FunctionCode; }
KXMLCore::SharedPtr<FunctionBodyNode> body;
SharedPtr<FunctionBodyNode> body;
virtual const ClassInfo *classInfo() const { return &info; }
static const ClassInfo info;
......
......@@ -34,7 +34,6 @@
#include <string.h>
using namespace KJS;
using namespace KXMLCore;
// ------------------------------ FunctionPrototypeImp -------------------------
......
......@@ -35,7 +35,7 @@
#include "identifier.h"
#include "fast_malloc.h"
#include <kxmlcore/FastMalloc.h>
#include <string.h> // for strlen
#include <new> // for placement new
......@@ -126,7 +126,7 @@ UString::Rep *Identifier::add(const char *c)
i = (i + 1) & _tableSizeMask;
}
UChar *d = static_cast<UChar *>(kjs_fast_malloc(sizeof(UChar) * length));
UChar *d = static_cast<UChar *>(fastMalloc(sizeof(UChar) * length));
for (int j = 0; j != length; j++)
d[j] = c[j];
......@@ -165,7 +165,7 @@ UString::Rep *Identifier::add(const UChar *s, int length)
i = (i + 1) & _tableSizeMask;
}
UChar *d = static_cast<UChar *>(kjs_fast_malloc(sizeof(UChar) * length));
UChar *d = static_cast<UChar *>(fastMalloc(sizeof(UChar) * length));
for (int j = 0; j != length; j++)
d[j] = s[j];
......
......@@ -52,8 +52,6 @@
extern int kjsyyparse();
using namespace KXMLCore;
namespace KJS {
#if !APPLE_CHANGES
......
......@@ -32,7 +32,7 @@
#include "types.h"
#include "interpreter.h"
#include "scope_chain.h"
#include "shared_ptr.h"
#include <kxmlcore/SharedPtr.h>
#if !WIN32
#define KJS_MULTIPLE_THREADS 1
......@@ -202,9 +202,9 @@ namespace KJS {
*/
class Parser {
public:
static KXMLCore::SharedPtr<ProgramNode> parse(const UString &sourceURL, int startingLineNumber,
const UChar *code, unsigned int length, int *sourceId = 0,
int *errLine = 0, UString *errMsg = 0);
static SharedPtr<ProgramNode> parse(const UString &sourceURL, int startingLineNumber,
const UChar *code, unsigned int length, int *sourceId = 0,
int *errLine = 0, UString *errMsg = 0);
static void accept(ProgramNode *prog);
static void saveNewNode(Node *node);
......
This diff is collapsed.
......@@ -23,8 +23,6 @@
#include "nodes.h"
using KXMLCore::SharedPtr;
namespace KJS {
/**
* A simple text streaming class that helps with code indentation.
......
......@@ -21,7 +21,7 @@
#include "property_map.h"
#include "fast_malloc.h"
#include <kxmlcore/FastMalloc.h>
#include "object.h"
#include "protect.h"
#include "reference_list.h"
......@@ -122,7 +122,7 @@ PropertyMap::~PropertyMap()
else
++minimumKeysToProcess;
}
kjs_fast_free(_table);
fastFree(_table);
}
void PropertyMap::clear()
......@@ -424,7 +424,7 @@ void PropertyMap::rehash(int newTableSize)
int oldTableSize = oldTable ? oldTable->size : 0;
int oldTableKeyCount = oldTable ? oldTable->keyCount : 0;
_table = (Table *)kjs_fast_calloc(1, sizeof(Table) + (newTableSize - 1) * sizeof(Entry) );
_table = (Table *)fastCalloc(1, sizeof(Table) + (newTableSize - 1) * sizeof(Entry) );
_table->size = newTableSize;
_table->sizeMask = newTableSize - 1;
_table->keyCount = oldTableKeyCount;
......@@ -458,7 +458,7 @@ void PropertyMap::rehash(int newTableSize)
}
_table->lastIndexUsed = lastIndexUsed;
kjs_fast_free(oldTable);
fastFree(oldTable);
checkConsistency();
}
......
......@@ -22,19 +22,17 @@
#ifndef KJS_SCOPE_CHAIN_H
#define KJS_SCOPE_CHAIN_H
#include "fast_malloc.h"
#include <kxmlcore/FastMalloc.h>
namespace KJS {
class ObjectImp;
class ScopeChainNode {
class ScopeChainNode : public FastAllocated {
public:
ScopeChainNode(ScopeChainNode *n, ObjectImp *o)
: next(n), object(o), refCount(1) { }
KJS_FAST_ALLOCATED;
ScopeChainNode *next;
ObjectImp *object;
int refCount;
......
// -*- c-basic-offset: 4 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 2005 Apple Computer, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef KXMLCORE_SHARED_PTR_H
#define KXMLCORE_SHARED_PTR_H
namespace KXMLCore {
// FIXME: Change template name to RefPtr?
template <class T> class SharedPtr
{
public:
SharedPtr() : m_ptr(NULL) {}
SharedPtr(T *ptr) : m_ptr(ptr) { if (ptr) ptr->ref(); }
SharedPtr(const SharedPtr &o) : m_ptr(o.m_ptr) { if (T *ptr = m_ptr) ptr->ref(); }
~SharedPtr() { if (T *ptr = m_ptr) ptr->deref(); }
template <class U> SharedPtr(const SharedPtr<U> &o) : m_ptr(o.get()) { if (T *ptr = m_ptr) ptr->ref(); }
// FIXME: Deprecate in favor of operators below, then remove?
bool isNull() const { return m_ptr == NULL; }
bool notNull() const { return m_ptr != NULL; }
// FIXME: Deprecate in favor of operator=, then remove?
void reset() { if (T *ptr = m_ptr) ptr->deref(); m_ptr = NULL; }
void reset(T *o) { if (o) o->ref(); if (T *ptr = m_ptr) ptr->deref(); m_ptr = o; }
T *get() const { return m_ptr; }
T &operator*() const { return *m_ptr; }
T *operator->() const { return m_ptr; }
bool operator!() const { return m_ptr == NULL; }
operator bool() const { return m_ptr != NULL; }
SharedPtr &operator=(const SharedPtr &);
SharedPtr &operator=(T *);
private:
T *m_ptr;
operator int() const; // deliberately not implemented; helps prevent operator bool from converting to int accidentally
};
template <class T> SharedPtr<T> &SharedPtr<T>::operator=(const SharedPtr<T> &o)
{
T *optr = o.m_ptr;
if (optr)
optr->ref();
if (T *ptr = m_ptr)
ptr->deref();
m_ptr = optr;
return *this;
}
template <class T> inline SharedPtr<T> &SharedPtr<T>::operator=(T *optr)
{
if (optr)
optr->ref();
if (T *ptr = m_ptr)
ptr->deref();
m_ptr = optr;
return *this;
}
template <class T> inline bool operator==(const SharedPtr<T> &a, const SharedPtr<T> &b) { return a.get() == b.get(); }
template <class T> inline bool operator==(const SharedPtr<T> &a, const T *b) { return a.get() == b; }
template <class T> inline bool operator==(const T *a, const SharedPtr<T> &b) { return a == b.get(); }
template <class T> inline bool operator!=(const SharedPtr<T> &a, const SharedPtr<T> &b) { return a.get() != b.get(); }
template <class T> inline bool operator!=(const SharedPtr<T> &a, const T *b) { return a.get() != b; }
template <class T> inline bool operator!=(const T *a, const SharedPtr<T> &b) { return a != b.get(); }
template <class T, class U> inline SharedPtr<T> static_pointer_cast(const SharedPtr<U> &p) { return SharedPtr<T>(static_cast<T *>(p.get())); }
template <class T, class U> inline SharedPtr<T> const_pointer_cast(const SharedPtr<U> &p) { return SharedPtr<T>(const_cast<T *>(p.get())); }
}
#endif // KXMLCORE_SHARED_PTR_H
......@@ -765,7 +765,7 @@ ValueImp *StringObjectFuncImp::callAsFunction(ExecState *exec, ObjectImp */*this
{
UString s;
if (args.size()) {
UChar *buf = static_cast<UChar *>(kjs_fast_malloc(args.size() * sizeof(UChar)));
UChar *buf = static_cast<UChar *>(fastMalloc(args.size() * sizeof(UChar)));
UChar *p = buf;
ListIterator it = args.begin();
while (it != args.end()) {
......
......@@ -35,7 +35,6 @@
#include <strings.h>
#endif
#include "fast_malloc.h"
#include "ustring.h"
#include "operations.h"
#include "identifier.h"
......@@ -179,7 +178,7 @@ UChar& UCharReference::ref() const
UString::Rep *UString::Rep::createCopying(const UChar *d, int l)
{
int sizeInBytes = l * sizeof(UChar);
UChar *copyD = static_cast<UChar *>(kjs_fast_malloc(sizeInBytes));
UChar *copyD = static_cast<UChar *>(fastMalloc(sizeInBytes));
<