[webkit-changes] cvs commit: WebCore/kwq KWQArrayImpl.h
KWQArrayImpl.mm KWQMapImpl.h KWQMapImpl.mm KWQRefPtr.h
KWQValueListImpl.h KWQValueListImpl.mm
Adele
adele at opensource.apple.com
Tue Aug 23 17:13:45 PDT 2005
adele 05/08/23 17:13:44
Modified: . Tag: Safari-2-0-branch ChangeLog
kwq Tag: Safari-2-0-branch KWQArrayImpl.h
KWQArrayImpl.mm KWQMapImpl.h KWQMapImpl.mm
KWQRefPtr.h KWQValueListImpl.h KWQValueListImpl.mm
Log:
Merged fix from TOT to Safari-2-0-branch
<rdar://problem/4221430> Safari HTML iBench performance can be improved through inlining and allocator tweaks
2005-08-14 Maciej Stachowiak <mjs at apple.com>
Reviewed by Darin.
- apply a tasty candy shell of inlining and main_thread_malloc for a 1% speedup on HTML iBench
http://bugzilla.opendarwin.org/show_bug.cgi?id=4425
* kwq/KWQArrayImpl.h:
(KWQArrayImpl::size):
* kwq/KWQArrayImpl.mm:
* kwq/KWQMapImpl.h:
* kwq/KWQMapImpl.mm:
* kwq/KWQRefPtr.h:
(::KWQRefPtr):
(::operator):
(::ref):
(::unref):
* kwq/KWQValueListImpl.h:
(KWQValueListIteratorImpl::KWQValueListIteratorImpl):
(KWQValueListIteratorImpl::operator==):
(KWQValueListIteratorImpl::operator!=):
(KWQValueListIteratorImpl::node):
(KWQValueListIteratorImpl::operator++):
(KWQValueListIteratorImpl::operator--):
(KWQValueListNodeImpl::KWQValueListNodeImpl):
* kwq/KWQValueListImpl.mm:
(KWQValueListImpl::KWQValueListPrivate::KWQValueListPrivate):
(KWQValueListImpl::KWQValueListPrivate::~KWQValueListPrivate):
Revision Changes Path
No revision
No revision
1.1.2.2 +33 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- ChangeLog 24 Aug 2005 00:03:36 -0000 1.1.2.1
+++ ChangeLog 24 Aug 2005 00:13:43 -0000 1.1.2.2
@@ -2,6 +2,39 @@
Merged fix from TOT to Safari-2-0-branch
+ 2005-08-14 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Darin.
+
+ - apply a tasty candy shell of inlining and main_thread_malloc for a 1% speedup on HTML iBench
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=4425
+
+ * kwq/KWQArrayImpl.h:
+ (KWQArrayImpl::size):
+ * kwq/KWQArrayImpl.mm:
+ * kwq/KWQMapImpl.h:
+ * kwq/KWQMapImpl.mm:
+ * kwq/KWQRefPtr.h:
+ (::KWQRefPtr):
+ (::operator):
+ (::ref):
+ (::unref):
+ * kwq/KWQValueListImpl.h:
+ (KWQValueListIteratorImpl::KWQValueListIteratorImpl):
+ (KWQValueListIteratorImpl::operator==):
+ (KWQValueListIteratorImpl::operator!=):
+ (KWQValueListIteratorImpl::node):
+ (KWQValueListIteratorImpl::operator++):
+ (KWQValueListIteratorImpl::operator--):
+ (KWQValueListNodeImpl::KWQValueListNodeImpl):
+ * kwq/KWQValueListImpl.mm:
+ (KWQValueListImpl::KWQValueListPrivate::KWQValueListPrivate):
+ (KWQValueListImpl::KWQValueListPrivate::~KWQValueListPrivate):
+
+2005-08-23 Adele Peterson <adele at apple.com>
+
+ Merged fix from TOT to Safari-2-0-branch
+
2005-08-22 John Sullivan <sullivan at apple.com>
Reviewed by Beth Dakin.
No revision
No revision
1.7.10.1 +9 -0 WebCore/kwq/KWQArrayImpl.h
Index: KWQArrayImpl.h
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQArrayImpl.h,v
retrieving revision 1.7
retrieving revision 1.7.10.1
diff -u -r1.7 -r1.7.10.1
--- KWQArrayImpl.h 30 Aug 2004 20:35:39 -0000 1.7
+++ KWQArrayImpl.h 24 Aug 2005 00:13:43 -0000 1.7.10.1
@@ -29,6 +29,7 @@
#include "KWQRefPtr.h"
#include "KWQDef.h"
#include <stddef.h>
+#include "main_thread_malloc.h"
class KWQArrayImpl
{
@@ -56,6 +57,9 @@
public:
KWQArrayPrivate(size_t pNumItems, size_t pItemSize);
~KWQArrayPrivate();
+
+ MAIN_THREAD_ALLOCATED;
+
size_t numItems;
size_t itemSize;
char *data;
@@ -65,4 +69,9 @@
KWQRefPtr<KWQArrayPrivate> d;
};
+inline uint KWQArrayImpl::size() const
+{
+ return d->numItems;
+}
+
#endif
1.10.10.1 +6 -11 WebCore/kwq/KWQArrayImpl.mm
Index: KWQArrayImpl.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQArrayImpl.mm,v
retrieving revision 1.10
retrieving revision 1.10.10.1
diff -u -r1.10 -r1.10.10.1
--- KWQArrayImpl.mm 30 Aug 2004 20:35:39 -0000 1.10
+++ KWQArrayImpl.mm 24 Aug 2005 00:13:43 -0000 1.10.10.1
@@ -31,18 +31,21 @@
#define MIN(a,b) (((a)<(b))?(a):(b))
using std::nothrow;
+using khtml::main_thread_malloc;
+using khtml::main_thread_free;
+using khtml::main_thread_realloc;
KWQArrayImpl::KWQArrayPrivate::KWQArrayPrivate(size_t pItemSize, size_t pNumItems) :
numItems(pNumItems),
itemSize(pItemSize),
- data(pNumItems > 0 ? new char[itemSize * numItems] : NULL),
+ data(pNumItems > 0 ? static_cast<char *>(main_thread_malloc(itemSize * numItems)) : NULL),
refCount(0)
{
}
KWQArrayImpl::KWQArrayPrivate::~KWQArrayPrivate()
{
- delete[] data;
+ main_thread_free(data);
}
@@ -71,18 +74,13 @@
return d->data;
}
-uint KWQArrayImpl::size() const
-{
- return d->numItems;
-}
-
bool KWQArrayImpl::resize(size_t newSize)
{
if (newSize != d->numItems) {
char *newData;
if (newSize != 0) {
- newData = new (nothrow) char[newSize * d->itemSize];
+ newData = static_cast<char *>(main_thread_realloc(d->data, newSize * d->itemSize));
if (newData == NULL) {
return false;
}
@@ -90,9 +88,6 @@
newData = NULL;
}
- memcpy(newData, d->data, MIN(newSize, d->numItems) * d->itemSize);
-
- delete[] d->data;
d->data = newData;
d->numItems = newSize;
}
1.7.74.1 +7 -0 WebCore/kwq/KWQMapImpl.h
Index: KWQMapImpl.h
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQMapImpl.h,v
retrieving revision 1.7
retrieving revision 1.7.74.1
diff -u -r1.7 -r1.7.74.1
--- KWQMapImpl.h 22 Jan 2003 00:12:35 -0000 1.7
+++ KWQMapImpl.h 24 Aug 2005 00:13:43 -0000 1.7.74.1
@@ -29,9 +29,13 @@
#include <new>
#include "KWQRefPtr.h"
+#include "main_thread_malloc.h"
class KWQMapNodeImpl
{
+public:
+ MAIN_THREAD_ALLOCATED;
+
protected:
typedef enum { Red = 0, Black = 1 } KWQMapNodeColor;
@@ -62,6 +66,9 @@
};
class KWQMapIteratorImpl {
+public:
+ MAIN_THREAD_ALLOCATED;
+
protected:
KWQMapNodeImpl *node;
1.9.74.1 +2 -0 WebCore/kwq/KWQMapImpl.mm
Index: KWQMapImpl.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQMapImpl.mm,v
retrieving revision 1.9
retrieving revision 1.9.74.1
diff -u -r1.9 -r1.9.74.1
--- KWQMapImpl.mm 22 Jan 2003 00:12:35 -0000 1.9
+++ KWQMapImpl.mm 24 Aug 2005 00:13:43 -0000 1.9.74.1
@@ -124,6 +124,8 @@
~KWQMapPrivate();
+ MAIN_THREAD_ALLOCATED;
+
KWQMapNodeImpl *guard;
uint numNodes;
int refCount;
1.3.74.1 +5 -5 WebCore/kwq/KWQRefPtr.h
Index: KWQRefPtr.h
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQRefPtr.h,v
retrieving revision 1.3
retrieving revision 1.3.74.1
diff -u -r1.3 -r1.3.74.1
--- KWQRefPtr.h 22 Jan 2003 00:12:35 -0000 1.3
+++ KWQRefPtr.h 24 Aug 2005 00:13:43 -0000 1.3.74.1
@@ -46,19 +46,19 @@
T* pointer;
};
-template <class T> KWQRefPtr<T>::KWQRefPtr(T* p)
+template <class T> inline KWQRefPtr<T>::KWQRefPtr(T* p)
: pointer(p)
{
ref();
}
-template <class T> KWQRefPtr<T>::KWQRefPtr(const KWQRefPtr& r)
+template <class T> inline KWQRefPtr<T>::KWQRefPtr(const KWQRefPtr& r)
: pointer(r.pointer)
{
ref();
}
-template <class T> KWQRefPtr<T>& KWQRefPtr<T>::operator=(const KWQRefPtr& r)
+template <class T> inline KWQRefPtr<T>& KWQRefPtr<T>::operator=(const KWQRefPtr& r)
{
r.ref();
unref();
@@ -66,14 +66,14 @@
return *this;
}
-template <class T> void KWQRefPtr<T>::ref() const
+template <class T> inline void KWQRefPtr<T>::ref() const
{
if (pointer) {
++pointer->refCount;
}
}
-template <class T> void KWQRefPtr<T>::unref()
+template <class T> inline void KWQRefPtr<T>::unref()
{
if (pointer && --pointer->refCount == 0) {
delete pointer;
1.9.18.1 +67 -1 WebCore/kwq/KWQValueListImpl.h
Index: KWQValueListImpl.h
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQValueListImpl.h,v
retrieving revision 1.9
retrieving revision 1.9.18.1
diff -u -r1.9 -r1.9.18.1
--- KWQValueListImpl.h 7 Feb 2004 01:19:44 -0000 1.9
+++ KWQValueListImpl.h 24 Aug 2005 00:13:43 -0000 1.9.18.1
@@ -28,6 +28,7 @@
#include "KWQRefPtr.h"
#include "KWQDef.h"
+#include "main_thread_malloc.h"
class KWQValueListNodeImpl;
@@ -54,7 +55,6 @@
friend class KWQValueListImpl;
};
-
class KWQValueListImpl
{
public:
@@ -107,6 +107,9 @@
class KWQValueListNodeImpl
{
+public:
+ MAIN_THREAD_ALLOCATED;
+
protected:
KWQValueListNodeImpl();
@@ -119,4 +122,67 @@
friend class KWQValueListImpl::KWQValueListPrivate;
};
+inline KWQValueListIteratorImpl::KWQValueListIteratorImpl() :
+ nodeImpl(NULL)
+{
+}
+
+inline bool KWQValueListIteratorImpl::operator==(const KWQValueListIteratorImpl &other)
+{
+ return nodeImpl == other.nodeImpl;
+}
+
+inline bool KWQValueListIteratorImpl::operator!=(const KWQValueListIteratorImpl &other)
+{
+ return nodeImpl != other.nodeImpl;
+}
+
+inline KWQValueListNodeImpl *KWQValueListIteratorImpl::node()
+{
+ return nodeImpl;
+}
+
+inline const KWQValueListNodeImpl *KWQValueListIteratorImpl::node() const
+{
+ return nodeImpl;
+}
+
+inline KWQValueListIteratorImpl& KWQValueListIteratorImpl::operator++()
+{
+ if (nodeImpl != NULL) {
+ nodeImpl = nodeImpl->next;
+ }
+ return *this;
+}
+
+inline KWQValueListIteratorImpl KWQValueListIteratorImpl::operator++(int)
+{
+ KWQValueListIteratorImpl tmp(*this);
+
+ if (nodeImpl != NULL) {
+ nodeImpl = nodeImpl->next;
+ }
+
+ return tmp;
+}
+
+inline KWQValueListIteratorImpl& KWQValueListIteratorImpl::operator--()
+{
+ if (nodeImpl != NULL) {
+ nodeImpl = nodeImpl->prev;
+ }
+ return *this;
+}
+
+inline KWQValueListIteratorImpl::KWQValueListIteratorImpl(const KWQValueListNodeImpl *n) :
+ nodeImpl((KWQValueListNodeImpl *)n)
+{
+}
+
+inline KWQValueListNodeImpl::KWQValueListNodeImpl() :
+ prev(NULL),
+ next(NULL)
+{
+}
+
#endif
1.11.10.1 +5 -67 WebCore/kwq/KWQValueListImpl.mm
Index: KWQValueListImpl.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQValueListImpl.mm,v
retrieving revision 1.11
retrieving revision 1.11.10.1
diff -u -r1.11 -r1.11.10.1
--- KWQValueListImpl.mm 28 Sep 2004 22:55:28 -0000 1.11
+++ KWQValueListImpl.mm 24 Aug 2005 00:13:44 -0000 1.11.10.1
@@ -27,70 +27,6 @@
#import <stdlib.h>
-KWQValueListNodeImpl::KWQValueListNodeImpl() :
- prev(NULL),
- next(NULL)
-{
-}
-
-KWQValueListIteratorImpl::KWQValueListIteratorImpl() :
- nodeImpl(NULL)
-{
-}
-
-bool KWQValueListIteratorImpl::operator==(const KWQValueListIteratorImpl &other)
-{
- return nodeImpl == other.nodeImpl;
-}
-
-bool KWQValueListIteratorImpl::operator!=(const KWQValueListIteratorImpl &other)
-{
- return nodeImpl != other.nodeImpl;
-}
-
-KWQValueListNodeImpl *KWQValueListIteratorImpl::node()
-{
- return nodeImpl;
-}
-
-const KWQValueListNodeImpl *KWQValueListIteratorImpl::node() const
-{
- return nodeImpl;
-}
-
-KWQValueListIteratorImpl& KWQValueListIteratorImpl::operator++()
-{
- if (nodeImpl != NULL) {
- nodeImpl = nodeImpl->next;
- }
- return *this;
-}
-
-KWQValueListIteratorImpl KWQValueListIteratorImpl::operator++(int)
-{
- KWQValueListIteratorImpl tmp(*this);
-
- if (nodeImpl != NULL) {
- nodeImpl = nodeImpl->next;
- }
-
- return tmp;
-}
-
-KWQValueListIteratorImpl& KWQValueListIteratorImpl::operator--()
-{
- if (nodeImpl != NULL) {
- nodeImpl = nodeImpl->prev;
- }
- return *this;
-}
-
-KWQValueListIteratorImpl::KWQValueListIteratorImpl(const KWQValueListNodeImpl *n) :
- nodeImpl((KWQValueListNodeImpl *)n)
-{
-}
-
-
class KWQValueListImpl::KWQValueListPrivate
{
public:
@@ -99,6 +35,8 @@
~KWQValueListPrivate();
+ MAIN_THREAD_ALLOCATED;
+
void copyList(KWQValueListNodeImpl *l, KWQValueListNodeImpl *&head, KWQValueListNodeImpl *&tail) const;
void deleteList(KWQValueListNodeImpl *l);
@@ -112,7 +50,7 @@
uint refCount;
};
-KWQValueListImpl::KWQValueListPrivate::KWQValueListPrivate(void (*deleteFunc)(KWQValueListNodeImpl *),
+inline KWQValueListImpl::KWQValueListPrivate::KWQValueListPrivate(void (*deleteFunc)(KWQValueListNodeImpl *),
KWQValueListNodeImpl *(*copyFunc)(KWQValueListNodeImpl *)) :
head(NULL),
tail(NULL),
@@ -123,7 +61,7 @@
{
}
-KWQValueListImpl::KWQValueListPrivate::KWQValueListPrivate(const KWQValueListPrivate &other) :
+inline KWQValueListImpl::KWQValueListPrivate::KWQValueListPrivate(const KWQValueListPrivate &other) :
deleteNode(other.deleteNode),
copyNode(other.copyNode),
count(other.count),
@@ -132,7 +70,7 @@
other.copyList(other.head, head, tail);
}
-KWQValueListImpl::KWQValueListPrivate::~KWQValueListPrivate()
+inline KWQValueListImpl::KWQValueListPrivate::~KWQValueListPrivate()
{
deleteList(head);
}
More information about the webkit-changes
mailing list