[webkit-changes] cvs commit: JavaScriptCore/kxmlcore PassRefPtr.h
RefPtr.h
Maciej
mjs at opensource.apple.com
Thu Dec 8 10:19:28 PST 2005
mjs 05/12/08 10:19:28
Modified: . ChangeLog
kjs ustring.cpp
kxmlcore PassRefPtr.h RefPtr.h
Log:
Reviewed by John.
- fix major memory leak and resultant slowdown on JavaScript iBench from
my PassRefPtr changes
* kjs/ustring.cpp:
(KJS::UString::Rep::create): I forgot to change one of the two overloads to create
with a refcount of 0 instead of 1 (the smart pointer then bumps it. But instead of
changing it, I changed both to start with a refcounter of 1 and use PassRefPtr::adopt
to adopt the initial refcount, this may be a hair more efficient.
- made the assignment operators for smart pointers inline because Shark said so
* kxmlcore/PassRefPtr.h:
(KXMLCore::::operator=):
* kxmlcore/RefPtr.h:
(KXMLCore::::operator=):
Revision Changes Path
1.895 +20 -0 JavaScriptCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/JavaScriptCore/ChangeLog,v
retrieving revision 1.894
retrieving revision 1.895
diff -u -r1.894 -r1.895
--- ChangeLog 6 Dec 2005 19:38:48 -0000 1.894
+++ ChangeLog 8 Dec 2005 18:19:26 -0000 1.895
@@ -1,3 +1,23 @@
+2005-12-08 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by John.
+
+ - fix major memory leak and resultant slowdown on JavaScript iBench from
+ my PassRefPtr changes
+
+ * kjs/ustring.cpp:
+ (KJS::UString::Rep::create): I forgot to change one of the two overloads to create
+ with a refcount of 0 instead of 1 (the smart pointer then bumps it. But instead of
+ changing it, I changed both to start with a refcounter of 1 and use PassRefPtr::adopt
+ to adopt the initial refcount, this may be a hair more efficient.
+
+ - made the assignment operators for smart pointers inline because Shark said so
+
+ * kxmlcore/PassRefPtr.h:
+ (KXMLCore::::operator=):
+ * kxmlcore/RefPtr.h:
+ (KXMLCore::::operator=):
+
2005-12-06 Anders Carlsson <andersca at mac.com>
Reviewed by Darin.
1.64 +5 -3 JavaScriptCore/kjs/ustring.cpp
Index: ustring.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/ustring.cpp,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- ustring.cpp 6 Dec 2005 09:21:05 -0000 1.63
+++ ustring.cpp 8 Dec 2005 18:19:27 -0000 1.64
@@ -189,7 +189,7 @@
Rep *r = new Rep;
r->offset = 0;
r->len = l;
- r->rc = 0;
+ r->rc = 1;
r->_hash = 0;
r->isIdentifier = 0;
r->baseString = 0;
@@ -198,7 +198,8 @@
r->capacity = l;
r->usedPreCapacity = 0;
r->preCapacity = 0;
- return r;
+ // steal the single reference this Rep was created with
+ return PassRefPtr<Rep>::adopt(r);
}
PassRefPtr<UString::Rep> UString::Rep::create(PassRefPtr<Rep> base, int offset, int length)
@@ -226,7 +227,8 @@
r->capacity = 0;
r->usedPreCapacity = 0;
r->preCapacity = 0;
- return r;
+ // steal the single reference this Rep was created with
+ return PassRefPtr<Rep>::adopt(r);
}
void UString::Rep::destroy()
1.3 +2 -2 JavaScriptCore/kxmlcore/PassRefPtr.h
Index: PassRefPtr.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kxmlcore/PassRefPtr.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PassRefPtr.h 6 Dec 2005 19:38:52 -0000 1.2
+++ PassRefPtr.h 8 Dec 2005 18:19:28 -0000 1.3
@@ -105,7 +105,7 @@
T *m_ptr;
};
- template <class T> PassRefPtr<T>& PassRefPtr<T>::operator=(const RefPtr<T>& o)
+ template <class T> inline PassRefPtr<T>& PassRefPtr<T>::operator=(const RefPtr<T>& o)
{
T *optr = o.m_ptr;
if (optr)
@@ -126,7 +126,7 @@
return *this;
}
- template <class T> PassRefPtr<T>& PassRefPtr<T>::operator=(PassRefPtr<T>& ref)
+ template <class T> inline PassRefPtr<T>& PassRefPtr<T>::operator=(PassRefPtr<T>& ref)
{
T *optr = ref.release();
if (T *ptr = m_ptr)
1.4 +1 -1 JavaScriptCore/kxmlcore/RefPtr.h
Index: RefPtr.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kxmlcore/RefPtr.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RefPtr.h 6 Dec 2005 09:21:08 -0000 1.3
+++ RefPtr.h 8 Dec 2005 18:19:28 -0000 1.4
@@ -88,7 +88,7 @@
return *this;
}
- template <class T> RefPtr<T>& RefPtr<T>::operator=(PassRefPtr_Ref<T> ref)
+ template <class T> inline RefPtr<T>& RefPtr<T>::operator=(PassRefPtr_Ref<T> ref)
{
if (m_ptr)
m_ptr->deref();
More information about the webkit-changes
mailing list